mirror of https://github.com/gorhill/uBlock.git
this fixes #1444
This commit is contained in:
parent
324c26b20c
commit
ee23f96bb3
|
@ -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
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue