1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00

this fixes warnings about "Services" being undefined after re-enabling uBlock

This commit is contained in:
gorhill 2015-06-17 17:56:04 -04:00
parent fcf77ff2e9
commit 04dad27165

View File

@ -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 ) {