Skip to content

IDBFactory.deleteDatabase(): result is undefined, not null - #45719

Merged
wbamberg merged 1 commit into
mdn:mainfrom
RizgarOzan:idbfactory-deletedatabase-result
Sep 15, 2026
Merged

wbamberg merged 1 commit into
mdn:mainfrom
RizgarOzan:idbfactory-deletedatabase-result

Conversation

@RizgarOzan

Copy link
Copy Markdown
Contributor

Description

Fixes the result value documented on the IDBFactory.deleteDatabase() page:

  • The "Return value" section said the request's result is null after a successful deletion. It is undefined. The page's own "Description" section already says undefined, so the page contradicted itself.
  • The example logged event.result. The success event here is an IDBVersionChangeEvent, which has no result property, so the line printed undefined for the wrong reason. It now logs dbDeleteRequest.result.

Motivation

The spec sets the result to undefined. IndexedDB 3.0, §4.3 The IDBFactory interface, deleteDatabase(name) steps:

Otherwise, set request's result to undefined, set request's done flag to true, and fire a version change event named success at request with result and null.

All three engines do the same:

How I tested

I wrote a test page that opens a database (version 3), closes it, deletes it, and then deletes a database that doesn't exist. In each success handler it logs the request's result. Output in Edge 153 (Chromium, headless):

existing db: event type = success
existing db: event constructor = IDBVersionChangeEvent
existing db: request.result = undefined (typeof undefined)
existing db: event.target.result = undefined (typeof undefined)
existing db: 'result' in event = false
existing db: event.oldVersion = 3, event.newVersion = null
missing db: request.result = undefined (typeof undefined)
missing db: event.oldVersion = 0, event.newVersion = null

markdownlint-cli2, prettier --check, and cspell (with .vscode/cspell.json) all pass on the changed file.

Related issues and pull requests

The page's other gaps (the blocked state) were covered in #44350 for #42779.

@RizgarOzan
RizgarOzan requested a review from a team as a code owner September 15, 2026 13:42
@RizgarOzan
RizgarOzan requested review from wbamberg and removed request for a team September 15, 2026 13:42
@github-actions github-actions Bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Sep 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview URLs (1 page)

@wbamberg

wbamberg commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Interesting, it looks like the non-normative bit of the spec is wrong:

Attempts to delete the named database. If the database already exists and there are open connections that don’t close in response to a versionchange event, the request will be blocked until they all close. If the request is successful request’s result will be null.

@wbamberg wbamberg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thank you!

@wbamberg
wbamberg merged commit 4c947bd into mdn:main Sep 15, 2026
8 checks passed
@RizgarOzan

Copy link
Copy Markdown
Contributor Author

Yes, that sentence is from the "For web developers" box (<div class="domintro note"> in the source), which is non-normative. The method steps themselves say "set request's result to undefined" and have since w3c/IndexedDB#202 (2017), and engines follow the steps. I filed w3c/IndexedDB#507 to get the note fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants