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
8dc0e885b5
commit
4533f0e37e
@ -19,17 +19,14 @@
|
||||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
/* global indexedDB */
|
||||
|
||||
'use strict';
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
import * as s14e from './s14e-serializer.js';
|
||||
|
||||
import lz4Codec from './lz4.js';
|
||||
import { ubolog } from './console.js';
|
||||
import webext from './webext.js';
|
||||
import µb from './background.js';
|
||||
import { ubolog } from './console.js';
|
||||
import * as s14e from './s14e-serializer.js';
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
@ -47,6 +44,10 @@ const keysFromGetArg = arg => {
|
||||
|
||||
let fastCache = 'indexedDB';
|
||||
|
||||
// https://eslint.org/docs/latest/rules/no-prototype-builtins
|
||||
const hasOwnProperty = (o, p) =>
|
||||
Object.prototype.hasOwnProperty.call(o, p);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Extension storage
|
||||
@ -65,7 +66,7 @@ const cacheStorage = (( ) => {
|
||||
if ( found.length === wanted.length ) { return; }
|
||||
const missing = [];
|
||||
for ( const key of wanted ) {
|
||||
if ( outbin.hasOwnProperty(key) ) { continue; }
|
||||
if ( hasOwnProperty(outbin, key) ) { continue; }
|
||||
missing.push(key);
|
||||
}
|
||||
return missing;
|
||||
@ -107,7 +108,7 @@ const cacheStorage = (( ) => {
|
||||
if ( argbin instanceof Object === false ) { return; }
|
||||
if ( Array.isArray(argbin) ) { return; }
|
||||
for ( const key of wanted ) {
|
||||
if ( argbin.hasOwnProperty(key) === false ) { continue; }
|
||||
if ( hasOwnProperty(argbin, key) === false ) { continue; }
|
||||
outbin[key] = argbin[key];
|
||||
}
|
||||
}).then(( ) => {
|
||||
@ -165,7 +166,7 @@ const cacheStorage = (( ) => {
|
||||
},
|
||||
|
||||
select(api) {
|
||||
if ( cacheAPIs.hasOwnProperty(api) === false ) { return fastCache; }
|
||||
if ( hasOwnProperty(cacheAPIs, api) === false ) { return fastCache; }
|
||||
fastCache = api;
|
||||
for ( const k of Object.keys(cacheAPIs) ) {
|
||||
if ( k === api ) { continue; }
|
||||
@ -673,7 +674,7 @@ const idbStorage = (( ) => {
|
||||
}
|
||||
if ( argbin instanceof Object && Array.isArray(argbin) === false ) {
|
||||
for ( const key of keys ) {
|
||||
if ( outbin.hasOwnProperty(key) ) { continue; }
|
||||
if ( hasOwnProperty(outbin, key) ) { continue; }
|
||||
outbin[key] = argbin[key];
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,6 @@
|
||||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Structured-Cloneable to Unicode-Only SERIALIZER
|
||||
@ -287,6 +285,9 @@ const shouldCompress = (s, options) =>
|
||||
options.compressThreshold <= s.length
|
||||
);
|
||||
|
||||
const hasOwnProperty = (o, p) =>
|
||||
Object.prototype.hasOwnProperty.call(o, p);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* A large Uint is always a positive integer (can be zero), assumed to be
|
||||
@ -1128,7 +1129,7 @@ export const getConfig = ( ) => Object.assign({}, currentConfig);
|
||||
|
||||
export const setConfig = config => {
|
||||
for ( const key in Object.keys(config) ) {
|
||||
if ( defaultConfig.hasOwnProperty(key) === false ) { continue; }
|
||||
if ( hasOwnProperty(defaultConfig, key) === false ) { continue; }
|
||||
const val = config[key];
|
||||
if ( typeof val !== typeof defaultConfig[key] ) { continue; }
|
||||
if ( (validateConfig[key])(val) === false ) { continue; }
|
||||
@ -1389,15 +1390,18 @@ if ( isInstanceOf(globalThis, 'DedicatedWorkerGlobalScope') ) {
|
||||
setConfig(msg.config);
|
||||
globalThis.postMessage({ what: THREAD_IAMREADY });
|
||||
break;
|
||||
case THREAD_SERIALIZE:
|
||||
case THREAD_SERIALIZE: {
|
||||
const result = serialize(msg.data, msg.options);
|
||||
globalThis.postMessage({ id: msg.id, size: msg.size, result });
|
||||
break;
|
||||
}
|
||||
case THREAD_DESERIALIZE: {
|
||||
const result = deserialize(msg.data);
|
||||
globalThis.postMessage({ id: msg.id, size: msg.size, result });
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user