Skip to content

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

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

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.38710% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.66%. Comparing base (a62f641) to head (5a8ef66).
⚠️ Report is 18 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      676              
  Lines      206556   206688     +132     
  Branches    39552    39582      +30     
==========================================
+ Hits       185218   185336     +118     
- Misses      13493    13507      +14     
  Partials     7845     7845              
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/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 49 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

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

@panva
Copy link
Member Author

panva commented Mar 18, 2026

cc @nodejs/tsc for semver-major PRs that contain breaking changes and should be released in the next major version. (new global)

@panva panva added the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 18, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Mar 19, 2026
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/62293
✔  Done loading data for nodejs/node/pull/62293
----------------------------------- PR info ------------------------------------
Title      lib,src: implement QuotaExceededError as DOMException-derived interface (#62293)
Author     Filip Skokan <panva.ip@gmail.com> (@panva)
Branch     panva:quotaexceedederror -> nodejs:main
Labels     semver-major, lib / src, author ready, needs-ci, web-standards
Commits    5
 - lib,src: implement QuotaExceededError as DOMException-derived interface
 - fixup! lib,src: implement QuotaExceededError as DOMException-derived …
 - fixup! lib,src: implement QuotaExceededError as DOMException-derived …
 - fixup! lib,src: implement QuotaExceededError as DOMException-derived …
 - fixup! lib,src: implement QuotaExceededError as DOMException-derived …
Committers 1
 - Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62293
Fixes: https://redirect.github.com/nodejs/node/issues/58987
Refs: https://redirect.github.com/whatwg/webidl/pull/1465
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/62293
Fixes: https://redirect.github.com/nodejs/node/issues/58987
Refs: https://redirect.github.com/whatwg/webidl/pull/1465
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 17 Mar 2026 13:07:44 GMT
   ✔  Approvals: 4
   ✔  - Mattias Buelens (@MattiasBuelens): https://github.com/nodejs/node/pull/62293#pullrequestreview-3962888749
   ✔  - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/62293#pullrequestreview-3963293507
   ✔  - Michaël Zasso (@targos) (TSC): https://github.com/nodejs/node/pull/62293#pullrequestreview-3965622611
   ✔  - Colin Ihrig (@cjihrig): https://github.com/nodejs/node/pull/62293#pullrequestreview-3968289651
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-03-18T06:14:43Z: https://ci.nodejs.org/job/node-test-pull-request/71853/
- Querying data for job/node-test-pull-request/71853/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 62293
From https://github.com/nodejs/node
 * branch                  refs/pull/62293/merge -> FETCH_HEAD
✔  Fetched commits as 4ee467f91254..5a8ef66a61b6
--------------------------------------------------------------------------------
Auto-merging eslint.config.mjs
[main 26c37eeb73] lib,src: implement QuotaExceededError as DOMException-derived interface
 Author: Filip Skokan <panva.ip@gmail.com>
 Date: Tue Mar 17 13:48:16 2026 +0100
 14 files changed, 357 insertions(+), 48 deletions(-)
 create mode 100644 lib/internal/quota_exceeded_error.js
 create mode 100644 test/parallel/test-quotaexceedederror.js
[main 88cb48523f] fixup! lib,src: implement QuotaExceededError as DOMException-derived interface
 Author: Filip Skokan <panva.ip@gmail.com>
 Date: Tue Mar 17 14:29:40 2026 +0100
 1 file changed, 13 insertions(+), 16 deletions(-)
[main a9e1edc1b5] fixup! lib,src: implement QuotaExceededError as DOMException-derived interface
 Author: Filip Skokan <panva.ip@gmail.com>
 Date: Tue Mar 17 14:41:05 2026 +0100
 1 file changed, 26 insertions(+), 27 deletions(-)
[main 950f39c772] fixup! lib,src: implement QuotaExceededError as DOMException-derived interface
 Author: Filip Skokan <panva.ip@gmail.com>
 Date: Tue Mar 17 15:11:20 2026 +0100
 1 file changed, 1 insertion(+)
[main e97b1b48b1] fixup! lib,src: implement QuotaExceededError as DOMException-derived interface
 Author: Filip Skokan <panva.ip@gmail.com>
 Date: Tue Mar 17 20:47:27 2026 +0100
 2 files changed, 1 insertion(+), 6 deletions(-)
 delete mode 100644 lib/internal/quota_exceeded_error.js
   ✔  Patches applied
There are 5 commits in the PR. Attempting autorebase.
(node:349) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Rebasing (2/6)
Rebasing (3/6)
Rebasing (4/6)
Rebasing (5/6)
Rebasing (6/6)
Executing: git node land --amend --yes
   ⚠  Found Refs: https://redirect.github.com/whatwg/webidl/pull/1465, skipping..
--------------------------------- New Message ----------------------------------
lib,src: implement QuotaExceededError as DOMException-derived interface

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: #58987
PR-URL: #62293
Fixes: https://redirect.github.com/nodejs/node/issues/58987
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

[detached HEAD 6abf2dafeb] lib,src: implement QuotaExceededError as DOMException-derived interface
Author: Filip Skokan <panva.ip@gmail.com>
Date: Tue Mar 17 13:48:16 2026 +0100
15 files changed, 376 insertions(+), 75 deletions(-)
create mode 100644 test/parallel/test-quotaexceedederror.js
Successfully rebased and updated refs/heads/main.
✖ 6abf2dafebb3ec1dd50e65d23bda028f733bcd26
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
✔ 21:7 Valid fixes URL. fixes-url
✖ 23:7 Fixes must be a GitHub URL. fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 22:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
⚠ 0:50 Title should be <= 50 columns. title-length

ℹ Please fix the commit message and try again.
Please manually ammend the commit message, by running
git commit --amend
Once commit message is fixed, finish the landing command running
git node land --continue

https://github.com/nodejs/node/actions/runs/23296977925

panva added a commit that referenced this pull request Mar 19, 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: #58987
PR-URL: #62293

Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@panva
Copy link
Member Author

panva commented Mar 19, 2026

Landed in b328bf7

@panva panva closed this Mar 19, 2026
@panva panva removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Mar 19, 2026
@panva panva deleted the quotaexceedederror branch March 19, 2026 13:52
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.

7 participants