Skip to content

lib,src: implement QuotaExceededError as DOMException-derived interface#62293

Open
panva wants to merge 5 commits intonodejs:mainfrom
panva:quotaexceedederror
Open

lib,src: implement QuotaExceededError as DOMException-derived interface#62293
panva wants to merge 5 commits intonodejs:mainfrom
panva:quotaexceedederror

Conversation

@panva
Copy link
Member

@panva panva commented Mar 17, 2026

Implement QuotaExceededError as a DOMException-derived interface per the WebIDL specification update.

QuotaExceededError is now a proper constructor exposed as a global [Exposed=*] interface that extends DOMException with optional quota and requested attributes (both nullable doubles, defaulting to null).

The constructor validates that quota and requested are finite, non-negative, and that requested is not less than quota when both are provided.

QuotaExceededError is [Serializable] and supports structuredClone, preserving the quota and requested values across the serialization boundary.

Callers updated:

  • crypto.getRandomValues() now throws a QuotaExceededError instance
  • WebStorage (C++) now constructs QuotaExceededError directly

Refs: https://redirect.github.com/whatwg/webidl/pull/1465
Fixes: https://redirect.github.com/nodejs/node/issues/58987

cc @domenic

@panva panva added semver-major PRs that contain breaking changes and should be released in the next major version. web-standards Issues and PRs related to Web APIs labels Mar 17, 2026
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/startup
  • @nodejs/web-standards

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Mar 17, 2026
Implement QuotaExceededError as a DOMException-derived interface per the
WebIDL specification update.

QuotaExceededError is now a proper constructor exposed as a global
[Exposed=*] interface that extends DOMException with optional `quota`
and `requested` attributes (both nullable doubles, defaulting to null).

The constructor validates that quota and requested are finite,
non-negative, and that requested is not less than quota when both are
provided.

QuotaExceededError is [Serializable] and supports structuredClone,
preserving the quota and requested values across the serialization
boundary.

Callers updated:
- crypto.getRandomValues() now throws a QuotaExceededError instance
- WebStorage (C++) now constructs QuotaExceededError directly

Refs: https://redirect.github.com/whatwg/webidl/pull/1465
Fixes: nodejs#58987
@panva panva force-pushed the quotaexceedederror branch from 6449ff6 to f056a79 Compare March 17, 2026 13:11
if ('requested' in options) {
requested = +options.requested;
if (!NumberIsFinite(requested)) {
// eslint-disable-next-line no-restricted-syntax
Copy link
Member

Choose a reason for hiding this comment

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

Why does this disable line required? It's not obvious...

Copy link
Member Author

Choose a reason for hiding this comment

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

Same reason as #62293 (comment), the linter asks to

   78:18  error  Use an error exported by 'internal/errors' instead  no-restricted-syntax
  225:17  error  Use an error exported by 'internal/errors' instead  no-restricted-syntax
  230:17  error  Use an error exported by 'internal/errors' instead  no-restricted-syntax
  237:17  error  Use an error exported by 'internal/errors' instead  no-restricted-syntax
  242:17  error  Use an error exported by 'internal/errors' instead  no-restricted-syntax
  248:13  error  Use an error exported by 'internal/errors' instead  no-restricted-syntax

which we can't here because require() isn't available.

@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 98.44961% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.66%. Comparing base (a62f641) to head (953b122).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/node_webstorage.cc 75.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62293      +/-   ##
==========================================
- Coverage   89.66%   89.66%   -0.01%     
==========================================
  Files         676      677       +1     
  Lines      206556   206691     +135     
  Branches    39552    39583      +31     
==========================================
+ Hits       185218   185331     +113     
- Misses      13493    13495       +2     
- Partials     7845     7865      +20     
Files with missing lines Coverage Δ
lib/internal/bootstrap/web/exposed-wildcard.js 100.00% <100.00%> (ø)
lib/internal/crypto/random.js 96.10% <100.00%> (ø)
lib/internal/per_context/domexception.js 96.62% <100.00%> (+1.49%) ⬆️
lib/internal/quota_exceeded_error.js 100.00% <100.00%> (ø)
lib/internal/worker/clone_dom_exception.js 100.00% <100.00%> (ø)
src/node_messaging.cc 82.20% <100.00%> (-0.07%) ⬇️
src/node_webstorage.cc 74.67% <75.00%> (-0.07%) ⬇️

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@panva panva requested review from MattiasBuelens and anonrig March 17, 2026 15:54
@panva panva added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Mar 17, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 17, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version. web-standards Issues and PRs related to Web APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants