Fix eslint warnings

This commit is contained in:
Raymond Hill 2024-04-08 09:24:40 -04:00
parent 7d321c0a11
commit e8ab556411
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -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; }
@ -591,7 +592,7 @@ const idbStorage = (( ) => {
const transaction = db.transaction(STORAGE_NAME, 'readonly');
transaction.oncomplete =
transaction.onerror =
transaction.onabort = ( ) => {
transaction.onabort = ( ) => {
resolve(Promise.all(entries));
};
const table = transaction.objectStore(STORAGE_NAME);
@ -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];
}
}
@ -695,7 +696,7 @@ const idbStorage = (( ) => {
},
clear() {
return getDb().then(db => {
return getDb().then(db => {
if ( db === null ) { return; }
db.close();
indexedDB.deleteDatabase(STORAGE_NAME);