import uBO fix for some behind-the-scene requests in Pale Moon

pull/2/head
gorhill 8 years ago
parent 9a26274b11
commit 8464e3d594

@ -1921,44 +1921,52 @@ 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 aWindow; var lc;
if ( channel.notificationCallbacks ) { try {
lc = channel.notificationCallbacks.getInterface(Ci.nsILoadContext);
} catch(ex) {
}
if ( !lc ) {
try { try {
var loadContext = channel lc = channel.loadGroup.notificationCallbacks.getInterface(Ci.nsILoadContext);
.notificationCallbacks } catch(ex) {
.getInterface(Ci.nsILoadContext);
if ( loadContext.topFrameElement ) {
return tabWatcher.tabIdFromTarget(loadContext.topFrameElement);
}
aWindow = loadContext.associatedWindow;
} catch (ex) {
//console.error(ex);
} }
if ( !lc ) {
return vAPI.noTabId;
}
}
if ( lc.topFrameElement ) {
return tabWatcher.tabIdFromTarget(lc.topFrameElement);
} }
var win;
try { try {
if ( !aWindow && channel.loadGroup && channel.loadGroup.notificationCallbacks ) { win = lc.associatedWindow;
aWindow = channel } catch (ex) { }
.loadGroup if ( !win ) {
.notificationCallbacks return vAPI.noTabId;
.getInterface(Ci.nsILoadContext) }
.associatedWindow; if ( win.top ) {
} win = win.top;
if ( aWindow ) { }
return tabWatcher.tabIdFromTarget( var tabBrowser;
aWindow try {
.getInterface(Ci.nsIWebNavigation) tabBrowser = getTabBrowser(
.QueryInterface(Ci.nsIDocShell) win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation)
.rootTreeItem .QueryInterface(Ci.nsIDocShell).rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow)
.getInterface(Ci.nsIDOMWindow) );
.gBrowser } catch (ex) { }
.getBrowserForContentWindow(aWindow) if ( !tabBrowser ) {
); return vAPI.noTabId;
} }
} catch (ex) { if ( tabBrowser.getBrowserForContentWindow ) {
//console.error(ex); return tabWatcher.tabIdFromTarget(tabBrowser.getBrowserForContentWindow(win));
} }
return vAPI.noTabId; // Falling back onto _getTabForContentWindow to ensure older versions
// of Firefox work well.
return tabBrowser._getTabForContentWindow ?
tabWatcher.tabIdFromTarget(tabBrowser._getTabForContentWindow(win)) :
vAPI.noTabId;
}, },
rawtypeFromContentType: function(channel) { rawtypeFromContentType: function(channel) {

Loading…
Cancel
Save