From 220ba9a776c5b6320ddfd8ac1cc82408443c161e Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Mon, 31 Aug 2026 13:51:06 +0200 Subject: [PATCH] test: bump WPT webidl and interfaces Signed-off-by: Filip Skokan --- test/fixtures/wpt/interfaces/FileAPI.idl | 1 + test/fixtures/wpt/interfaces/compression.idl | 1 + test/fixtures/wpt/interfaces/dom.idl | 18 ++- test/fixtures/wpt/interfaces/html.idl | 106 ++++++++++++++++-- .../wpt/interfaces/resource-timing.idl | 9 +- test/fixtures/wpt/interfaces/streams.idl | 4 +- test/fixtures/wpt/interfaces/web-locks.idl | 4 +- .../wpt/interfaces/webcrypto-modern-algos.idl | 6 +- test/fixtures/wpt/interfaces/webcrypto.idl | 8 +- test/fixtures/wpt/versions.json | 4 +- .../allow-shared.https.html | 29 +++++ .../DOMException-constants.any.js | 2 +- ...Exception-constructor-and-prototype.any.js | 2 +- .../DOMException-constructor-behavior.any.js | 2 +- .../DOMException-custom-bindings.any.js | 2 +- .../DOMException-is-error.any.js | 2 +- .../DOMException-stack-accessor.any.js | 80 +++++++++++++ .../global-mutable-prototype.any.js | 27 ----- test/fixtures/wpt/webidl/idlharness.any.js | 2 +- test/wpt/status/webidl.json | 12 ++ 20 files changed, 255 insertions(+), 66 deletions(-) create mode 100644 test/fixtures/wpt/webidl/ecmascript-binding/allow-shared.https.html create mode 100644 test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-stack-accessor.any.js delete mode 100644 test/fixtures/wpt/webidl/ecmascript-binding/global-mutable-prototype.any.js diff --git a/test/fixtures/wpt/interfaces/FileAPI.idl b/test/fixtures/wpt/interfaces/FileAPI.idl index 49219fce277f..4a711a684459 100644 --- a/test/fixtures/wpt/interfaces/FileAPI.idl +++ b/test/fixtures/wpt/interfaces/FileAPI.idl @@ -20,6 +20,7 @@ interface Blob { [NewObject] ReadableStream stream(); [NewObject] Promise text(); [NewObject] Promise arrayBuffer(); + [NewObject] ReadableStream textStream(); [NewObject] Promise bytes(); }; diff --git a/test/fixtures/wpt/interfaces/compression.idl b/test/fixtures/wpt/interfaces/compression.idl index defe4ba55cdf..6e44b4ad6dd9 100644 --- a/test/fixtures/wpt/interfaces/compression.idl +++ b/test/fixtures/wpt/interfaces/compression.idl @@ -4,6 +4,7 @@ // Source: Compression Standard (https://compression.spec.whatwg.org/) enum CompressionFormat { + "brotli", "deflate", "deflate-raw", "gzip", diff --git a/test/fixtures/wpt/interfaces/dom.idl b/test/fixtures/wpt/interfaces/dom.idl index 1ddc084b949d..f61580f43a90 100644 --- a/test/fixtures/wpt/interfaces/dom.idl +++ b/test/fixtures/wpt/interfaces/dom.idl @@ -328,7 +328,7 @@ interface DOMImplementation { [NewObject] XMLDocument createDocument(DOMString? namespace, [LegacyNullToEmptyString] DOMString qualifiedName, optional DocumentType? doctype = null); [NewObject] Document createHTMLDocument(optional DOMString title); - boolean hasFeature(); // useless; always returns true + boolean hasFeature(); // historical; always returns true }; [Exposed=Window] @@ -347,9 +347,9 @@ interface DocumentFragment : Node { interface ShadowRoot : DocumentFragment { readonly attribute ShadowRootMode mode; readonly attribute boolean delegatesFocus; + readonly attribute boolean serializable; readonly attribute SlotAssignmentMode slotAssignment; readonly attribute boolean clonable; - readonly attribute boolean serializable; readonly attribute Element host; attribute EventHandler onslotchange; @@ -409,9 +409,9 @@ interface Element : Node { dictionary ShadowRootInit { required ShadowRootMode mode; boolean delegatesFocus = false; + boolean serializable = false; SlotAssignmentMode slotAssignment = "named"; boolean clonable = false; - boolean serializable = false; CustomElementRegistry? customElementRegistry; }; @@ -438,7 +438,7 @@ interface Attr : Node { readonly attribute Element? ownerElement; - readonly attribute boolean specified; // useless; always returns true + readonly attribute boolean specified; // historical; always returns true }; [Exposed=Window] interface CharacterData : Node { @@ -464,7 +464,17 @@ interface CDATASection : Text { }; [Exposed=Window] interface ProcessingInstruction : CharacterData { + constructor(DOMString target, optional DOMString data = ""); + readonly attribute DOMString target; + + boolean hasAttributes(); + sequence getAttributeNames(); + DOMString? getAttribute(DOMString name); + undefined setAttribute(DOMString name, DOMString value); + undefined removeAttribute(DOMString name); + boolean toggleAttribute(DOMString name, optional boolean force); + boolean hasAttribute(DOMString name); }; [Exposed=Window] interface Comment : CharacterData { diff --git a/test/fixtures/wpt/interfaces/html.idl b/test/fixtures/wpt/interfaces/html.idl index 567e5a79a36a..e5ce24af481a 100644 --- a/test/fixtures/wpt/interfaces/html.idl +++ b/test/fixtures/wpt/interfaces/html.idl @@ -48,7 +48,8 @@ typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement; [LegacyOverrideBuiltIns] partial interface Document { - static Document parseHTMLUnsafe((TrustedHTML or DOMString) html); + static Document parseHTMLUnsafe((TrustedHTML or DOMString) html, optional ParseHTMLUnsafeOptions options = {}); + static Document parseHTML(DOMString html, optional SetHTMLOptions options = {}); // resource metadata management [PutForwards=href, LegacyUnforgeable] readonly attribute Location? location; @@ -152,14 +153,14 @@ dictionary TogglePopoverOptions : ShowPopoverOptions { HTMLElement includes GlobalEventHandlers; HTMLElement includes ElementContentEditable; -HTMLElement includes HTMLOrSVGElement; +HTMLElement includes HTMLOrSVGOrMathMLElement; [Exposed=Window] interface HTMLUnknownElement : HTMLElement { // Note: intentionally no [HTMLConstructor] }; -interface mixin HTMLOrSVGElement { +interface mixin HTMLOrSVGOrMathMLElement { [SameObject] readonly attribute DOMStringMap dataset; attribute DOMString nonce; // intentionally no [CEReactions] @@ -349,13 +350,10 @@ interface HTMLDivElement : HTMLElement { interface HTMLAnchorElement : HTMLElement { [HTMLConstructor] constructor(); - [CEReactions, Reflect] attribute DOMString target; [CEReactions, Reflect] attribute DOMString download; [CEReactions, Reflect] attribute USVString ping; [CEReactions, Reflect] attribute DOMString rel; [SameObject, PutForwards=value, Reflect="rel"] readonly attribute DOMTokenList relList; - [CEReactions, Reflect] attribute DOMString hreflang; - [CEReactions, Reflect] attribute DOMString type; [CEReactions] attribute DOMString text; @@ -403,10 +401,14 @@ interface mixin HyperlinkElementUtils { [CEReactions] attribute USVString pathname; [CEReactions] attribute USVString search; [CEReactions] attribute USVString hash; + + [CEReactions, Reflect] attribute DOMString hreflang; + [CEReactions, Reflect] attribute DOMString type; }; interface mixin HTMLHyperlinkElementUtils { [CEReactions, ReflectSetter] stringifier attribute USVString href; + [CEReactions, Reflect] attribute DOMString target; }; [Exposed=Window] @@ -447,6 +449,7 @@ interface HTMLImageElement : HTMLElement { [CEReactions] attribute DOMString? crossOrigin; [CEReactions, Reflect] attribute DOMString useMap; [CEReactions, Reflect] attribute boolean isMap; + [CEReactions, Reflect] attribute boolean controls; [CEReactions, ReflectSetter] attribute unsigned long width; [CEReactions, ReflectSetter] attribute unsigned long height; readonly attribute unsigned long naturalWidth; @@ -531,6 +534,7 @@ interface HTMLVideoElement : HTMLMediaElement { readonly attribute unsigned long videoHeight; [CEReactions, ReflectURL] attribute USVString poster; [CEReactions, Reflect] attribute boolean playsInline; + }; [Exposed=Window, @@ -613,6 +617,7 @@ interface HTMLMediaElement : HTMLElement { attribute double volume; attribute boolean muted; [CEReactions, Reflect="muted"] attribute boolean defaultMuted; + [CEReactions] attribute DOMString loading; // tracks [SameObject] readonly attribute AudioTrackList audioTracks; @@ -760,7 +765,6 @@ interface HTMLAreaElement : HTMLElement { [CEReactions, Reflect] attribute DOMString alt; [CEReactions, Reflect] attribute DOMString coords; [CEReactions, Reflect] attribute DOMString shape; - [CEReactions, Reflect] attribute DOMString target; [CEReactions, Reflect] attribute DOMString download; [CEReactions, Reflect] attribute USVString ping; [CEReactions, Reflect] attribute DOMString rel; @@ -966,7 +970,7 @@ interface HTMLButtonElement : HTMLElement { [HTMLConstructor] constructor(); [CEReactions, ReflectSetter] attribute DOMString command; - [CEReactions, Reflect] attribute Element? commandForElement; + [CEReactions, Reflect="commandfor"] attribute Element? commandForElement; [CEReactions, Reflect] attribute boolean disabled; readonly attribute HTMLFormElement? form; [CEReactions, ReflectSetter] attribute USVString formAction; @@ -1271,10 +1275,12 @@ interface HTMLTemplateElement : HTMLElement { [HTMLConstructor] constructor(); readonly attribute DocumentFragment content; + [CEReactions, Reflect="for"] attribute DOMString htmlFor; [CEReactions] attribute DOMString shadowRootMode; [CEReactions, Reflect] attribute boolean shadowRootDelegatesFocus; - [CEReactions, Reflect] attribute boolean shadowRootClonable; [CEReactions, Reflect] attribute boolean shadowRootSerializable; + [CEReactions] attribute DOMString shadowRootSlotAssignment; + [CEReactions, Reflect] attribute boolean shadowRootClonable; [CEReactions, Reflect] attribute DOMString shadowRootCustomElementRegistry; }; @@ -1808,7 +1814,7 @@ dictionary DragEventInit : MouseEventInit { }; interface mixin PopoverTargetAttributes { - [CEReactions, Reflect] attribute Element? popoverTargetElement; + [CEReactions, Reflect="popovertarget"] attribute Element? popoverTargetElement; [CEReactions] attribute DOMString popoverTargetAction; }; @@ -2357,7 +2363,8 @@ Window includes WindowOrWorkerGlobalScope; WorkerGlobalScope includes WindowOrWorkerGlobalScope; partial interface Element { - [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html); + [CEReactions] undefined setHTML(DOMString html, optional SetHTMLOptions options = {}); + [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html, optional SetHTMLUnsafeOptions options = {}); DOMString getHTML(optional GetHTMLOptions options = {}); [CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML; @@ -2366,12 +2373,25 @@ partial interface Element { }; partial interface ShadowRoot { - [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html); + [CEReactions] undefined setHTML(DOMString html, optional SetHTMLOptions options = {}); + [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html, optional SetHTMLUnsafeOptions options = {}); DOMString getHTML(optional GetHTMLOptions options = {}); [CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML; }; +enum SanitizerPresets { "default" }; +dictionary SetHTMLOptions { + (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer = "default"; +}; +dictionary SetHTMLUnsafeOptions { + (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer = {}; + boolean runScripts = false; +}; +dictionary ParseHTMLUnsafeOptions { + (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer = {}; +}; + dictionary GetHTMLOptions { boolean serializableShadowRoots = false; sequence shadowRoots = []; @@ -2403,6 +2423,68 @@ interface XMLSerializer { DOMString serializeToString(Node root); }; +[Exposed=Window] +interface Sanitizer { + constructor(optional (SanitizerConfig or SanitizerPresets) configuration = "default"); + + // Query configuration: + SanitizerConfig get(); + + // Modify a Sanitizer's lists and fields: + boolean allowElement(SanitizerElementWithAttributes element); + boolean removeElement(SanitizerElement element); + boolean replaceElementWithChildren(SanitizerElement element); + boolean allowProcessingInstruction(SanitizerPI pi); + boolean removeProcessingInstruction(SanitizerPI pi); + boolean allowAttribute(SanitizerAttribute attribute); + boolean removeAttribute(SanitizerAttribute attribute); + boolean setComments(boolean allow); + boolean setDataAttributes(boolean allow); + + // Remove markup that executes script. + boolean removeUnsafe(); +}; + +dictionary SanitizerElementNamespace { + required DOMString name; + DOMString? _namespace = "http://www.w3.org/1999/xhtml"; +}; + +// Used by "elements" +dictionary SanitizerElementNamespaceWithAttributes : SanitizerElementNamespace { + sequence attributes; + sequence removeAttributes; +}; + +dictionary SanitizerAttributeNamespace { + required DOMString name; + DOMString? _namespace = null; +}; + +dictionary SanitizerProcessingInstruction { + required DOMString target; +}; + +typedef (DOMString or SanitizerElementNamespace) SanitizerElement; +typedef (DOMString or SanitizerElementNamespaceWithAttributes) SanitizerElementWithAttributes; +typedef (DOMString or SanitizerProcessingInstruction) SanitizerPI; +typedef (DOMString or SanitizerAttributeNamespace) SanitizerAttribute; + +dictionary SanitizerConfig { + sequence elements; + sequence removeElements; + sequence replaceWithChildrenElements; + + sequence processingInstructions; + sequence removeProcessingInstructions; + + sequence attributes; + sequence removeAttributes; + + boolean comments; + boolean dataAttributes; +}; + [Exposed=Window] interface Navigator { // objects implementing this interface also implement the interfaces given below diff --git a/test/fixtures/wpt/interfaces/resource-timing.idl b/test/fixtures/wpt/interfaces/resource-timing.idl index ba8e3953b497..1391b09022e1 100644 --- a/test/fixtures/wpt/interfaces/resource-timing.idl +++ b/test/fixtures/wpt/interfaces/resource-timing.idl @@ -41,7 +41,8 @@ enum RenderBlockingStatusType { "non-blocking" }; -partial interface Performance { undefined clearResourceTimings (); - undefined setResourceTimingBufferSize (unsigned long maxSize); - attribute EventHandler onresourcetimingbufferfull; -}; +partial interface Performance { + undefined clearResourceTimings (); + undefined setResourceTimingBufferSize (unsigned long maxSize); + attribute EventHandler onresourcetimingbufferfull; + }; diff --git a/test/fixtures/wpt/interfaces/streams.idl b/test/fixtures/wpt/interfaces/streams.idl index 8abc8f5cfda9..a0de8b89aa46 100644 --- a/test/fixtures/wpt/interfaces/streams.idl +++ b/test/fixtures/wpt/interfaces/streams.idl @@ -7,7 +7,7 @@ interface ReadableStream { constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); - static ReadableStream from(any asyncIterable); + static ReadableStream from(async_sequence asyncIterable); readonly attribute boolean locked; @@ -114,7 +114,7 @@ interface ReadableByteStreamController { [Exposed=*] interface ReadableStreamBYOBRequest { - readonly attribute ArrayBufferView? view; + readonly attribute Uint8Array? view; undefined respond([EnforceRange] unsigned long long bytesWritten); undefined respondWithNewView(ArrayBufferView view); diff --git a/test/fixtures/wpt/interfaces/web-locks.idl b/test/fixtures/wpt/interfaces/web-locks.idl index 00648cc3b1e5..d79e404b983f 100644 --- a/test/fixtures/wpt/interfaces/web-locks.idl +++ b/test/fixtures/wpt/interfaces/web-locks.idl @@ -10,7 +10,7 @@ interface mixin NavigatorLocks { Navigator includes NavigatorLocks; WorkerNavigator includes NavigatorLocks; -[SecureContext, Exposed=(Window,Worker,SharedStorageWorklet)] +[SecureContext, Exposed=(Window,Worker)] interface LockManager { Promise request(DOMString name, LockGrantedCallback callback); @@ -43,7 +43,7 @@ dictionary LockInfo { DOMString clientId; }; -[SecureContext, Exposed=(Window,Worker,SharedStorageWorklet)] +[SecureContext, Exposed=(Window,Worker)] interface Lock { readonly attribute DOMString name; readonly attribute LockMode mode; diff --git a/test/fixtures/wpt/interfaces/webcrypto-modern-algos.idl b/test/fixtures/wpt/interfaces/webcrypto-modern-algos.idl index aeb1d650b7d7..00df80f74ccf 100644 --- a/test/fixtures/wpt/interfaces/webcrypto-modern-algos.idl +++ b/test/fixtures/wpt/interfaces/webcrypto-modern-algos.idl @@ -38,7 +38,7 @@ partial interface SubtleCrypto { static boolean supports(DOMString operation, AlgorithmIdentifier algorithm, - optional unsigned long? length = null); + optional [EnforceRange] unsigned long? length = null); static boolean supports(DOMString operation, AlgorithmIdentifier algorithm, AlgorithmIdentifier additionalAlgorithm); @@ -59,7 +59,7 @@ dictionary EncapsulatedBits { }; partial dictionary JsonWebKey { - // The following fields are defined in draft-ietf-cose-dilithium-08 + // The following fields are defined in RFC 9964 DOMString pub; DOMString priv; }; @@ -99,7 +99,7 @@ dictionary KmacImportParams : Algorithm { }; dictionary KmacKeyAlgorithm : KeyAlgorithm { - required unsigned long length; + required [EnforceRange] unsigned long length; }; dictionary KmacParams : Algorithm { diff --git a/test/fixtures/wpt/interfaces/webcrypto.idl b/test/fixtures/wpt/interfaces/webcrypto.idl index ebb9cf5718b9..7599a1a994aa 100644 --- a/test/fixtures/wpt/interfaces/webcrypto.idl +++ b/test/fixtures/wpt/interfaces/webcrypto.idl @@ -79,7 +79,7 @@ interface SubtleCrypto { Promise deriveBits( AlgorithmIdentifier algorithm, CryptoKey baseKey, - optional unsigned long? length = null + optional [EnforceRange] unsigned long? length = null ); Promise importKey( @@ -161,7 +161,7 @@ dictionary RsaHashedKeyGenParams : RsaKeyGenParams { }; dictionary RsaKeyAlgorithm : KeyAlgorithm { - required unsigned long modulusLength; + required [EnforceRange] unsigned long modulusLength; required BigInteger publicExponent; }; @@ -209,7 +209,7 @@ dictionary AesCtrParams : Algorithm { }; dictionary AesKeyAlgorithm : KeyAlgorithm { - required unsigned short length; + required [EnforceRange] unsigned short length; }; dictionary AesKeyGenParams : Algorithm { @@ -237,7 +237,7 @@ dictionary HmacImportParams : Algorithm { dictionary HmacKeyAlgorithm : KeyAlgorithm { required KeyAlgorithm hash; - required unsigned long length; + required [EnforceRange] unsigned long length; }; dictionary HmacKeyGenParams : Algorithm { diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index e4d65aeba685..fe3c3fda2202 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -52,7 +52,7 @@ "path": "html/webappapis/timers" }, "interfaces": { - "commit": "a8392bd0210378dda13278eeccf2c2602278e214", + "commit": "3f15e5c09448b8e917c9128d3b07cc78f044c83a", "path": "interfaces" }, "performance-timeline": { @@ -104,7 +104,7 @@ "path": "WebCryptoAPI" }, "webidl": { - "commit": "63ca529a021fec15b2996db82fd7dd04c11abe85", + "commit": "65bbe07908e5c19e8a6c7ff8701cc2a722cd215e", "path": "webidl" }, "webidl/ecmascript-binding/es-exceptions": { diff --git a/test/fixtures/wpt/webidl/ecmascript-binding/allow-shared.https.html b/test/fixtures/wpt/webidl/ecmascript-binding/allow-shared.https.html new file mode 100644 index 000000000000..b4cd1e37fd94 --- /dev/null +++ b/test/fixtures/wpt/webidl/ecmascript-binding/allow-shared.https.html @@ -0,0 +1,29 @@ + + +WebIDL [AllowShared] semantics + + + + + diff --git a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constants.any.js b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constants.any.js index 9b6978783723..856d13681e60 100644 --- a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constants.any.js +++ b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constants.any.js @@ -1,4 +1,4 @@ -// META: global=window,dedicatedworker,shadowrealm +// META: global=window,dedicatedworker 'use strict'; diff --git a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constructor-and-prototype.any.js b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constructor-and-prototype.any.js index 011521652654..ca0fc84fc66a 100644 --- a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constructor-and-prototype.any.js +++ b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constructor-and-prototype.any.js @@ -1,4 +1,4 @@ -// META: global=window,dedicatedworker,shadowrealm +// META: global=window,dedicatedworker test(function() { assert_own_property(self, "DOMException", "property of global"); diff --git a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constructor-behavior.any.js b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constructor-behavior.any.js index c4ddabdafd45..10aad220b917 100644 --- a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constructor-behavior.any.js +++ b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-constructor-behavior.any.js @@ -1,4 +1,4 @@ -// META: global=window,dedicatedworker,shadowrealm +// META: global=window,dedicatedworker 'use strict'; diff --git a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-custom-bindings.any.js b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-custom-bindings.any.js index d1c86930d4cd..467bf054c3a9 100644 --- a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-custom-bindings.any.js +++ b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-custom-bindings.any.js @@ -1,4 +1,4 @@ -// META: global=window,dedicatedworker,shadowrealm +// META: global=window,dedicatedworker "use strict"; diff --git a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-is-error.any.js b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-is-error.any.js index 6f3097b222ed..dc39c978217b 100644 --- a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-is-error.any.js +++ b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-is-error.any.js @@ -1,4 +1,4 @@ -// META: global=window,dedicatedworker,shadowrealm +// META: global=window,dedicatedworker 'use strict'; diff --git a/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-stack-accessor.any.js b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-stack-accessor.any.js new file mode 100644 index 000000000000..24f6fd486bdc --- /dev/null +++ b/test/fixtures/wpt/webidl/ecmascript-binding/es-exceptions/DOMException-stack-accessor.any.js @@ -0,0 +1,80 @@ +// META: global=window,dedicatedworker + +// https://tc39.es/proposal-error-stack-accessor/ +// https://github.com/whatwg/webidl/pull/1421 + +"use strict"; + +test(() => { + const e = new DOMException("some message", "SyntaxError"); + assert_equals(typeof e.stack, "string", "stack must be a string"); +}, "new DOMException() has a stack property that is a string"); + +test(() => { + const e = new DOMException(); + assert_equals(typeof e.stack, "string", "stack must be a string"); +}, "new DOMException() with no arguments has a stack property that is a string"); + +if (typeof document !== "undefined") { + test(() => { + let caught; + try { + document.createElement(""); + } catch (e) { + caught = e; + } + assert_true(caught instanceof DOMException, "must be a DOMException"); + assert_equals(typeof caught.stack, "string", "stack must be a string"); + }, "thrown DOMException from DOM API has a stack property that is a string"); +} + +test(() => { + const e = new DOMException("some message", "SyntaxError"); + assert_false(e.hasOwnProperty("stack"), "stack must not be an own property of the instance"); +}, "DOMException instance does not have an own stack property"); + +test(() => { + assert_false(DOMException.prototype.hasOwnProperty("stack"), + "DOMException.prototype must not have an own stack property"); +}, "DOMException.prototype does not have an own stack property"); + +test(() => { + const desc = Object.getOwnPropertyDescriptor(Error.prototype, "stack"); + assert_not_equals(desc, undefined, "Error.prototype must have a stack property descriptor"); + assert_equals(typeof desc.get, "function", "stack must have a getter"); + assert_equals(typeof desc.set, "function", "stack must have a setter"); + assert_false(desc.enumerable, "stack must not be enumerable"); + assert_true(desc.configurable, "stack must be configurable"); +}, "Error.prototype.stack is an accessor property with correct attributes"); + +test(() => { + const getter = Object.getOwnPropertyDescriptor(Error.prototype, "stack").get; + const e = new DOMException("some message", "SyntaxError"); + const stack = getter.call(e); + assert_equals(typeof stack, "string", "getter must return a string for DOMException"); + assert_equals(stack, e.stack, "getter result must match e.stack"); +}, "Error.prototype.stack getter works on DOMException instances"); + +test(() => { + const setter = Object.getOwnPropertyDescriptor(Error.prototype, "stack").set; + const e = new DOMException("some message", "SyntaxError"); + setter.call(e, "custom stack"); + assert_true(e.hasOwnProperty("stack"), "after setter, stack must be an own property"); + assert_equals(e.stack, "custom stack", "own stack property must have the set value"); + + const desc = Object.getOwnPropertyDescriptor(e, "stack"); + assert_equals(desc.value, "custom stack", "must be a data property"); + assert_true(desc.writable, "must be writable"); + assert_true(desc.enumerable, "must be enumerable"); + assert_true(desc.configurable, "must be configurable"); +}, "Error.prototype.stack setter installs own data property on DOMException instances"); + +test(() => { + const setter = Object.getOwnPropertyDescriptor(Error.prototype, "stack").set; + // SetterThatIgnoresPrototypeProperties should not install a property on Error.prototype itself + const originalStack = Object.getOwnPropertyDescriptor(Error.prototype, "stack"); + setter.call(Error.prototype, "custom stack"); + const afterStack = Object.getOwnPropertyDescriptor(Error.prototype, "stack"); + assert_equals(typeof afterStack.get, "function", + "Error.prototype.stack must still be an accessor after calling setter on it"); +}, "Error.prototype.stack setter ignores Error.prototype itself"); diff --git a/test/fixtures/wpt/webidl/ecmascript-binding/global-mutable-prototype.any.js b/test/fixtures/wpt/webidl/ecmascript-binding/global-mutable-prototype.any.js deleted file mode 100644 index eba96e9adf46..000000000000 --- a/test/fixtures/wpt/webidl/ecmascript-binding/global-mutable-prototype.any.js +++ /dev/null @@ -1,27 +0,0 @@ -// META: global=shadowrealm -// META: title=Mutability of the global prototype chain - -const objects = []; -setup(() => { - for (let object = self; object; object = Object.getPrototypeOf(object)) { - objects.push(object); - } -}); - -test(() => { - for (const object of objects) { - const proto = Object.getPrototypeOf(object); - const plainObject = {}; - Object.setPrototypeOf(object, plainObject); - assert_equals(Object.getPrototypeOf(object), plainObject); - Object.setPrototypeOf(object, proto); - } -}, "Setting to a different prototype"); - -test(() => { - for (const object of objects) { - const expected = Object.getPrototypeOf(object); - Object.setPrototypeOf(object, expected); - assert_equals(Object.getPrototypeOf(object), expected); - } -}, "Setting to the same prototype"); diff --git a/test/fixtures/wpt/webidl/idlharness.any.js b/test/fixtures/wpt/webidl/idlharness.any.js index f8b285c485c4..164fa0e65c8d 100644 --- a/test/fixtures/wpt/webidl/idlharness.any.js +++ b/test/fixtures/wpt/webidl/idlharness.any.js @@ -1,6 +1,6 @@ // META: script=/resources/WebIDLParser.js // META: script=/resources/idlharness.js -// META: global=window,dedicatedworker,shadowrealm-in-window +// META: global=window,dedicatedworker "use strict"; diff --git a/test/wpt/status/webidl.json b/test/wpt/status/webidl.json index 73a89a373812..8dcbe1b247c8 100644 --- a/test/wpt/status/webidl.json +++ b/test/wpt/status/webidl.json @@ -6,6 +6,18 @@ ] } }, + "ecmascript-binding/es-exceptions/DOMException-stack-accessor.any.js": { + "fail": { + "note": "needs a V8 update, see https://github.com/nodejs/node/issues/63579", + "expected": [ + "DOMException instance does not have an own stack property", + "Error.prototype.stack is an accessor property with correct attributes", + "Error.prototype.stack getter works on DOMException instances", + "Error.prototype.stack setter installs own data property on DOMException instances", + "Error.prototype.stack setter ignores Error.prototype itself" + ] + } + }, "ecmascript-binding/global-immutable-prototype.any.js": { "fail": { "expected": [