mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-29 11:30:20 +12:00
Miscellaneous changes
This commit is contained in:
parent
f51bb42fa4
commit
46883756e5
|
@ -63,7 +63,7 @@ const contentObserver = {
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: (function() {
|
QueryInterface: (function() {
|
||||||
let {XPCOMUtils} = Cu.import('resource://gre/modules/XPCOMUtils.jsm', {});
|
let {XPCOMUtils} = Cu.import('resource://gre/modules/XPCOMUtils.jsm', null);
|
||||||
|
|
||||||
return XPCOMUtils.generateQI([
|
return XPCOMUtils.generateQI([
|
||||||
Ci.nsIFactory,
|
Ci.nsIFactory,
|
||||||
|
@ -117,7 +117,7 @@ const contentObserver = {
|
||||||
return this.ACCEPT;
|
return this.ACCEPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
var opener;
|
let openerURL;
|
||||||
|
|
||||||
if ( location.scheme !== 'http' && location.scheme !== 'https' ) {
|
if ( location.scheme !== 'http' && location.scheme !== 'https' ) {
|
||||||
if ( type !== this.MAIN_FRAME ) {
|
if ( type !== this.MAIN_FRAME ) {
|
||||||
|
@ -127,10 +127,10 @@ const contentObserver = {
|
||||||
context = context.contentWindow || context;
|
context = context.contentWindow || context;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
opener = context.opener.location.href;
|
openerURL = context.opener.location.href;
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
|
|
||||||
let isPopup = location.spec === 'about:blank' && opener;
|
let isPopup = location.spec === 'about:blank' && openerURL;
|
||||||
|
|
||||||
if ( location.scheme !== 'data' && !isPopup ) {
|
if ( location.scheme !== 'data' && !isPopup ) {
|
||||||
return this.ACCEPT;
|
return this.ACCEPT;
|
||||||
|
@ -139,7 +139,7 @@ const contentObserver = {
|
||||||
context = context.contentWindow || context;
|
context = context.contentWindow || context;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
opener = context.opener.location.href;
|
openerURL = context.opener.location.href;
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
} else {
|
} else {
|
||||||
context = (context.ownerDocument || context).defaultView;
|
context = (context.ownerDocument || context).defaultView;
|
||||||
|
@ -150,7 +150,7 @@ const contentObserver = {
|
||||||
if ( context.top && context.location ) {
|
if ( context.top && context.location ) {
|
||||||
// https://bugzil.la/1092216
|
// https://bugzil.la/1092216
|
||||||
getMessageManager(context).sendRpcMessage(this.cpMessageName, {
|
getMessageManager(context).sendRpcMessage(this.cpMessageName, {
|
||||||
opener: opener || null,
|
openerURL: openerURL || null,
|
||||||
url: location.spec,
|
url: location.spec,
|
||||||
type: type,
|
type: type,
|
||||||
frameId: type === this.MAIN_FRAME ? -1 : (context === context.top ? 0 : 1),
|
frameId: type === this.MAIN_FRAME ? -1 : (context === context.top ? 0 : 1),
|
||||||
|
@ -215,14 +215,19 @@ const contentObserver = {
|
||||||
);
|
);
|
||||||
}.bind(sandbox);
|
}.bind(sandbox);
|
||||||
sandbox.removeMessageListener = function() {
|
sandbox.removeMessageListener = function() {
|
||||||
messager.removeMessageListener(
|
try {
|
||||||
this._sandboxId_,
|
messager.removeMessageListener(
|
||||||
this._messageListener_
|
this._sandboxId_,
|
||||||
);
|
this._messageListener_
|
||||||
messager.removeMessageListener(
|
);
|
||||||
hostName + ':broadcast',
|
messager.removeMessageListener(
|
||||||
this._messageListener_
|
hostName + ':broadcast',
|
||||||
);
|
this._messageListener_
|
||||||
|
);
|
||||||
|
} catch (ex) {
|
||||||
|
// It throws sometimes, mostly when the popup closes
|
||||||
|
}
|
||||||
|
|
||||||
this._messageListener_ = null;
|
this._messageListener_ = null;
|
||||||
}.bind(sandbox);
|
}.bind(sandbox);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue