Skip to content

Commit

Permalink
this fixes gorhill#1444
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Mar 5, 2016
1 parent 324c26b commit ee23f96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion platform/firefox/frameModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 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

/******************************************************************************/

Expand Down
9 changes: 7 additions & 2 deletions platform/firefox/frameScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ let {contentObserver, LocationChangeListener} = Components.utils.import(
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) {
if ( !win || !win.document ) {
return;
Expand Down Expand Up @@ -61,7 +66,7 @@ let shutdown = function(ev) {
}
context.removeMessageListener('ublock0-load-completed', onLoadCompleted);
context.removeEventListener('unload', shutdown);
context.locationChangeListener = null;
locationChangeListener = null;
LocationChangeListener = null;
contentObserver = null;
};
Expand All @@ -74,7 +79,7 @@ if ( context.docShell ) {
let dw = wp.DOMWindow;

if ( dw === dw.top ) {
context.locationChangeListener = new LocationChangeListener(context.docShell);
locationChangeListener = new LocationChangeListener(context.docShell);
}
}

Expand Down

0 comments on commit ee23f96

Please sign in to comment.