Skip to content

Commit 4533f0e

Browse files
committed
Fix eslint warnings
1 parent 8dc0e88 commit 4533f0e

File tree

2 files changed

+281
-276
lines changed

2 files changed

+281
-276
lines changed

src/js/cachestorage.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* global indexedDB */
23-
24-
'use strict';
25-
2622
/******************************************************************************/
2723

24+
import * as s14e from './s14e-serializer.js';
25+
2826
import lz4Codec from './lz4.js';
27+
import { ubolog } from './console.js';
2928
import webext from './webext.js';
3029
import µb from './background.js';
31-
import { ubolog } from './console.js';
32-
import * as s14e from './s14e-serializer.js';
3330

3431
/******************************************************************************/
3532

@@ -47,6 +44,10 @@ const keysFromGetArg = arg => {
4744

4845
let fastCache = 'indexedDB';
4946

47+
// https://eslint.org/docs/latest/rules/no-prototype-builtins
48+
const hasOwnProperty = (o, p) =>
49+
Object.prototype.hasOwnProperty.call(o, p);
50+
5051
/*******************************************************************************
5152
*
5253
* Extension storage
@@ -65,7 +66,7 @@ const cacheStorage = (( ) => {
6566
if ( found.length === wanted.length ) { return; }
6667
const missing = [];
6768
for ( const key of wanted ) {
68-
if ( outbin.hasOwnProperty(key) ) { continue; }
69+
if ( hasOwnProperty(outbin, key) ) { continue; }
6970
missing.push(key);
7071
}
7172
return missing;
@@ -107,7 +108,7 @@ const cacheStorage = (( ) => {
107108
if ( argbin instanceof Object === false ) { return; }
108109
if ( Array.isArray(argbin) ) { return; }
109110
for ( const key of wanted ) {
110-
if ( argbin.hasOwnProperty(key) === false ) { continue; }
111+
if ( hasOwnProperty(argbin, key) === false ) { continue; }
111112
outbin[key] = argbin[key];
112113
}
113114
}).then(( ) => {
@@ -165,7 +166,7 @@ const cacheStorage = (( ) => {
165166
},
166167

167168
select(api) {
168-
if ( cacheAPIs.hasOwnProperty(api) === false ) { return fastCache; }
169+
if ( hasOwnProperty(cacheAPIs, api) === false ) { return fastCache; }
169170
fastCache = api;
170171
for ( const k of Object.keys(cacheAPIs) ) {
171172
if ( k === api ) { continue; }
@@ -591,7 +592,7 @@ const idbStorage = (( ) => {
591592
const transaction = db.transaction(STORAGE_NAME, 'readonly');
592593
transaction.oncomplete =
593594
transaction.onerror =
594-
transaction.onabort = ( ) => {
595+
transaction.onabort = ( ) => {
595596
resolve(Promise.all(entries));
596597
};
597598
const table = transaction.objectStore(STORAGE_NAME);
@@ -673,7 +674,7 @@ const idbStorage = (( ) => {
673674
}
674675
if ( argbin instanceof Object && Array.isArray(argbin) === false ) {
675676
for ( const key of keys ) {
676-
if ( outbin.hasOwnProperty(key) ) { continue; }
677+
if ( hasOwnProperty(outbin, key) ) { continue; }
677678
outbin[key] = argbin[key];
678679
}
679680
}
@@ -695,7 +696,7 @@ const idbStorage = (( ) => {
695696
},
696697

697698
clear() {
698-
return getDb().then(db => {
699+
return getDb().then(db => {
699700
if ( db === null ) { return; }
700701
db.close();
701702
indexedDB.deleteDatabase(STORAGE_NAME);

0 commit comments

Comments
 (0)