|
|
@ -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,6 +215,7 @@ const contentObserver = {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}.bind(sandbox);
|
|
|
|
}.bind(sandbox);
|
|
|
|
sandbox.removeMessageListener = function() {
|
|
|
|
sandbox.removeMessageListener = function() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
messager.removeMessageListener(
|
|
|
|
messager.removeMessageListener(
|
|
|
|
this._sandboxId_,
|
|
|
|
this._sandboxId_,
|
|
|
|
this._messageListener_
|
|
|
|
this._messageListener_
|
|
|
@ -223,6 +224,10 @@ const contentObserver = {
|
|
|
|
hostName + ':broadcast',
|
|
|
|
hostName + ':broadcast',
|
|
|
|
this._messageListener_
|
|
|
|
this._messageListener_
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
|
|
|
// It throws sometimes, mostly when the popup closes
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this._messageListener_ = null;
|
|
|
|
this._messageListener_ = null;
|
|
|
|
}.bind(sandbox);
|
|
|
|
}.bind(sandbox);
|
|
|
|
|
|
|
|
|
|
|
|