mirror of https://github.com/gorhill/uBlock.git
Remove obsolete code to import content of localStorage
Months ago, usage of synchronous localStorage was replaced with asynchronous extension storage. There was code for the conversion to be seamless by importing the content of now obsolete localStorage. This code is no longer needed as majority of users are assumed to use versions of uBO above 1.25.0. Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/899
This commit is contained in:
parent
7b2a64db2b
commit
03596439ca
|
@ -1435,27 +1435,10 @@ vAPI.localStorage = {
|
|||
if ( this.cache instanceof Promise ) { return this.cache; }
|
||||
if ( this.cache instanceof Object ) { return this.cache; }
|
||||
this.cache = webext.storage.local.get('localStorage').then(bin => {
|
||||
this.cache = undefined;
|
||||
try {
|
||||
if (
|
||||
bin instanceof Object === false ||
|
||||
bin.localStorage instanceof Object === false
|
||||
) {
|
||||
this.cache = {};
|
||||
const ls = self.localStorage;
|
||||
for ( let i = 0; i < ls.length; i++ ) {
|
||||
const key = ls.key(i);
|
||||
this.cache[key] = ls.getItem(key);
|
||||
}
|
||||
webext.storage.local.set({ localStorage: this.cache });
|
||||
} else {
|
||||
this.cache = bin.localStorage;
|
||||
}
|
||||
} catch(ex) {
|
||||
}
|
||||
if ( this.cache instanceof Object === false ) {
|
||||
this.cache = {};
|
||||
}
|
||||
this.cache = bin instanceof Object &&
|
||||
bin.localStorage instanceof Object
|
||||
? bin.localStorage
|
||||
: {};
|
||||
});
|
||||
return this.cache;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue