mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
this fixes warnings about "Services" being undefined after re-enabling uBlock
This commit is contained in:
parent
fcf77ff2e9
commit
04dad27165
@ -135,6 +135,17 @@ const contentObserver = {
|
|||||||
|
|
||||||
// https://bugzil.la/612921
|
// https://bugzil.la/612921
|
||||||
shouldLoad: function(type, location, origin, context) {
|
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 ) {
|
if ( !context ) {
|
||||||
return this.ACCEPT;
|
return this.ACCEPT;
|
||||||
}
|
}
|
||||||
@ -284,6 +295,17 @@ const contentObserver = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
observe: function(doc) {
|
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;
|
let win = doc.defaultView;
|
||||||
|
|
||||||
if ( !win ) {
|
if ( !win ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user