This commit is contained in:
gorhill 2016-03-05 14:04:36 -05:00
parent 324c26b20c
commit ee23f96bb3
2 changed files with 9 additions and 3 deletions

View File

@ -33,7 +33,8 @@ const {XPCOMUtils} = Cu.import('resource://gre/modules/XPCOMUtils.jsm', null);
const hostName = Services.io.newURI(Components.stack.filename, null, null).host; const hostName = Services.io.newURI(Components.stack.filename, null, null).host;
const rpcEmitterName = hostName + ':child-process-message'; const rpcEmitterName = hostName + ':child-process-message';
//Cu.import('resource://gre/modules/Console.jsm'); //Cu.import('resource://gre/modules/Console.jsm'); // Firefox >= 44
//Cu.import('resource://gre/modules/devtools/Console.jsm'); // Firefox < 44
/******************************************************************************/ /******************************************************************************/

View File

@ -34,6 +34,11 @@ let {contentObserver, LocationChangeListener} = Components.utils.import(
null null
); );
// https://github.com/gorhill/uBlock/issues/1444
// Apparently the same context is used for all extensions, hence we must use
// scoped variables to ensure no collision.
let locationChangeListener;
let injectContentScripts = function(win) { let injectContentScripts = function(win) {
if ( !win || !win.document ) { if ( !win || !win.document ) {
return; return;
@ -61,7 +66,7 @@ let shutdown = function(ev) {
} }
context.removeMessageListener('ublock0-load-completed', onLoadCompleted); context.removeMessageListener('ublock0-load-completed', onLoadCompleted);
context.removeEventListener('unload', shutdown); context.removeEventListener('unload', shutdown);
context.locationChangeListener = null; locationChangeListener = null;
LocationChangeListener = null; LocationChangeListener = null;
contentObserver = null; contentObserver = null;
}; };
@ -74,7 +79,7 @@ if ( context.docShell ) {
let dw = wp.DOMWindow; let dw = wp.DOMWindow;
if ( dw === dw.top ) { if ( dw === dw.top ) {
context.locationChangeListener = new LocationChangeListener(context.docShell); locationChangeListener = new LocationChangeListener(context.docShell);
} }
} }