Commit 9e308135 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Always call OnStartRequest before OnStopRequest.

parent 7b156524
......@@ -879,6 +879,38 @@ struct nsChannelBSC {
nsProtocolStream *nsstream;
};
static void on_start_nsrequest(nsChannelBSC *This)
{
nsresult nsres;
/* FIXME: it's needed for http connections from BindToObject. */
if(!This->nschannel->response_status)
This->nschannel->response_status = 200;
nsres = nsIStreamListener_OnStartRequest(This->nslistener,
(nsIRequest*)NSCHANNEL(This->nschannel), This->nscontext);
if(NS_FAILED(nsres))
FIXME("OnStartRequest failed: %08x\n", nsres);
}
static void on_stop_nsrequest(nsChannelBSC *This)
{
nsresult nsres;
if(!This->nslistener)
return;
if(!This->bsc.readed) {
TRACE("No data read! Calling OnStartRequest\n");
on_start_nsrequest(This);
}
nsres = nsIStreamListener_OnStopRequest(This->nslistener, (nsIRequest*)NSCHANNEL(This->nschannel),
This->nscontext, NS_OK);
if(NS_FAILED(nsres))
WARN("OnStopRequest failed: %08x\n", nsres);
}
static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
{
DWORD read;
......@@ -914,14 +946,7 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
&& (BYTE)This->nsstream->buf[1] == 0xfe)
This->nschannel->charset = heap_strdupA(UTF16_STR);
/* FIXME: it's needed for http connections from BindToObject. */
if(!This->nschannel->response_status)
This->nschannel->response_status = 200;
nsres = nsIStreamListener_OnStartRequest(This->nslistener,
(nsIRequest*)NSCHANNEL(This->nschannel), This->nscontext);
if(NS_FAILED(nsres))
FIXME("OnStartRequest failed: %08x\n", nsres);
on_start_nsrequest(This);
/* events are reset when a new document URI is loaded, so re-initialise them here */
if(This->bsc.doc && This->bsc.doc->bscallback == This && This->bsc.doc->nscontainer) {
......@@ -948,15 +973,6 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
return S_OK;
}
static void on_stop_nsrequest(nsChannelBSC *This)
{
if(!This->nslistener)
return;
nsIStreamListener_OnStopRequest(This->nslistener, (nsIRequest*)NSCHANNEL(This->nschannel),
This->nscontext, NS_OK);
}
static void add_nsrequest(nsChannelBSC *This)
{
nsresult nsres;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment