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:
Raymond Hill 2020-10-10 14:18:19 -04:00
parent 7b2a64db2b
commit 03596439ca
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 4 additions and 21 deletions

View File

@ -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;
},