mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
this fixes #1004
This commit is contained in:
parent
9ce6f9eb23
commit
1e0014116b
@ -712,8 +712,24 @@ var getTabBrowser = (function() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/gorhill/uBlock/issues/1004
|
||||||
|
// Merely READING the `gBrowser` property causes the issue -- no
|
||||||
|
// need to even use its returned value... This really should be fixed
|
||||||
|
// in the browser.
|
||||||
|
// Meanwhile, the workaround is to check whether the document is
|
||||||
|
// ready. This is hacky, as the code below has to make assumption
|
||||||
|
// about the browser's inner working -- specifically that the `gBrowser`
|
||||||
|
// property should NOT be accessed before the document of the window is
|
||||||
|
// in its ready state.
|
||||||
|
|
||||||
return function(win) {
|
return function(win) {
|
||||||
return win && win.gBrowser || null;
|
if ( win ) {
|
||||||
|
var doc = win.document;
|
||||||
|
if ( doc && doc.readyState === 'complete' ) {
|
||||||
|
return win.gBrowser || null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user