Fix #231 - Broken filter storage in Firefox private mode
Add a facade impl which switches between the underlying impls (idb vs browser.storage.local
impl).
Both io.js
and prefs.js
have the same design - they export a Proxy object that forwards the calls to the wrapped impl (either ..-idb.js
or ..-storage.js
) that can be changed in time eg. depending on the availability.
Thus we need to switch to the right impl before it's actually used - it's important.
They are instantiated instantly to avoid anybody from importing undefined
instance.
Thus we have:
await startAsyncModule(() => initializer.start());
synchronizer.start();
initializer must be awaited before any Prefs value might be actually needed.
I haven't find a way to switch a target
if using a typical Proxy
and i found that it's intentionally.
See in io.js
file IO
has almost copy-pasted code forwarding to wrapped impl
- can we improve that?
Also i've tested it manually and i'm not sure how we an simulate idb
connection failure in the test.
Any suggestion appreciated! In order to deliver the MR faster i propose to have a separate ticket for testing this.
Closes #231 (closed)