@@ -99,7 +99,7 @@ class MainBackground {
9999 constructor() {
100100
101101 this.messagingService = new BrowserMessagingService();
102− this.storageService = new BrowserStorageService();
102+ this.storageService = new MemoryStorageService();
103103 this.logService = new ConsoleLogService(false);
104104 this.stateMigrationService = new StateMigrationService(
105105 this.storageService,
@@ -172,34 +172,28 @@ class MainBackground {
172172 }
173173}
174174
175−
176−class BrowserStorageService {
177− storage;
178−
179− constructor() {
180− this.storage = window.localStorage;
181− }
175+class MemoryStorageService {
176+ storage = {};
182177
183178 async get(key) {
184− return JSON.parse(this.storage.getItem(key))
179+ return this.storage[key]
185180 }
186181
187182 async has(key) {
188− return this.storage.getItem(key) != null;
183+ return key in this.storage;
189184 }
190185
191186 async save(key, obj) {
192187 if (obj == null) {
193− // Fix safari not liking null in set
194− this.storage.removeItem(key)
188+ this.remove(key)
195189 return
196190 }
197191
198− this.storage.setItem(key, JSON.stringify(obj));
192+ this.storage[key] = obj
199193 }
200194
201195 async remove(key) {
202− this.storage.removeItem(key)
196+ delete this.storage[key]
203197 }
204198}
205199