From 9772e95046a5bcbdd8458bf854a5aae7e87f04c2 Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 9 Mar 2016 09:54:16 -0500 Subject: [PATCH] this fixes #1459 --- platform/firefox/vapi-background.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 1bb627eb8..0e72d330b 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -1970,16 +1970,20 @@ var httpObserver = { // Also: // https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts tabIdFromChannel: function(channel) { - var ncbs = channel.notificationCallbacks; - if ( !ncbs && channel.loadGroup ) { - ncbs = channel.loadGroup.notificationCallbacks; - } - if ( !ncbs ) { return vAPI.noTabId; } var lc; try { - lc = ncbs.getInterface(Ci.nsILoadContext); - } catch (ex) { } - if ( !lc ) { return vAPI.noTabId; } + lc = channel.notificationCallbacks.getInterface(Ci.nsILoadContext); + } catch(ex) { + } + if ( !lc ) { + try { + lc = channel.loadGroup.notificationCallbacks.getInterface(Ci.nsILoadContext); + } catch(ex) { + } + if ( !lc ) { + return vAPI.noTabId; + } + } if ( lc.topFrameElement ) { return tabWatcher.tabIdFromTarget(lc.topFrameElement); } @@ -1987,7 +1991,9 @@ var httpObserver = { try { win = lc.associatedWindow; } catch (ex) { } - if ( !win ) { return vAPI.noTabId; } + if ( !win ) { + return vAPI.noTabId; + } if ( win.top ) { win = win.top; } @@ -1999,7 +2005,9 @@ var httpObserver = { .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow) ); } catch (ex) { } - if ( !tabBrowser ) { return vAPI.noTabId; } + if ( !tabBrowser ) { + return vAPI.noTabId; + } if ( tabBrowser.getBrowserForContentWindow ) { return tabWatcher.tabIdFromTarget(tabBrowser.getBrowserForContentWindow(win)); }