mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-10-01 09:36:29 +13:00
cleaning up last committed code
This commit is contained in:
parent
2cd6961ed4
commit
1d2954c39c
2 changed files with 26 additions and 20 deletions
|
@ -49,7 +49,7 @@ const getMessageManager = function(win) {
|
||||||
|
|
||||||
const contentObserver = {
|
const contentObserver = {
|
||||||
classDescription: 'content-policy for ' + hostName,
|
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',
|
contractID: '@' + hostName + '/content-policy;1',
|
||||||
ACCEPT: Ci.nsIContentPolicy.ACCEPT,
|
ACCEPT: Ci.nsIContentPolicy.ACCEPT,
|
||||||
MAIN_FRAME: Ci.nsIContentPolicy.TYPE_DOCUMENT,
|
MAIN_FRAME: Ci.nsIContentPolicy.TYPE_DOCUMENT,
|
||||||
|
|
|
@ -1002,7 +1002,7 @@ HTTPRequestHeaders.prototype.setHeader = function(name, newValue, create) {
|
||||||
|
|
||||||
var httpObserver = {
|
var httpObserver = {
|
||||||
classDescription: 'net-channel-event-sinks for ' + location.host,
|
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',
|
contractID: '@' + location.host + '/net-channel-event-sinks;1',
|
||||||
REQDATAKEY: location.host + 'reqdata',
|
REQDATAKEY: location.host + 'reqdata',
|
||||||
ABORT: Components.results.NS_BINDING_ABORTED,
|
ABORT: Components.results.NS_BINDING_ABORTED,
|
||||||
|
@ -1210,24 +1210,29 @@ var httpObserver = {
|
||||||
// Not sure `umatrix:shouldLoad` is still needed, uMatrix does not
|
// Not sure `umatrix:shouldLoad` is still needed, uMatrix does not
|
||||||
// care about embedded frames topography.
|
// care about embedded frames topography.
|
||||||
var tabId = vAPI.noTabId;
|
var tabId = vAPI.noTabId;
|
||||||
var loadCtx;
|
var aWindow;
|
||||||
|
|
||||||
|
if ( channel.notificationCallbacks ) {
|
||||||
try {
|
try {
|
||||||
loadCtx = channel
|
aWindow = channel
|
||||||
.QueryInterface(Components.interfaces.nsIChannel)
|
|
||||||
.notificationCallbacks
|
.notificationCallbacks
|
||||||
.getInterface(Components.interfaces.nsILoadContext);
|
.getInterface(Components.interfaces.nsILoadContext)
|
||||||
|
.associatedWindow;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( !aWindow && channel.loadGroup && channel.loadGroup.notificationCallbacks ) {
|
||||||
try {
|
try {
|
||||||
loadCtx = channel
|
aWindow = channel
|
||||||
.loadGroup.notificationCallbacks
|
.loadGroup.notificationCallbacks
|
||||||
.getInterface(Components.interfaces.nsILoadContext);
|
.getInterface(Components.interfaces.nsILoadContext)
|
||||||
|
.associatedWindow;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( loadCtx && loadCtx.associatedWindow ) {
|
if ( aWindow ) {
|
||||||
tabId = vAPI.tabs.getTabId(
|
try {
|
||||||
loadCtx
|
tabId = vAPI.tabs.getTabId(aWindow
|
||||||
.associatedWindow
|
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsIDocShell)
|
.QueryInterface(Ci.nsIDocShell)
|
||||||
|
@ -1235,8 +1240,10 @@ var httpObserver = {
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindow)
|
.getInterface(Ci.nsIDOMWindow)
|
||||||
.gBrowser
|
.gBrowser
|
||||||
.getBrowserForContentWindow(loadCtx.associatedWindow)
|
.getBrowserForContentWindow(aWindow)
|
||||||
);
|
);
|
||||||
|
} catch (ex) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type = channel.loadInfo && channel.loadInfo.contentPolicyType || 1;
|
type = channel.loadInfo && channel.loadInfo.contentPolicyType || 1;
|
||||||
|
@ -1252,7 +1259,6 @@ var httpObserver = {
|
||||||
|
|
||||||
// Carry data for behind-the-scene redirects
|
// Carry data for behind-the-scene redirects
|
||||||
channel.setProperty(this.REQDATAKEY, [tabId, type]);
|
channel.setProperty(this.REQDATAKEY, [tabId, type]);
|
||||||
return;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// contentPolicy.shouldLoad doesn't detect redirects, this needs to be used
|
// contentPolicy.shouldLoad doesn't detect redirects, this needs to be used
|
||||||
|
|
Loading…
Reference in a new issue