From 1d2954c39c4f824b4fc2c853b3e8576e2860cf6d Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 7 May 2015 17:50:51 -0400 Subject: [PATCH] cleaning up last committed code --- platform/firefox/frameModule.js | 2 +- platform/firefox/vapi-background.js | 44 ++++++++++++++++------------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js index 02638fb..91b55b0 100644 --- a/platform/firefox/frameModule.js +++ b/platform/firefox/frameModule.js @@ -49,7 +49,7 @@ const getMessageManager = function(win) { const contentObserver = { classDescription: 'content-policy for ' + hostName, - classID: Components.ID('{d8baca19-b666-4c09-84b1-a36d9a0bb03f}'), + classID: Components.ID('{c84283d4-9975-41b7-b1a4-f106af56b51d}'), contractID: '@' + hostName + '/content-policy;1', ACCEPT: Ci.nsIContentPolicy.ACCEPT, MAIN_FRAME: Ci.nsIContentPolicy.TYPE_DOCUMENT, diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 14da866..a542f73 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -1002,7 +1002,7 @@ HTTPRequestHeaders.prototype.setHeader = function(name, newValue, create) { var httpObserver = { classDescription: 'net-channel-event-sinks for ' + location.host, - classID: Components.ID('{dc8d6319-5f6e-4438-999e-53722db99e84}'), + classID: Components.ID('{5d2e2797-6d68-42e2-8aeb-81ce6ba16b95}'), contractID: '@' + location.host + '/net-channel-event-sinks;1', REQDATAKEY: location.host + 'reqdata', ABORT: Components.results.NS_BINDING_ABORTED, @@ -1210,24 +1210,29 @@ var httpObserver = { // Not sure `umatrix:shouldLoad` is still needed, uMatrix does not // care about embedded frames topography. var tabId = vAPI.noTabId; - var loadCtx; - try { - loadCtx = channel - .QueryInterface(Components.interfaces.nsIChannel) - .notificationCallbacks - .getInterface(Components.interfaces.nsILoadContext); - } catch (ex) { - try { - loadCtx = channel - .loadGroup.notificationCallbacks - .getInterface(Components.interfaces.nsILoadContext); + var aWindow; + + if ( channel.notificationCallbacks ) { + try { + aWindow = channel + .notificationCallbacks + .getInterface(Components.interfaces.nsILoadContext) + .associatedWindow; + } catch (ex) { + } + } + if ( !aWindow && channel.loadGroup && channel.loadGroup.notificationCallbacks ) { + try { + aWindow = channel + .loadGroup.notificationCallbacks + .getInterface(Components.interfaces.nsILoadContext) + .associatedWindow; } catch (ex) { } } - if ( loadCtx && loadCtx.associatedWindow ) { - tabId = vAPI.tabs.getTabId( - loadCtx - .associatedWindow + if ( aWindow ) { + try { + tabId = vAPI.tabs.getTabId(aWindow .QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShell) @@ -1235,8 +1240,10 @@ var httpObserver = { .QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindow) .gBrowser - .getBrowserForContentWindow(loadCtx.associatedWindow) - ); + .getBrowserForContentWindow(aWindow) + ); + } catch (ex) { + } } type = channel.loadInfo && channel.loadInfo.contentPolicyType || 1; @@ -1252,7 +1259,6 @@ var httpObserver = { // Carry data for behind-the-scene redirects channel.setProperty(this.REQDATAKEY, [tabId, type]); - return; }, // contentPolicy.shouldLoad doesn't detect redirects, this needs to be used