mshtml: Call nsILoadGroup::AddRequest from AsyncOpen.

This commit is contained in:
Jacek Caban 2010-08-18 13:38:30 +02:00 committed by Alexandre Julliard
parent a9dec383d5
commit a14d142555
2 changed files with 20 additions and 27 deletions

View File

@ -982,18 +982,25 @@ static void on_stop_nsrequest(nsChannelBSC *This, HRESULT result)
{
nsresult nsres;
if(!This->nslistener)
return;
if(!This->bsc.readed && SUCCEEDED(result)) {
TRACE("No data read! Calling OnStartRequest\n");
on_start_nsrequest(This);
}
nsres = nsIStreamListener_OnStopRequest(This->nslistener, (nsIRequest*)NSCHANNEL(This->nschannel),
This->nscontext, SUCCEEDED(result) ? NS_OK : NS_ERROR_FAILURE);
if(NS_FAILED(nsres))
WARN("OnStopRequest failed: %08x\n", nsres);
if(This->nslistener) {
nsres = nsIStreamListener_OnStopRequest(This->nslistener,
(nsIRequest*)NSCHANNEL(This->nschannel),
This->nscontext, SUCCEEDED(result) ? NS_OK : NS_ERROR_FAILURE);
if(NS_FAILED(nsres))
WARN("OnStopRequet failed: %08x\n", nsres);
}
if(This->nschannel->load_group) {
nsres = nsILoadGroup_RemoveRequest(This->nschannel->load_group,
(nsIRequest*)NSCHANNEL(This->nschannel), NULL, NS_OK);
if(NS_FAILED(nsres))
ERR("RemoveRequest failed: %08x\n", nsres);
}
}
static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
@ -1073,20 +1080,6 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
return S_OK;
}
static void add_nsrequest(nsChannelBSC *This)
{
nsresult nsres;
if(!This->nschannel || !This->nschannel->load_group)
return;
nsres = nsILoadGroup_AddRequest(This->nschannel->load_group,
(nsIRequest*)NSCHANNEL(This->nschannel), This->nscontext);
if(NS_FAILED(nsres))
ERR("AddRequest failed:%08x\n", nsres);
}
#define NSCHANNELBSC_THIS(bsc) ((nsChannelBSC*) bsc)
static void nsChannelBSC_destroy(BSCallback *bsc)
@ -1106,10 +1099,6 @@ static void nsChannelBSC_destroy(BSCallback *bsc)
static HRESULT nsChannelBSC_start_binding(BSCallback *bsc)
{
nsChannelBSC *This = NSCHANNELBSC_THIS(bsc);
add_nsrequest(This);
return S_OK;
}
@ -1393,8 +1382,6 @@ HRESULT channelbsc_load_stream(nsChannelBSC *bscallback, IStream *stream)
if(!bscallback->nschannel->content_type)
return E_OUTOFMEMORY;
add_nsrequest(bscallback);
hres = read_stream_data(bscallback, stream);
IBindStatusCallback_OnStopBinding(STATUSCLB(&bscallback->bsc), hres, ERROR_SUCCESS);

View File

@ -1035,6 +1035,12 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
if(open)
nsres = async_open(This, window, This->uri->is_doc_uri, aListener, aContext);
if(NS_SUCCEEDED(nsres) && This->load_group) {
nsres = nsILoadGroup_AddRequest(This->load_group, (nsIRequest*)NSCHANNEL(This), aContext);
if(NS_FAILED(nsres))
ERR("AddRequest failed: %08x\n", nsres);
}
IHTMLWindow2_Release(HTMLWINDOW2(window));
return nsres;
}