mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
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', {
|
this.extended = vAPI.messaging.send('vapi', {
|
||||||
what: 'extendClient'
|
what: 'extendClient'
|
||||||
}).then(( ) => {
|
}).then(( ) => {
|
||||||
return vAPI instanceof Object && this.extensions.length !== 0;
|
return self.vAPI instanceof Object &&
|
||||||
|
this.extensions.length !== 0;
|
||||||
}).catch(( ) => {
|
}).catch(( ) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ if ( self.browser instanceof Object ) {
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1408996#c9
|
// 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/464
|
||||||
// https://github.com/chrisaljoudi/uBlock/issues/1528
|
// https://github.com/chrisaljoudi/uBlock/issues/1528
|
||||||
@ -50,15 +50,19 @@ var vAPI = window.vAPI; // jshint ignore:line
|
|||||||
// Skip text/plain documents.
|
// Skip text/plain documents.
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(document instanceof HTMLDocument ||
|
(
|
||||||
document instanceof XMLDocument &&
|
document instanceof HTMLDocument ||
|
||||||
document.createElement('div') instanceof HTMLDivElement
|
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
|
self.vAPI = { uBO: true };
|
||||||
? vAPI
|
|
||||||
: { uBO: true };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ vAPI.SafeAnimationFrame = function(callback) {
|
|||||||
|
|
||||||
vAPI.SafeAnimationFrame.prototype = {
|
vAPI.SafeAnimationFrame.prototype = {
|
||||||
start: function(delay) {
|
start: function(delay) {
|
||||||
if ( vAPI instanceof Object === false ) { return; }
|
if ( self.vAPI instanceof Object === false ) { return; }
|
||||||
if ( delay === undefined ) {
|
if ( delay === undefined ) {
|
||||||
if ( this.fid === undefined ) {
|
if ( this.fid === undefined ) {
|
||||||
this.fid = requestAnimationFrame(( ) => { this.onRAF(); } );
|
this.fid = requestAnimationFrame(( ) => { this.onRAF(); } );
|
||||||
@ -1063,7 +1063,7 @@ vAPI.domCollapser = (function() {
|
|||||||
|
|
||||||
const domWatcherInterface = {
|
const domWatcherInterface = {
|
||||||
onDOMCreated: function() {
|
onDOMCreated: function() {
|
||||||
if ( vAPI instanceof Object === false ) { return; }
|
if ( self.vAPI instanceof Object === false ) { return; }
|
||||||
if ( vAPI.domCollapser instanceof Object === false ) {
|
if ( vAPI.domCollapser instanceof Object === false ) {
|
||||||
if ( vAPI.domWatcher instanceof Object ) {
|
if ( vAPI.domWatcher instanceof Object ) {
|
||||||
vAPI.domWatcher.removeListener(domWatcherInterface);
|
vAPI.domWatcher.removeListener(domWatcherInterface);
|
||||||
@ -1343,11 +1343,11 @@ vAPI.domSurveyor = (function() {
|
|||||||
const domWatcherInterface = {
|
const domWatcherInterface = {
|
||||||
onDOMCreated: function() {
|
onDOMCreated: function() {
|
||||||
if (
|
if (
|
||||||
vAPI instanceof Object === false ||
|
self.vAPI instanceof Object === false ||
|
||||||
vAPI.domSurveyor instanceof Object === false ||
|
vAPI.domSurveyor instanceof Object === false ||
|
||||||
vAPI.domFilterer instanceof Object === false
|
vAPI.domFilterer instanceof Object === false
|
||||||
) {
|
) {
|
||||||
if ( vAPI instanceof Object ) {
|
if ( self.vAPI instanceof Object ) {
|
||||||
if ( vAPI.domWatcher instanceof Object ) {
|
if ( vAPI.domWatcher instanceof Object ) {
|
||||||
vAPI.domWatcher.removeListener(domWatcherInterface);
|
vAPI.domWatcher.removeListener(domWatcherInterface);
|
||||||
}
|
}
|
||||||
@ -1400,7 +1400,7 @@ vAPI.bootstrap = (function() {
|
|||||||
// This can happen on Firefox. For instance:
|
// This can happen on Firefox. For instance:
|
||||||
// https://github.com/gorhill/uBlock/issues/1893
|
// https://github.com/gorhill/uBlock/issues/1893
|
||||||
if ( window.location === null ) { return; }
|
if ( window.location === null ) { return; }
|
||||||
if ( vAPI instanceof Object === false ) { return; }
|
if ( self.vAPI instanceof Object === false ) { return; }
|
||||||
|
|
||||||
vAPI.messaging.send('contentscript', {
|
vAPI.messaging.send('contentscript', {
|
||||||
what: 'shouldRenderNoscriptTags',
|
what: 'shouldRenderNoscriptTags',
|
||||||
|
Loading…
Reference in New Issue
Block a user