Skip to content
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

Firefox "never remember history" disables IndexedDB #883

Open
alexelisenko opened this issue Aug 8, 2019 · 4 comments
Open

Firefox "never remember history" disables IndexedDB #883

alexelisenko opened this issue Aug 8, 2019 · 4 comments

Comments

@alexelisenko
Copy link

Hello,

The "never remember history" privacy setting in Firefox disabled IndexedDB, which causes Dexie to throw an uncaught Error. Is there anyway to create a browser.storage.local wrapper for dexie to handle this user environment?

@dfahlander
Copy link
Collaborator

This issue has been up before (years ago), and solved. Does Dexie methods return a rejected promise (expected behavior) or does the code never reach the app code after Dexie instanciation/declaration? Which version of Dexie is it?

@jbarzegar
Copy link

Hello 👋 working on this project with @alexelisenko. We're on Dexie v 2.0.4 (latest). Dexie is behaving as expected. The Promise rejects, with an error message of: InvalidStateError A mutation operation was attempted on a database that did not allow mutations.

@dfahlander
Copy link
Collaborator

Thanks @jbarzegar!

@alexelisenko: You might try using fakeIndexedDB as a fallback for users that have the privacy setting on so that Dexie could function as expected.

Something like this would do:

if(isBrowserPrivacyOn) {
  Dexie.dependencies.indexedDB = require('fake-indexeddb');
  Dexie.dependencies.IDBKeyRange = require('fake-indexeddb/lib/FDBKeyRange');
}

Don't know if you can detect the privacy setting easily. Might need to try opening dexie first and catch the rejected promise and then open a new db after having applied fakeIndexeddb.

Anyone who has tried this is very welcome to give some feedback here in this issue!

@jbarzegar
Copy link

Will take a look! Problem is we have to persist to disk since we're storing application state for our extension. If the process dies we don't want our users to log back in etc :( Either way @dfahlander I appreciate your help and thoughts on the matter.

I'll make sure to update everyone when we find a suitable solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants