mirror of https://github.com/gorhill/uBlock.git
Use `self` when testing for `vAPI` presence
This commit is contained in:
parent
a8df19fee4
commit
3f074d7908
|
@ -227,7 +227,8 @@ vAPI.messaging = {
|
|||
this.extended = vAPI.messaging.send('vapi', {
|
||||
what: 'extendClient'
|
||||
}).then(( ) => {
|
||||
return vAPI instanceof Object && this.extensions.length !== 0;
|
||||
return self.vAPI instanceof Object &&
|
||||
this.extensions.length !== 0;
|
||||
}).catch(( ) => {
|
||||
});
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ if ( self.browser instanceof Object ) {
|
|||
/******************************************************************************/
|
||||
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1408996#c9
|
||||
var vAPI = window.vAPI; // jshint ignore:line
|
||||
var vAPI = self.vAPI; // jshint ignore:line
|
||||
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/464
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/1528
|
||||
|
@ -50,15 +50,19 @@ var vAPI = window.vAPI; // jshint ignore:line
|
|||
// Skip text/plain documents.
|
||||
|
||||
if (
|
||||
(document instanceof HTMLDocument ||
|
||||
document instanceof XMLDocument &&
|
||||
document.createElement('div') instanceof HTMLDivElement
|
||||
(
|
||||
document instanceof HTMLDocument ||
|
||||
document instanceof XMLDocument &&
|
||||
document.createElement('div') instanceof HTMLDivElement
|
||||
) &&
|
||||
(/^image\/|^text\/plain/.test(document.contentType || '') === false)
|
||||
(
|
||||
/^image\/|^text\/plain/.test(document.contentType || '') === false
|
||||
) &&
|
||||
(
|
||||
self.vAPI instanceof Object === false || vAPI.uBO !== true
|
||||
)
|
||||
) {
|
||||
vAPI = window.vAPI = vAPI instanceof Object && vAPI.uBO === true
|
||||
? vAPI
|
||||
: { uBO: true };
|
||||
self.vAPI = { uBO: true };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ vAPI.SafeAnimationFrame = function(callback) {
|
|||
|
||||
vAPI.SafeAnimationFrame.prototype = {
|
||||
start: function(delay) {
|
||||
if ( vAPI instanceof Object === false ) { return; }
|
||||
if ( self.vAPI instanceof Object === false ) { return; }
|
||||
if ( delay === undefined ) {
|
||||
if ( this.fid === undefined ) {
|
||||
this.fid = requestAnimationFrame(( ) => { this.onRAF(); } );
|
||||
|
@ -1063,7 +1063,7 @@ vAPI.domCollapser = (function() {
|
|||
|
||||
const domWatcherInterface = {
|
||||
onDOMCreated: function() {
|
||||
if ( vAPI instanceof Object === false ) { return; }
|
||||
if ( self.vAPI instanceof Object === false ) { return; }
|
||||
if ( vAPI.domCollapser instanceof Object === false ) {
|
||||
if ( vAPI.domWatcher instanceof Object ) {
|
||||
vAPI.domWatcher.removeListener(domWatcherInterface);
|
||||
|
@ -1343,11 +1343,11 @@ vAPI.domSurveyor = (function() {
|
|||
const domWatcherInterface = {
|
||||
onDOMCreated: function() {
|
||||
if (
|
||||
vAPI instanceof Object === false ||
|
||||
self.vAPI instanceof Object === false ||
|
||||
vAPI.domSurveyor instanceof Object === false ||
|
||||
vAPI.domFilterer instanceof Object === false
|
||||
) {
|
||||
if ( vAPI instanceof Object ) {
|
||||
if ( self.vAPI instanceof Object ) {
|
||||
if ( vAPI.domWatcher instanceof Object ) {
|
||||
vAPI.domWatcher.removeListener(domWatcherInterface);
|
||||
}
|
||||
|
@ -1400,7 +1400,7 @@ vAPI.bootstrap = (function() {
|
|||
// This can happen on Firefox. For instance:
|
||||
// https://github.com/gorhill/uBlock/issues/1893
|
||||
if ( window.location === null ) { return; }
|
||||
if ( vAPI instanceof Object === false ) { return; }
|
||||
if ( self.vAPI instanceof Object === false ) { return; }
|
||||
|
||||
vAPI.messaging.send('contentscript', {
|
||||
what: 'shouldRenderNoscriptTags',
|
||||
|
|
Loading…
Reference in New Issue