diff options
author | gorhill <rhill@raymondhill.net> | 2015-06-17 17:56:04 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2015-06-17 17:56:04 -0400 |
commit | 04dad2716562cb8bad8ff0db21e7267204e0967d (patch) | |
tree | 7d8949206ba46ae6186a406fa5205bbb2b64c62e /platform/firefox | |
parent | fcf77ff2e9766db119a8389a7c3f64f992ca9c8f (diff) | |
download | uBlock-04dad2716562cb8bad8ff0db21e7267204e0967d.zip uBlock-04dad2716562cb8bad8ff0db21e7267204e0967d.tar.gz uBlock-04dad2716562cb8bad8ff0db21e7267204e0967d.tar.bz2 |
this fixes warnings about "Services" being undefined after re-enabling uBlock
Diffstat (limited to 'platform/firefox')
-rw-r--r-- | platform/firefox/frameModule.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js index 87edc75..fa5e76b 100644 --- a/platform/firefox/frameModule.js +++ b/platform/firefox/frameModule.js @@ -135,6 +135,17 @@ const contentObserver = { // https://bugzil.la/612921 shouldLoad: function(type, location, origin, context) { + // For whatever reason, sometimes the global scope is completely + // uninitialized at this point. Repro steps: + // - Launch FF with uBlock enabled + // - Disable uBlock + // - Enable uBlock + // - Services and all other global variables are undefined + // Hopefully will eventually understand why this happens. + if ( Services === undefined ) { + return this.ACCEPT; + } + if ( !context ) { return this.ACCEPT; } @@ -284,6 +295,17 @@ const contentObserver = { }, observe: function(doc) { + // For whatever reason, sometimes the global scope is completely + // uninitialized at this point. Repro steps: + // - Launch FF with uBlock enabled + // - Disable uBlock + // - Enable uBlock + // - Services and all other global variables are undefined + // Hopefully will eventually understand why this happens. + if ( Services === undefined ) { + return; + } + let win = doc.defaultView; if ( !win ) { |