-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fallback to storage.local when IndexedDB is corrupted #1865
Conversation
f489c7f
to
75f4cf5
Compare
@GRadziejewski Testing highlights after technical review: Chromium-based browsers and Safari should not be affected by any of the changes - it should work exactly as before - you can check if engines are loaded correctly (cosmetics). On Firefox it should be exactly the same as above for default browser settings. However, if user disables history or creates a global private mode, without the change engines are loaded from disk each time background process starts. We can test both cases, but testing the latter is very difficult - loading unpacked extension in "no-history" mode fails (it is some internal Firefox bug) - you must use Firefox Nightly, set |
@GRadziejewski There is technical approval. If possible, please test out the PR. There is a tip on how to test it faster, the extension can be installed form source, but you must enable it in private windows to make it work (then restart the extension). |
Smoke tests Iteration no 1:Tests of: #1865 (comment) Checked features:
Issues:Fixed:Cannot reproduce:Will not be fixed: |
Relates to #1837
Fixes the issue for engines with corrupted IndexedDB in Firefox when history is globally disabled or private browsing is turned on globally.
It adds a fallback for the eninges to be stored in
chrome.storage.local
. As Firefox supports saving UnitArrays, the implementation is stratgh forward.I tried few different approaches, but I think only two may apply - hardcoded fallback for Firefox for all users, or use "in-time" detection for each engine.
The first solution makes Firefox again a different, which I would like to avoid - we should keep the code the same as much as possible. Also, only a small group of users are affected by the Firefox bug.
The detection outside of the function and using a flag is hazardous. As the IndexedDB error message comes in asynchronius way, we cannot avoid a race condition, so the
loadFromStorage
function might be called before we set the flag.The last argument is about how the
getDB()
already works. It saves the opened session to the database ingetDB.current
- as this is done only once, for the each access to the database, after it's once rejected, it rejects immeditelly.