|
@ -28,7 +28,6 @@ this.EXPORTED_SYMBOLS = ['contentObserver']; |
|
|
const {interfaces: Ci, utils: Cu} = Components; |
|
|
const {interfaces: Ci, utils: Cu} = Components; |
|
|
const {Services} = Cu.import('resource://gre/modules/Services.jsm', null); |
|
|
const {Services} = Cu.import('resource://gre/modules/Services.jsm', null); |
|
|
const hostName = Services.io.newURI(Components.stack.filename, null, null).host; |
|
|
const hostName = Services.io.newURI(Components.stack.filename, null, null).host; |
|
|
let uniqueSandboxId = 1; |
|
|
|
|
|
|
|
|
|
|
|
// Cu.import('resource://gre/modules/devtools/Console.jsm');
|
|
|
// Cu.import('resource://gre/modules/devtools/Console.jsm');
|
|
|
|
|
|
|
|
@ -55,6 +54,7 @@ const contentObserver = { |
|
|
contentBaseURI: 'chrome://' + hostName + '/content/js/', |
|
|
contentBaseURI: 'chrome://' + hostName + '/content/js/', |
|
|
cpMessageName: hostName + ':shouldLoad', |
|
|
cpMessageName: hostName + ':shouldLoad', |
|
|
ignoredPopups: new WeakMap(), |
|
|
ignoredPopups: new WeakMap(), |
|
|
|
|
|
uniqueSandboxId: 1, |
|
|
|
|
|
|
|
|
get componentRegistrar() { |
|
|
get componentRegistrar() { |
|
|
return Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
|
|
return Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
|
@ -182,7 +182,7 @@ const contentObserver = { |
|
|
|
|
|
|
|
|
initContentScripts: function(win, sandbox) { |
|
|
initContentScripts: function(win, sandbox) { |
|
|
let messager = getMessageManager(win); |
|
|
let messager = getMessageManager(win); |
|
|
let sandboxId = hostName + ':sb:' + uniqueSandboxId++; |
|
|
|
|
|
|
|
|
let sandboxId = hostName + ':sb:' + this.uniqueSandboxId++; |
|
|
|
|
|
|
|
|
if ( sandbox ) { |
|
|
if ( sandbox ) { |
|
|
let sandboxName = [ |
|
|
let sandboxName = [ |
|
@ -210,10 +210,7 @@ const contentObserver = { |
|
|
|
|
|
|
|
|
sandbox.addMessageListener = function(callback) { |
|
|
sandbox.addMessageListener = function(callback) { |
|
|
if ( sandbox._messageListener_ ) { |
|
|
if ( sandbox._messageListener_ ) { |
|
|
sandbox.removeMessageListener( |
|
|
|
|
|
sandbox._sandboxId_, |
|
|
|
|
|
sandbox._messageListener_ |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
sandbox.removeMessageListener(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
sandbox._messageListener_ = function(message) { |
|
|
sandbox._messageListener_ = function(message) { |
|
|