Skip to content

Commit

Permalink
Fix eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Apr 3, 2024
1 parent 8dc0e88 commit 4533f0e
Show file tree
Hide file tree
Showing 2 changed files with 281 additions and 276 deletions.
25 changes: 13 additions & 12 deletions src/js/cachestorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/******************************************************************************/

Expand All @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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(( ) => {
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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];
}
}
Expand All @@ -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);
Expand Down
Loading

0 comments on commit 4533f0e

Please sign in to comment.