Jacek Caban : mshtml: Always call OnStartRequest before OnStopRequest.
Module: wine Branch: master Commit: 9e30813595d3700cd135ae8fd0d69c723fa85f7b URL: http://source.winehq.org/git/wine.git/?a=commit;h=9e30813595d3700cd135ae8fd0... Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Aug 30 01:01:16 2009 +0200 mshtml: Always call OnStartRequest before OnStopRequest. --- dlls/mshtml/navigate.c | 50 +++++++++++++++++++++++++++++++---------------- 1 files changed, 33 insertions(+), 17 deletions(-) diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 0980686..1a0d5eb 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -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;
participants (1)
-
Alexandre Julliard