From 4accd13d9209e502931b9b11dd002b6dc2f30891 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 8 Mar 2019 13:47:02 +0100 Subject: [PATCH] mshtml: Get nsIWebProgress from notification callback if load group has no observer. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- 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 ca63a98c82e..b76224844c7 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; }