Jacek Caban : mshtml: Call nsILoadGroup::AddRequest from AsyncOpen.

Alexandre Julliard julliard at winehq.org
Wed Aug 18 12:10:00 CDT 2010


Module: wine
Branch: master
Commit: a14d142555922a98775af0daf638c9d7822f1a36
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a14d142555922a98775af0daf638c9d7822f1a36

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Aug 18 13:38:30 2010 +0200

mshtml: Call nsILoadGroup::AddRequest from AsyncOpen.

---

 dlls/mshtml/navigate.c |   41 ++++++++++++++---------------------------
 dlls/mshtml/nsio.c     |    6 ++++++
 2 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 5cd63c1..64830c3 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -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);
 
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index d88ccde..758bac0 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -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;
 }




More information about the wine-cvs mailing list