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

deleteDatabase's "versionchange" should be deferred if upgrade is running #78

Closed
inexorabletash opened this issue Jun 22, 2016 · 1 comment
Labels

Comments

@inexorabletash
Copy link
Member

The "steps for opening a database" ensure that if an upgrade transaction is running that a subsequent open request with a higher version is "deferred" until the previous request is completed. And it should not be necessary to assign a "versionchange" handler in your "upgradeneeded" handler.

For example, the following should work:

indexedDB.open('db', 1).onsuccess = e => {
  let db = e.target.result;
  db.onversionchange = e => db.close(); // Get out of the way.
};
indexedDB.open('db', 2).onblocked = e => alert('should not happen!');

It's reasonable to expect the same thing for deletes:

indexedDB.open('db', 1).onsuccess = e => {
  let db = e.target.result;
  db.onversionchange = e => db.close(); // Get out of the way.
};
indexedDB.deleteDatabase('db').onblocked = e => alert('should not happen!');

... but the spec does not require that. Firefox behaves as expected. Chrome does not but we're fixing to match Firefox.

We should add a clause to the "steps for deleting a database" to wait for running upgrades.

inexorabletash added a commit that referenced this issue Jul 15, 2016
Also:
* Remove 'delete pending' flag which is not longer needed.
* Simplify some section names.
* Move the versionchange/blocked logic from upgrade steps to
  open steps, for symmetry with delete steps.
* Rename 'Authorization' section to 'Security Concerns'
@inexorabletash
Copy link
Member Author

Should be resolved by d1147cb - take a peek?

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

No branches or pull requests

1 participant