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

IndexedDB needs valid to be called asynchronously #189

Open
mikeknoop opened this issue Dec 2, 2013 · 2 comments
Open

IndexedDB needs valid to be called asynchronously #189

mikeknoop opened this issue Dec 2, 2013 · 2 comments

Comments

@mikeknoop
Copy link

I'm curious to get your guys feedback. In Firefox 22, 25 if the user has the privacy option "remember history" set to "never remember history" then IndexedDB will throw a "InvalidStateError" when trying to call open on window.indexedDB.

screen

It's an asynchronous exception that can't be caught using try ... catch. The only reasonable way to test if the IndexedDB adapter is valid is by trying to open the DB which is an async process.

The problem is that the Lawnchair valid API is synchronous. (It's built into the Lawnchair constructor which I guess is why it is async).

The only proper option I see to fix this is refactor the Lawnchair API such that the valid method is called asynchronously.

BTW this bug has the nasty side-effect of causing the IndexedDB adapter to infinite-error-loop between:

https://github.com/brianleroux/lawnchair/blob/master/src/adapters/indexed-db.js#L54
and
https://github.com/brianleroux/lawnchair/blob/master/src/adapters/indexed-db.js#L122-L126

I'm planning to patch the infinite-loop locally and just not use Lawnchair if this scenario arises but it's certainly not-ideal. Lawnchair should fall back to a different adapter if one isn't available.

@mikeknoop
Copy link
Author

Here is my fully implemented (hacky) workaround for now: https://gist.github.com/mikeknoop/7749020

@felixhammerl
Copy link

the bug you're seeing occurs when you're trying to fire up an indexed db when you set firefox to private mode or set it to not remember the history. please check if this helps: #207

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

2 participants