mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-02 23:57:10 +02:00
Fix eslint warnings
This commit is contained in:
parent
0579d14d52
commit
d2ea9c1b2f
@ -22,14 +22,10 @@
|
|||||||
|
|
||||||
// For background page
|
// For background page
|
||||||
|
|
||||||
/* globals browser */
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
import webext from './webext.js';
|
|
||||||
import { ubolog } from './console.js';
|
import { ubolog } from './console.js';
|
||||||
|
import webext from './webext.js';
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
@ -47,6 +43,9 @@ if ( vAPI.canWASM === false ) {
|
|||||||
|
|
||||||
vAPI.supportsUserStylesheets = vAPI.webextFlavor.soup.has('user_stylesheet');
|
vAPI.supportsUserStylesheets = vAPI.webextFlavor.soup.has('user_stylesheet');
|
||||||
|
|
||||||
|
const hasOwnProperty = (o, p) =>
|
||||||
|
Object.prototype.hasOwnProperty.call(o, p);
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
vAPI.app = {
|
vAPI.app = {
|
||||||
@ -191,9 +190,9 @@ vAPI.browserSettings = (( ) => {
|
|||||||
|
|
||||||
set: function(details) {
|
set: function(details) {
|
||||||
for ( const setting in details ) {
|
for ( const setting in details ) {
|
||||||
if ( details.hasOwnProperty(setting) === false ) { continue; }
|
if ( hasOwnProperty(details, setting) === false ) { continue; }
|
||||||
switch ( setting ) {
|
switch ( setting ) {
|
||||||
case 'prefetching':
|
case 'prefetching': {
|
||||||
const enabled = !!details[setting];
|
const enabled = !!details[setting];
|
||||||
if ( enabled ) {
|
if ( enabled ) {
|
||||||
bp.network.networkPredictionEnabled.clear({
|
bp.network.networkPredictionEnabled.clear({
|
||||||
@ -209,9 +208,9 @@ vAPI.browserSettings = (( ) => {
|
|||||||
vAPI.prefetching(enabled);
|
vAPI.prefetching(enabled);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'hyperlinkAuditing':
|
case 'hyperlinkAuditing': {
|
||||||
if ( !!details[setting] ) {
|
if ( details[setting] ) {
|
||||||
bp.websites.hyperlinkAuditingEnabled.clear({
|
bp.websites.hyperlinkAuditingEnabled.clear({
|
||||||
scope: 'regular',
|
scope: 'regular',
|
||||||
});
|
});
|
||||||
@ -222,7 +221,7 @@ vAPI.browserSettings = (( ) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'webrtcIPAddress': {
|
case 'webrtcIPAddress': {
|
||||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/1928
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/1928
|
||||||
// https://www.reddit.com/r/uBlockOrigin/comments/sl7p74/
|
// https://www.reddit.com/r/uBlockOrigin/comments/sl7p74/
|
||||||
@ -314,7 +313,7 @@ vAPI.Tabs = class {
|
|||||||
}
|
}
|
||||||
this.onRemovedHandler(tabId, details);
|
this.onRemovedHandler(tabId, details);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async executeScript(...args) {
|
async executeScript(...args) {
|
||||||
let result;
|
let result;
|
||||||
@ -869,8 +868,8 @@ if ( webext.browserAction instanceof Object ) {
|
|||||||
const hasUnprocessedRequest = vAPI.net && vAPI.net.hasUnprocessedRequest(tabId);
|
const hasUnprocessedRequest = vAPI.net && vAPI.net.hasUnprocessedRequest(tabId);
|
||||||
const { parts, state } = details;
|
const { parts, state } = details;
|
||||||
const { badge, color } = hasUnprocessedRequest
|
const { badge, color } = hasUnprocessedRequest
|
||||||
? { badge: '!', color: '#FC0' }
|
? { badge: '!', color: '#FC0' }
|
||||||
: details;
|
: details;
|
||||||
|
|
||||||
if ( browserAction.setIcon !== undefined ) {
|
if ( browserAction.setIcon !== undefined ) {
|
||||||
if ( parts === undefined || (parts & 0b0001) !== 0 ) {
|
if ( parts === undefined || (parts & 0b0001) !== 0 ) {
|
||||||
@ -1029,7 +1028,7 @@ vAPI.messaging = {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'userCSS':
|
case 'userCSS': {
|
||||||
if ( tabId === undefined ) { break; }
|
if ( tabId === undefined ) { break; }
|
||||||
const promises = [];
|
const promises = [];
|
||||||
if ( msg.add ) {
|
if ( msg.add ) {
|
||||||
@ -1060,6 +1059,9 @@ vAPI.messaging = {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Use a wrapper to avoid closure and to allow reuse.
|
// Use a wrapper to avoid closure and to allow reuse.
|
||||||
@ -1217,7 +1219,7 @@ vAPI.Net = class {
|
|||||||
{
|
{
|
||||||
const wrrt = browser.webRequest.ResourceType;
|
const wrrt = browser.webRequest.ResourceType;
|
||||||
for ( const typeKey in wrrt ) {
|
for ( const typeKey in wrrt ) {
|
||||||
if ( wrrt.hasOwnProperty(typeKey) ) {
|
if ( hasOwnProperty(wrrt, typeKey) ) {
|
||||||
this.validTypes.add(wrrt[typeKey]);
|
this.validTypes.add(wrrt[typeKey]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1520,10 +1522,7 @@ vAPI.localStorage = {
|
|||||||
if ( this.cache instanceof Promise ) { return this.cache; }
|
if ( this.cache instanceof Promise ) { return this.cache; }
|
||||||
if ( this.cache instanceof Object ) { return this.cache; }
|
if ( this.cache instanceof Object ) { return this.cache; }
|
||||||
this.cache = vAPI.storage.get('localStorage').then(bin => {
|
this.cache = vAPI.storage.get('localStorage').then(bin => {
|
||||||
this.cache = bin instanceof Object &&
|
this.cache = bin && bin.localStorage || {};
|
||||||
bin.localStorage instanceof Object
|
|
||||||
? bin.localStorage
|
|
||||||
: {};
|
|
||||||
});
|
});
|
||||||
return this.cache;
|
return this.cache;
|
||||||
},
|
},
|
||||||
|
@ -22,19 +22,14 @@
|
|||||||
|
|
||||||
// For background page or non-background pages
|
// For background page or non-background pages
|
||||||
|
|
||||||
/* global browser */
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
vAPI.T0 = Date.now();
|
vAPI.T0 = Date.now();
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
vAPI.setTimeout = vAPI.setTimeout || self.setTimeout.bind(self);
|
vAPI.setTimeout = vAPI.setTimeout || self.setTimeout.bind(self);
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
vAPI.defer = {
|
vAPI.defer = {
|
||||||
create(callback) {
|
create(callback) {
|
||||||
return new this.Client(callback);
|
return new this.Client(callback);
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
Home: https://github.com/gorhill/uBlock
|
Home: https://github.com/gorhill/uBlock
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/* global HTMLDocument, XMLDocument */
|
|
||||||
|
|
||||||
// For background page, auxiliary pages, and content scripts.
|
// For background page, auxiliary pages, and content scripts.
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user