Upgrade QuotaExceededError to a DOMException derived interface#1465
Upgrade QuotaExceededError to a DOMException derived interface#1465
Conversation
Closes #5. Closes #31 by obsoleting it. Depends on whatwg/webidl#1465.
Closes #5. Closes #31 by obsoleting it. Depends on whatwg/webidl#1465.
Closes #5. Obsoletes #31. Depends on whatwg/webidl#1465.
This change introduces a new QuotaExceededError class to update the existing QuotaExceededError so services can return `quota` and `requested` properties as needed. Implemented behind RuntimeEnabledFlag `QuotaExceededErrorUpdate`. Changes to update services throwing QuotaExceededError to use the new class will be made in following changes (except for IDB which triggered failures with this change). Proposal: whatwg/webidl#1465 Chromestatus: https://chromestatus.com/feature/6194847180128256 Bug: 406162261 Change-Id: I68e91e15724e64c0995365ee63d4abe627fe06d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516473 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Ayu Ishii <ayui@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joe Mason <joenotcharles@google.com> Cr-Commit-Position: refs/heads/main@{#1460403}
This change introduces a new QuotaExceededError class to update the existing QuotaExceededError so services can return `quota` and `requested` properties as needed. Implemented behind RuntimeEnabledFlag `QuotaExceededErrorUpdate`. Changes to update services throwing QuotaExceededError to use the new class will be made in following changes (except for IDB which triggered failures with this change). Proposal: whatwg/webidl#1465 Chromestatus: https://chromestatus.com/feature/6194847180128256 Bug: 406162261 Change-Id: I68e91e15724e64c0995365ee63d4abe627fe06d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516473 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Ayu Ishii <ayui@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joe Mason <joenotcharles@google.com> Cr-Commit-Position: refs/heads/main@{#1460403}
This change introduces a new QuotaExceededError class to update the existing QuotaExceededError so services can return `quota` and `requested` properties as needed. Implemented behind RuntimeEnabledFlag `QuotaExceededErrorUpdate`. Changes to update services throwing QuotaExceededError to use the new class will be made in following changes (except for IDB which triggered failures with this change). Proposal: whatwg/webidl#1465 Chromestatus: https://chromestatus.com/feature/6194847180128256 Bug: 406162261 Change-Id: I68e91e15724e64c0995365ee63d4abe627fe06d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516473 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Ayu Ishii <ayui@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joe Mason <joenotcharles@google.com> Cr-Commit-Position: refs/heads/main@{#1460403} Co-authored-by: Ayu Ishii <ayui@chromium.org>
This change updates services that use QuotaExceededError to use the new DOMException derived QuotaExceededError class when the flag is enabled. I've not been allowed to update external wpts until the webidl spec has been updated[0][1], so this change only updates tests for Chrome only wpts, and otherwise updates expectations for the external ones. External wpts will be updated when the webidl spec is merged and I am allowed to update the external wpts (as seen in chained CL). [0] Spec PR: whatwg/webidl#1465 [1] Discussion: web-platform-tests/wpt#52571 (comment) Bug: 406162261 Change-Id: Ie45d6095a3e4c21e21a35d2519d268580b8bc36b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6538066 Commit-Queue: Ayu Ishii <ayui@chromium.org> Reviewed-by: Daseul Lee <dslee@chromium.org> Cr-Commit-Position: refs/heads/main@{#1463139}
…tion derived interface, Automatic update from web-platform-tests QuotaExceededError: Update to a DOMException derived interface (#52556) This change introduces a new QuotaExceededError class to update the existing QuotaExceededError so services can return `quota` and `requested` properties as needed. Implemented behind RuntimeEnabledFlag `QuotaExceededErrorUpdate`. Changes to update services throwing QuotaExceededError to use the new class will be made in following changes (except for IDB which triggered failures with this change). Proposal: whatwg/webidl#1465 Chromestatus: https://chromestatus.com/feature/6194847180128256 Bug: 406162261 Change-Id: I68e91e15724e64c0995365ee63d4abe627fe06d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516473 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Ayu Ishii <ayui@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joe Mason <joenotcharles@google.com> Cr-Commit-Position: refs/heads/main@{#1460403} Co-authored-by: Ayu Ishii <ayui@chromium.org> -- wpt-commits: 16a71c4282b0379f639051c0a3f98f3fcdaa2149 wpt-pr: 52556 Differential Revision: https://phabricator.services.mozilla.com/D250632
…tion derived interface, Automatic update from web-platform-tests QuotaExceededError: Update to a DOMException derived interface (#52556) This change introduces a new QuotaExceededError class to update the existing QuotaExceededError so services can return `quota` and `requested` properties as needed. Implemented behind RuntimeEnabledFlag `QuotaExceededErrorUpdate`. Changes to update services throwing QuotaExceededError to use the new class will be made in following changes (except for IDB which triggered failures with this change). Proposal: whatwg/webidl#1465 Chromestatus: https://chromestatus.com/feature/6194847180128256 Bug: 406162261 Change-Id: I68e91e15724e64c0995365ee63d4abe627fe06d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516473 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Ayu Ishii <ayui@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joe Mason <joenotcharles@google.com> Cr-Commit-Position: refs/heads/main@{#1460403} Co-authored-by: Ayu Ishii <ayui@chromium.org> -- wpt-commits: 16a71c4282b0379f639051c0a3f98f3fcdaa2149 wpt-pr: 52556 Differential Revision: https://phabricator.services.mozilla.com/D250632
This info will be used for QuotaExceededError.requested and QuotaExceededError.quota in a follow-up CL. Spec: whatwg/webidl#1465 Bug: 416303646, 406162261 Change-Id: Id1d414722d2f53de0a566e8b453acdd97f501714 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6568411 Reviewed-by: Mike Wasserman <msw@chromium.org> Commit-Queue: Daseul Lee <dslee@chromium.org> Reviewed-by: Emily Stark <estark@chromium.org> Reviewed-by: Ayu Ishii <ayui@chromium.org> Cr-Commit-Position: refs/heads/main@{#1466096}
…tion derived interface, Automatic update from web-platform-tests QuotaExceededError: Update to a DOMException derived interface (#52556) This change introduces a new QuotaExceededError class to update the existing QuotaExceededError so services can return `quota` and `requested` properties as needed. Implemented behind RuntimeEnabledFlag `QuotaExceededErrorUpdate`. Changes to update services throwing QuotaExceededError to use the new class will be made in following changes (except for IDB which triggered failures with this change). Proposal: whatwg/webidl#1465 Chromestatus: https://chromestatus.com/feature/6194847180128256 Bug: 406162261 Change-Id: I68e91e15724e64c0995365ee63d4abe627fe06d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516473 Reviewed-by: Domenic Denicola <domenicchromium.org> Commit-Queue: Ayu Ishii <ayuichromium.org> Reviewed-by: Joey Arhar <jarharchromium.org> Reviewed-by: Joe Mason <joenotcharlesgoogle.com> Cr-Commit-Position: refs/heads/main{#1460403} Co-authored-by: Ayu Ishii <ayuichromium.org> -- wpt-commits: 16a71c4282b0379f639051c0a3f98f3fcdaa2149 wpt-pr: 52556 Differential Revision: https://phabricator.services.mozilla.com/D250632 UltraBlame original commit: 869cbd71034aec8dfdce6d5342adbfc5d8dbf8e6
…tion derived interface, Automatic update from web-platform-tests QuotaExceededError: Update to a DOMException derived interface (#52556) This change introduces a new QuotaExceededError class to update the existing QuotaExceededError so services can return `quota` and `requested` properties as needed. Implemented behind RuntimeEnabledFlag `QuotaExceededErrorUpdate`. Changes to update services throwing QuotaExceededError to use the new class will be made in following changes (except for IDB which triggered failures with this change). Proposal: whatwg/webidl#1465 Chromestatus: https://chromestatus.com/feature/6194847180128256 Bug: 406162261 Change-Id: I68e91e15724e64c0995365ee63d4abe627fe06d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516473 Reviewed-by: Domenic Denicola <domenicchromium.org> Commit-Queue: Ayu Ishii <ayuichromium.org> Reviewed-by: Joey Arhar <jarharchromium.org> Reviewed-by: Joe Mason <joenotcharlesgoogle.com> Cr-Commit-Position: refs/heads/main{#1460403} Co-authored-by: Ayu Ishii <ayuichromium.org> -- wpt-commits: 16a71c4282b0379f639051c0a3f98f3fcdaa2149 wpt-pr: 52556 Differential Revision: https://phabricator.services.mozilla.com/D250632 UltraBlame original commit: 869cbd71034aec8dfdce6d5342adbfc5d8dbf8e6
…tion derived interface, Automatic update from web-platform-tests QuotaExceededError: Update to a DOMException derived interface (#52556) This change introduces a new QuotaExceededError class to update the existing QuotaExceededError so services can return `quota` and `requested` properties as needed. Implemented behind RuntimeEnabledFlag `QuotaExceededErrorUpdate`. Changes to update services throwing QuotaExceededError to use the new class will be made in following changes (except for IDB which triggered failures with this change). Proposal: whatwg/webidl#1465 Chromestatus: https://chromestatus.com/feature/6194847180128256 Bug: 406162261 Change-Id: I68e91e15724e64c0995365ee63d4abe627fe06d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516473 Reviewed-by: Domenic Denicola <domenicchromium.org> Commit-Queue: Ayu Ishii <ayuichromium.org> Reviewed-by: Joey Arhar <jarharchromium.org> Reviewed-by: Joe Mason <joenotcharlesgoogle.com> Cr-Commit-Position: refs/heads/main{#1460403} Co-authored-by: Ayu Ishii <ayuichromium.org> -- wpt-commits: 16a71c4282b0379f639051c0a3f98f3fcdaa2149 wpt-pr: 52556 Differential Revision: https://phabricator.services.mozilla.com/D250632 UltraBlame original commit: 869cbd71034aec8dfdce6d5342adbfc5d8dbf8e6
…a=testonly Automatic update from web-platform-tests Update QuotaExceededError expectations (#53645) See whatwg/webidl#1465. -- wpt-commits: 1d2c5fb36a6e477c8f915bde7eca027be6abe792 wpt-pr: 53645 UltraBlame original commit: 272d71b3fbc93813a5879430d9f769e4f0eac25c
…a=testonly Automatic update from web-platform-tests Update QuotaExceededError expectations (#53645) See whatwg/webidl#1465. -- wpt-commits: 1d2c5fb36a6e477c8f915bde7eca027be6abe792 wpt-pr: 53645 UltraBlame original commit: 272d71b3fbc93813a5879430d9f769e4f0eac25c
…a=testonly Automatic update from web-platform-tests Update QuotaExceededError expectations (#53645) See whatwg/webidl#1465. -- wpt-commits: 1d2c5fb36a6e477c8f915bde7eca027be6abe792 wpt-pr: 53645 UltraBlame original commit: 272d71b3fbc93813a5879430d9f769e4f0eac25c
Reverts just the code value change from crrev.com/c/6516473 Matches resolution in whatwg/webidl#1465 Tests updated in web-platform-tests/wpt#53645 Bug: 406162261 Fixed: 434432288 Change-Id: I2fe06c29c1773fdbec5765a18d5c59a0aa2235f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6814000 Commit-Queue: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Auto-Submit: Mike Wasserman <msw@chromium.org> Cr-Commit-Position: refs/heads/main@{#1496718}
QuotaExceededError is graduating from being a DOMException name into a new error class, in whatwg/webidl#1465. Update creation sites to reflect this. For now, the quota and requested properties are left at their default (null). Future work could include setting them in an informative fashion.
…spec Original change's description: > QuotaExceededError: Restore legacy exception code 22 to match spec > > Reverts just the code value change from crrev.com/c/6516473 > Matches resolution in whatwg/webidl#1465 > Tests updated in web-platform-tests/wpt#53645 > > Bug: 406162261 > Fixed: 434432288 > Change-Id: I2fe06c29c1773fdbec5765a18d5c59a0aa2235f8 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6814000 > Commit-Queue: Daniel Cheng <dcheng@chromium.org> > Reviewed-by: Daniel Cheng <dcheng@chromium.org> > Auto-Submit: Mike Wasserman <msw@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1496718} Bug: 436562744,406162261,434432288 Change-Id: I2fe06c29c1773fdbec5765a18d5c59a0aa2235f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6818806 Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Chrome Cherry Picker <chrome-cherry-picker@chops-service-accounts.iam.gserviceaccount.com> Cr-Commit-Position: refs/branch-heads/7339@{#22} Cr-Branched-From: 27be8b7-refs/heads/main@{#1496484}
QuotaExceededError is graduating from being a DOMException name into a new error class, in whatwg/webidl#1465. Update creation sites to reflect this. For now, the quota and requested properties are left at their default (null). Future work could include setting them in an informative fashion.
Once whatwg/webidl#1465 is merged, we can reference Web IDL directly, instead of the pull request preview.
Once whatwg/webidl#1465 is merged, we can reference Web IDL directly, instead of the pull request preview.
QuotaExceededError is graduating from being a DOMException name into a new error class, in whatwg/webidl#1465. Update creation sites to reflect this. For now, the quota and requested properties are left at their default (null). Future work could include setting them in an informative fashion.
QuotaExceededError is graduating from being a DOMException name into a new error class, in whatwg/webidl#1465. Update creation sites to reflect this. For now, the quota and requested properties are left at their default (null). Future work could include setting them in an informative fashion.
Implements Web IDL spec change (whatwg/webidl#1465) to upgrade QuotaExceededError from a DOMException name to a proper subclass. Changes: - Remove QuotaExceededError from DOMException names table - Create QuotaExceededError class extending DOMException - Add quota and requested properties (default to null) - Update error registration to use new QuotaExceededError class - Add comprehensive tests for QuotaExceededError subclass Fixes denoland#30028
Implements Web IDL spec change (whatwg/webidl#1465) to upgrade QuotaExceededError from a DOMException name to a proper subclass. Changes: - Remove QuotaExceededError from DOMException names table - Create QuotaExceededError class extending DOMException - Add quota and requested properties (default to null) - Update error registration to use new QuotaExceededError class - Add comprehensive tests for QuotaExceededError subclass Fixes denoland#30028
Per whatwg/webidl#1465, QuotaExceededError is no longer a specific DOMException name but will be upgraded to a DOMException subclass. This commit removes QuotaExceededError from the nameToCodeMapping so that new DOMException('msg', 'QuotaExceededError').code returns 0 instead of 22. Fixes denoland#30028
Removes the unused QUOTA_EXCEEDED_ERR constant from DOMException to align with the WebIDL spec change (whatwg/webidl#1465) that makes QuotaExceededError a proper subclass of DOMException rather than just a DOMException name. The constant was defined but never used in the nameToCodeMapping table, making it dead code. QuotaExceededError is now properly implemented as a separate class in 02_quota_exceeded_error.js with code 22, while new DOMException('msg', 'QuotaExceededError') correctly returns code 0. Fixes denoland#30028
… table Per whatwg/webidl#1465, QuotaExceededError has been updated from a legacy DOMException name to a proper DOMException subclass. As the minimal change, this removes QuotaExceededError from the error names table so that `new DOMException('msg', 'QuotaExceededError').code` returns 0 instead of 22, aligning with the updated spec. Fixes denoland#30028
Implements the WebIDL spec change (whatwg/webidl#1465) that upgrades QuotaExceededError from a DOMException error name to a proper derived class extending DOMException with optional `quota` and `requested` properties. Changes: - Remove "QuotaExceededError" from the DOMException names table so `new DOMException("msg", "QuotaExceededError").code === 0` - Add QuotaExceededError class extending DOMException with code 22, and optional `quota`/`requested` properties - Expose QuotaExceededError on the global scope - Update error builder to use QuotaExceededError for Rust-thrown errors - Add TypeScript definitions for QuotaExceededError - Add unit tests Closes denoland#30028 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements the WebIDL spec change (whatwg/webidl#1465) that upgrades QuotaExceededError from a DOMException error name to a proper derived class extending DOMException with optional `quota` and `requested` properties. Changes: - Remove "QuotaExceededError" from the DOMException names table so `new DOMException("msg", "QuotaExceededError").code === 0` - Add QuotaExceededError class extending DOMException with code 22, and optional `quota`/`requested` properties - Expose QuotaExceededError on the global scope - Update error builder to use QuotaExceededError for Rust-thrown errors - Add TypeScript definitions for QuotaExceededError - Add unit tests Closes denoland#30028 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
https://www.youtube.com/channel/UCdr7qw8QhnOz03z-CUjJU1QHttps://nakamotoinstitute.org/youtube.com/@satoshi.Nakamoto.47[]() |
The proposal
The web platform benefits from having a type of exception that tells you about when you exceed quotas. In some cases, it can be helpful to tell you what the quota was, and by how much you exceeded it. webmachinelearning/writing-assistance-apis#5 gives one specific use case.
The web platform already has an exception type for telling you when you exceed quotas: it is
DOMException, with the specificnameproperty set to"QuotaExceededError". However, this does not allow carrying additional information.This PR proposes removing
"QuotaExceededError"from the list of built-inDOMExceptionnames, and instead creates a class namedQuotaExceededErrorthat derives fromDOMExceptionand has the additional optional propertiesquotaandrequested. We propose that all instances of specs that throw"QuotaExceededError"DOMExceptions get upgraded to instead throwQuotaExceededErrors. For now, such specs would leave thequotaandrequestedproperties at their default value ofnull, but they could eventually upgrade to include that data, if it's useful for their use case (and isn't, e.g., a privacy leak).Alternative considered
The most promising alternative considered was to add a new class that sits alongside
"QuotaExceededError"DOMException. Maybe it would be calledQuotaExceededErrorWithDetails, or maybe we could even call itQuotaExceededErrordespite the confusion this might cause. But it would be undesirable for the web platform to have two types of quota-exceeded errors, with different APIs giving different ones. So, because we believe the compat implications are not too bad, we're interested in trying this upgrade route instead.There are other possibilities, such as using custom bindings to sometimes add properties to base
"QuotaExceededError"DOMExceptioninstances, or trying to add some generic additional information capability to the baseDOMExceptionclass. However, these don't fit well with how classes work on the web platform, with getters providing predefined data on a per-class basis. They would be hacky to maintain both in specs and implementations, and a bit surprising for web developers as well due to the mismatch with other web platform classes.Compat considerations
The following coding patterns will work unchanged if we upgrade all
"QuotaExceededError"DOMExceptions toQuotaExceedErrors:ex instanceof DOMExceptionex.name === "QuotaExceededError"DOMException.QUOTA_EXCEEDED_ERR === 22(new DOMException("message", "QuotaExceededError")).name === "QuotaExceededError"(new DOMException("message", "QuotaExceededError")).code === DOMException.QUOTA_EXCEEDED_ERRex.code === DOMException.QUOTA_EXCEEDED_ERRex.code === 22The following coding patterns will start giving different answers:
ex.constructor === DOMExceptionex.constructor.name === "DOMException"We believe that these coding patterns are quite rare. See, for example, these GitHub search results, which show only a couple instances of
.constructortesting (repeated in a few forks).The tests like
ex instanceof DOMExceptionandex.name === "QuotaExceededError"are much more common, and commonly seen in documentation. (See, e.g., these GitHub search results.)Furthermore, since quotas being exceeded is a relatively rare thing to happen on the web, we suspect that the combination of these rare coding patterns with this rare type of
DOMExceptionmeans the impacted number of page views will be extremely small.We could add some use counters for these coding patterns, but they would be sloppy. In particular, we could count cases where
.constructoris accessed, but not cases where it is compared toDOMException, so any count would be inflated by generic constructor-accessing code, and not really tell us much about the problematic coding pattern.Nevertheless, there's definitely some compat risk. So the best rollout plan here would probably be for Chromium to cautiously take the lead and report back if it sticks, before necessarily merging changes to all the relevant specs.
Proposed commit message:
Upgrade QuotaExceededError to a DOMException derived interface
Closes #1463.
Labeling "do not merge yet" as we should also create PRs for these specs, and we probably don't want to merge until we see if this sticks in Chromium:
The following cases did not need PRs because they were using inaccurate spec text (just
QuotaExceededError, instead of"QuotaExceededError"DOMException), which has now become correct by accident:(See WHATWG Working Mode: Changes for more details.)
Preview | Diff