From f056a792bc8fa8f0300985895f7e84ef3772bdb3 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Tue, 17 Mar 2026 13:48:16 +0100 Subject: [PATCH 1/5] 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: https://github.com/nodejs/node/issues/58987 --- doc/api/globals.md | 8 + eslint.config.mjs | 1 + lib/eslint.config_partial.mjs | 6 +- .../bootstrap/web/exposed-wildcard.js | 5 + lib/internal/crypto/random.js | 6 +- lib/internal/per_context/domexception.js | 94 +++++++++ lib/internal/quota_exceeded_error.js | 5 + lib/internal/worker/clone_dom_exception.js | 6 +- src/node_messaging.cc | 15 ++ src/node_webstorage.cc | 18 +- test/parallel/test-quotaexceedederror.js | 199 ++++++++++++++++++ test/parallel/test-webcrypto-random.js | 10 +- test/wpt/status/WebCryptoAPI.cjs | 16 -- test/wpt/status/webstorage.json | 16 -- 14 files changed, 357 insertions(+), 48 deletions(-) create mode 100644 lib/internal/quota_exceeded_error.js create mode 100644 test/parallel/test-quotaexceedederror.js diff --git a/doc/api/globals.md b/doc/api/globals.md index 47340c897b4a36..6c0caca06d3dbb 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -976,6 +976,14 @@ DataHandler.prototype.load = async function load(key) { }; ``` +## Class: `QuotaExceededError` + + + +The WHATWG {QuotaExceededError} class. Extends {DOMException}. + ## Class: `ReadableByteStreamController`