Skip to content

fix(ext/web): upgrade QuotaExceededError to DOMException derived interface#32244

Merged
bartlomieju merged 2 commits intodenoland:mainfrom
veeceey:fix/issue-30028-quota-exceeded-error
Mar 17, 2026
Merged

fix(ext/web): upgrade QuotaExceededError to DOMException derived interface#32244
bartlomieju merged 2 commits intodenoland:mainfrom
veeceey:fix/issue-30028-quota-exceeded-error

Conversation

@veeceey
Copy link
Copy Markdown
Contributor

@veeceey veeceey commented Feb 20, 2026

Summary

Implements the WebIDL spec change (whatwg/webidl#1465) that upgrades QuotaExceededError from a DOMException error name to a proper derived class extending DOMException.

  • Removed "QuotaExceededError" from the DOMException error names table, so new DOMException("msg", "QuotaExceededError").code === 0
  • Added QuotaExceededError class extending DOMException with legacy code 22 and optional quota and requested properties (both default to null)
  • Exposed QuotaExceededError on the global scope
  • Updated the error builder so Rust-thrown DOMExceptionQuotaExceededError errors now create proper QuotaExceededError instances
  • Added TypeScript definitions for QuotaExceededError and QuotaExceededErrorOptions

Compatibility

The following patterns continue to work:

  • err instanceof DOMException (still true)
  • err.name === "QuotaExceededError" (still true)
  • err.code === 22 (still true)
  • DOMException.QUOTA_EXCEEDED_ERR === 22 (still true)
  • err instanceof QuotaExceededError (now true)
  • err.constructor === QuotaExceededError (now true)

The following pattern changes behavior:

  • new DOMException("msg", "QuotaExceededError").code is now 0 instead of 22

Closes #30028

Test plan

  • Added unit tests in tests/unit/dom_exception_test.ts covering:
    • QuotaExceededError basic construction and instanceof checks
    • quota and requested properties with various option combinations
    • Negative values for quota/requested throw RangeError
    • Legacy code constant DOMException.QUOTA_EXCEEDED_ERR === 22
    • new DOMException("msg", "QuotaExceededError").code === 0
    • Constructor name and stack trace validation

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 20, 2026

CLA assistant check
All committers have signed the CLA.

@veeceey veeceey force-pushed the fix/issue-30028-quota-exceeded-error branch 2 times, most recently from 978cad4 to 29c62fd Compare February 23, 2026 02:38
@veeceey
Copy link
Copy Markdown
Contributor Author

veeceey commented Mar 10, 2026

any chance someone could take a look at this? happy to make adjustments if something needs work

@crowlKats crowlKats self-requested a review March 10, 2026 13:13
@veeceey veeceey force-pushed the fix/issue-30028-quota-exceeded-error branch from e47e5e5 to 0f73c6e Compare March 12, 2026 01:27
Copy link
Copy Markdown
Contributor

@kajukitli kajukitli left a comment

Choose a reason for hiding this comment

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

this looks like the right direction, but there's one concrete problem in the tests: domExceptionQuotaExceededErrorCode is asserting the old behavior.

right now the PR summary says this change implements the WebIDL update where QuotaExceededError is no longer a legacy DOMException name, so:

new DOMException("msg", "QuotaExceededError").code === 0

but the test currently checks for 22:

const e = new DOMException("test", "QuotaExceededError");
assertEquals(e.code, 22);

that test should be flipped to 0, otherwise it's validating the pre-change behavior and contradicting both the spec change and the PR description.

on CI: the visible failures don't look caused by this PR. the macOS spec failure is the usual release download issue (deno-aarch64-apple-darwin.zip missing for v2.7.5), and the WPT job is just expectation drift output, not something obviously tied to QuotaExceededError.

@veeceey veeceey force-pushed the fix/issue-30028-quota-exceeded-error branch from 0f73c6e to 9aaa9fc Compare March 15, 2026 03:10
@bartlomieju bartlomieju changed the title feat(web): upgrade QuotaExceededError to DOMException derived interface fix(ext/web): upgrade QuotaExceededError to DOMException derived interface Mar 15, 2026
The WPT test harness (pinned version) checks `e.constructor === DOMException`
in assert_throws_dom(), which fails now that QuotaExceededError is a derived
class. Update expectations:

- webstorage: mark quota exceeded tests as expected failures
- WebCryptoAPI: mark getRandomValues "Large length" subtests as expected
  failures (they throw QuotaExceededError)
- fetch: fix pre-existing expected failure ordering drift

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

Update QuotaExceededError handling

4 participants