19
19
Home: https://github.com/gorhill/uBlock
20
20
*/
21
21
22
- /* global indexedDB */
23
-
24
- 'use strict' ;
25
-
26
22
/******************************************************************************/
27
23
24
+ import * as s14e from './s14e-serializer.js' ;
25
+
28
26
import lz4Codec from './lz4.js' ;
27
+ import { ubolog } from './console.js' ;
29
28
import webext from './webext.js' ;
30
29
import µb from './background.js' ;
31
- import { ubolog } from './console.js' ;
32
- import * as s14e from './s14e-serializer.js' ;
33
30
34
31
/******************************************************************************/
35
32
@@ -47,6 +44,10 @@ const keysFromGetArg = arg => {
47
44
48
45
let fastCache = 'indexedDB' ;
49
46
47
+ // https://eslint.org/docs/latest/rules/no-prototype-builtins
48
+ const hasOwnProperty = ( o , p ) =>
49
+ Object . prototype . hasOwnProperty . call ( o , p ) ;
50
+
50
51
/*******************************************************************************
51
52
*
52
53
* Extension storage
@@ -65,7 +66,7 @@ const cacheStorage = (( ) => {
65
66
if ( found . length === wanted . length ) { return ; }
66
67
const missing = [ ] ;
67
68
for ( const key of wanted ) {
68
- if ( outbin . hasOwnProperty ( key ) ) { continue ; }
69
+ if ( hasOwnProperty ( outbin , key ) ) { continue ; }
69
70
missing . push ( key ) ;
70
71
}
71
72
return missing ;
@@ -107,7 +108,7 @@ const cacheStorage = (( ) => {
107
108
if ( argbin instanceof Object === false ) { return ; }
108
109
if ( Array . isArray ( argbin ) ) { return ; }
109
110
for ( const key of wanted ) {
110
- if ( argbin . hasOwnProperty ( key ) === false ) { continue ; }
111
+ if ( hasOwnProperty ( argbin , key ) === false ) { continue ; }
111
112
outbin [ key ] = argbin [ key ] ;
112
113
}
113
114
} ) . then ( ( ) => {
@@ -165,7 +166,7 @@ const cacheStorage = (( ) => {
165
166
} ,
166
167
167
168
select ( api ) {
168
- if ( cacheAPIs . hasOwnProperty ( api ) === false ) { return fastCache ; }
169
+ if ( hasOwnProperty ( cacheAPIs , api ) === false ) { return fastCache ; }
169
170
fastCache = api ;
170
171
for ( const k of Object . keys ( cacheAPIs ) ) {
171
172
if ( k === api ) { continue ; }
@@ -591,7 +592,7 @@ const idbStorage = (( ) => {
591
592
const transaction = db . transaction ( STORAGE_NAME , 'readonly' ) ;
592
593
transaction . oncomplete =
593
594
transaction . onerror =
594
- transaction . onabort = ( ) => {
595
+ transaction . onabort = ( ) => {
595
596
resolve ( Promise . all ( entries ) ) ;
596
597
} ;
597
598
const table = transaction . objectStore ( STORAGE_NAME ) ;
@@ -673,7 +674,7 @@ const idbStorage = (( ) => {
673
674
}
674
675
if ( argbin instanceof Object && Array . isArray ( argbin ) === false ) {
675
676
for ( const key of keys ) {
676
- if ( outbin . hasOwnProperty ( key ) ) { continue ; }
677
+ if ( hasOwnProperty ( outbin , key ) ) { continue ; }
677
678
outbin [ key ] = argbin [ key ] ;
678
679
}
679
680
}
@@ -695,7 +696,7 @@ const idbStorage = (( ) => {
695
696
} ,
696
697
697
698
clear ( ) {
698
- return getDb ( ) . then ( db => {
699
+ return getDb ( ) . then ( db => {
699
700
if ( db === null ) { return ; }
700
701
db . close ( ) ;
701
702
indexedDB . deleteDatabase ( STORAGE_NAME ) ;
0 commit comments