1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-01 08:39:37 +02:00
This commit is contained in:
gorhill 2016-03-09 09:54:16 -05:00
parent df61d2a5e6
commit 9772e95046

View File

@ -1970,16 +1970,20 @@ var httpObserver = {
// Also: // Also:
// https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts // https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts
tabIdFromChannel: function(channel) { tabIdFromChannel: function(channel) {
var ncbs = channel.notificationCallbacks;
if ( !ncbs && channel.loadGroup ) {
ncbs = channel.loadGroup.notificationCallbacks;
}
if ( !ncbs ) { return vAPI.noTabId; }
var lc; var lc;
try { try {
lc = ncbs.getInterface(Ci.nsILoadContext); lc = channel.notificationCallbacks.getInterface(Ci.nsILoadContext);
} catch (ex) { } } catch(ex) {
if ( !lc ) { return vAPI.noTabId; } }
if ( !lc ) {
try {
lc = channel.loadGroup.notificationCallbacks.getInterface(Ci.nsILoadContext);
} catch(ex) {
}
if ( !lc ) {
return vAPI.noTabId;
}
}
if ( lc.topFrameElement ) { if ( lc.topFrameElement ) {
return tabWatcher.tabIdFromTarget(lc.topFrameElement); return tabWatcher.tabIdFromTarget(lc.topFrameElement);
} }
@ -1987,7 +1991,9 @@ var httpObserver = {
try { try {
win = lc.associatedWindow; win = lc.associatedWindow;
} catch (ex) { } } catch (ex) { }
if ( !win ) { return vAPI.noTabId; } if ( !win ) {
return vAPI.noTabId;
}
if ( win.top ) { if ( win.top ) {
win = win.top; win = win.top;
} }
@ -1999,7 +2005,9 @@ var httpObserver = {
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow) .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow)
); );
} catch (ex) { } } catch (ex) { }
if ( !tabBrowser ) { return vAPI.noTabId; } if ( !tabBrowser ) {
return vAPI.noTabId;
}
if ( tabBrowser.getBrowserForContentWindow ) { if ( tabBrowser.getBrowserForContentWindow ) {
return tabWatcher.tabIdFromTarget(tabBrowser.getBrowserForContentWindow(win)); return tabWatcher.tabIdFromTarget(tabBrowser.getBrowserForContentWindow(win));
} }