From 03596439caf28c09f11ff3a710637e90682ddae3 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 10 Oct 2020 14:18:19 -0400 Subject: [PATCH] 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 --- platform/chromium/vapi-background.js | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 2f47248bb..569dd9e5a 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -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; },