Jacek Caban : mshtml: Get nsIWebProgress from notification callback if load group has no observer.

Alexandre Julliard julliard at winehq.org
Fri Mar 8 19:41:09 CST 2019


Module: wine
Branch: master
Commit: 4accd13d9209e502931b9b11dd002b6dc2f30891
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4accd13d9209e502931b9b11dd002b6dc2f30891

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Mar  8 13:47:02 2019 +0100

mshtml: Get nsIWebProgress from notification callback if load group has no observer.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/nsio.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index ca63a98..b762248 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -951,7 +951,7 @@ static HTMLOuterWindow *get_window_from_load_group(nsChannel *This)
 
 static HTMLOuterWindow *get_channel_window(nsChannel *This)
 {
-    nsIWebProgress *web_progress;
+    nsIWebProgress *web_progress = NULL;
     mozIDOMWindowProxy *mozwindow;
     HTMLOuterWindow *window;
     nsresult nsres;
@@ -960,25 +960,31 @@ static HTMLOuterWindow *get_channel_window(nsChannel *This)
         nsIRequestObserver *req_observer;
 
         nsres = nsILoadGroup_GetGroupObserver(This->load_group, &req_observer);
-        if(NS_FAILED(nsres) || !req_observer) {
+        if(NS_FAILED(nsres)) {
             ERR("GetGroupObserver failed: %08x\n", nsres);
             return NULL;
         }
 
-        nsres = nsIRequestObserver_QueryInterface(req_observer, &IID_nsIWebProgress, (void**)&web_progress);
-        nsIRequestObserver_Release(req_observer);
-        if(NS_FAILED(nsres)) {
-            ERR("Could not get nsIWebProgress iface: %08x\n", nsres);
-            return NULL;
+        if(req_observer) {
+            nsres = nsIRequestObserver_QueryInterface(req_observer, &IID_nsIWebProgress, (void**)&web_progress);
+            nsIRequestObserver_Release(req_observer);
+            if(NS_FAILED(nsres)) {
+                ERR("Could not get nsIWebProgress iface: %08x\n", nsres);
+                return NULL;
+            }
         }
-    }else if(This->notif_callback) {
+    }
+
+    if(!web_progress && This->notif_callback) {
         nsres = nsIInterfaceRequestor_GetInterface(This->notif_callback, &IID_nsIWebProgress, (void**)&web_progress);
         if(NS_FAILED(nsres)) {
             ERR("GetInterface(IID_nsIWebProgress failed: %08x\n", nsres);
             return NULL;
         }
-    }else {
-        ERR("no load group nor notif callback\n");
+    }
+
+    if(!web_progress) {
+        ERR("Could not find nsIWebProgress\n");
         return NULL;
     }
 




More information about the wine-cvs mailing list