Repository navigation
Conversation
The `versionchange` event page only said the event was "requested elsewhere" and its examples just logged a message. It never said that the upgrade is blocked until every other connection closes, or that an open connection running an older schema is what makes running two versions of the page in separate tabs corrupt data. Add the multi-tab conflict explanation to the event page, covering `blocked` on the requesting tab and why the usual response is to close the connection and reload. Replace the two log-only examples with one showing `db.close()` in the handler and one showing `onblocked` on the requesting side. Also fix the `IDBDatabase` interface page's one-line `versionchange` description, which had the same "requested elsewhere" wording. Fixes mdn#26639
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Expands the
IDBDatabase: versionchangeevent page to explain why the event matters: an upgrade or deletion requested from another connection waits until every other connection is closed, closing the connection in theversionchangehandler is the usual way to let it proceed, and the requesting side gets ablockedevent while connections remain open. Replaces the examples with one that closes the connection inonversionchangeand one that handlesblockedon the requesting side. The one-line summary on theIDBDatabasepage now says the handler should close the database.Motivation
#26639 points out that the page barely explains
versionchange, even though not handling it leaves another tab's upgrade stuck.Additional details
Validation boundary: the behavior described follows the "open a database connection" / "delete a database" steps of the IndexedDB spec (fire
versionchangeat other connections, fireblockedif any remain open, wait for them to close) and the existing "Version changes while a web app is open in another tab" section, which the page now links to. I removed claims from an earlier draft about stale tabs silently corrupting data, because I could not source them. I did not run the examples in a browser or build the site locally.Related issues and pull requests
Fixes #26639
AI assistance disclosure: this change was prepared with the help of an AI coding agent (Grok Bot) and has not been reviewed line by line by the account owner.