fix(ext/web): upgrade QuotaExceededError to DOMException derived interface#32244
Conversation
978cad4 to
29c62fd
Compare
|
any chance someone could take a look at this? happy to make adjustments if something needs work |
e47e5e5 to
0f73c6e
Compare
kajukitli
left a comment
There was a problem hiding this comment.
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 === 0but 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.
0f73c6e to
9aaa9fc
Compare
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>
Summary
Implements the WebIDL spec change (whatwg/webidl#1465) that upgrades
QuotaExceededErrorfrom aDOMExceptionerror name to a proper derived class extendingDOMException."QuotaExceededError"from the DOMException error names table, sonew DOMException("msg", "QuotaExceededError").code === 0QuotaExceededErrorclass extendingDOMExceptionwith legacy code 22 and optionalquotaandrequestedproperties (both default tonull)QuotaExceededErroron the global scopeDOMExceptionQuotaExceededErrorerrors now create properQuotaExceededErrorinstancesQuotaExceededErrorandQuotaExceededErrorOptionsCompatibility
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").codeis now0instead of22Closes #30028
Test plan
tests/unit/dom_exception_test.tscovering:QuotaExceededErrorbasic construction and instanceof checksquotaandrequestedproperties with various option combinationsquota/requestedthrowRangeErrorDOMException.QUOTA_EXCEEDED_ERR === 22new DOMException("msg", "QuotaExceededError").code === 0