mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: bump WPT webidl and interfaces
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65679 Refs: https://github.com/nodejs/node/issues/63579 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
d30df2a3e1
commit
ce7b349de5
20 files changed
+255
-66
No files matched your search
+1
@@ -20,6 +20,7 @@ interface Blob {
|
||||
[NewObject] ReadableStream stream();
|
||||
[NewObject] Promise<USVString> text();
|
||||
[NewObject] Promise<ArrayBuffer> arrayBuffer();
|
||||
[NewObject] ReadableStream textStream();
|
||||
[NewObject] Promise<Uint8Array> bytes();
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// Source: Compression Standard (https://compression.spec.whatwg.org/)
|
||||
|
||||
enum CompressionFormat {
|
||||
"brotli",
|
||||
"deflate",
|
||||
"deflate-raw",
|
||||
"gzip",
|
||||
|
||||
Vendored
+14
-4
@@ -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<DOMString> 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 {
|
||||
|
||||
+94
-12
@@ -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<ShadowRoot> 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<SanitizerAttribute> attributes;
|
||||
sequence<SanitizerAttribute> 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<SanitizerElementWithAttributes> elements;
|
||||
sequence<SanitizerElement> removeElements;
|
||||
sequence<SanitizerElement> replaceWithChildrenElements;
|
||||
|
||||
sequence<SanitizerPI> processingInstructions;
|
||||
sequence<SanitizerPI> removeProcessingInstructions;
|
||||
|
||||
sequence<SanitizerAttribute> attributes;
|
||||
sequence<SanitizerAttribute> removeAttributes;
|
||||
|
||||
boolean comments;
|
||||
boolean dataAttributes;
|
||||
};
|
||||
|
||||
[Exposed=Window]
|
||||
interface Navigator {
|
||||
// objects implementing this interface also implement the interfaces given below
|
||||
|
||||
+5
-4
@@ -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;
|
||||
};
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
interface ReadableStream {
|
||||
constructor(optional object underlyingSource, optional QueuingStrategy strategy = {});
|
||||
|
||||
static ReadableStream from(any asyncIterable);
|
||||
static ReadableStream from(async_sequence<any> 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);
|
||||
|
||||
+2
-2
@@ -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<any> 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;
|
||||
|
||||
+3
-3
@@ -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 {
|
||||
|
||||
+4
-4
@@ -79,7 +79,7 @@ interface SubtleCrypto {
|
||||
Promise<ArrayBuffer> deriveBits(
|
||||
AlgorithmIdentifier algorithm,
|
||||
CryptoKey baseKey,
|
||||
optional unsigned long? length = null
|
||||
optional [EnforceRange] unsigned long? length = null
|
||||
);
|
||||
|
||||
Promise<CryptoKey> 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 {
|
||||
|
||||
Vendored
+2
-2
@@ -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": {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>WebIDL [AllowShared] semantics</title>
|
||||
<link rel="help" href="https://webidl.spec.whatwg.org/#AllowShared">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/sab.js"></script>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
test(t => {
|
||||
// Create a standard SharedArrayBuffer (safe even without COOP/COEP headers)
|
||||
const sab = createBuffer('SharedArrayBuffer', 128);
|
||||
const arr = new Uint8Array(sab);
|
||||
arr.fill(42);
|
||||
assert_equals(sab.constructor.name, 'SharedArrayBuffer');
|
||||
new ImageDecoder({
|
||||
data: arr,
|
||||
// We don't really need encoding to succeed, just for argument conversion before the native call.
|
||||
type: "invalid"
|
||||
});
|
||||
|
||||
assert_throws_js(TypeError, () => {
|
||||
new MIDIMessageEvent('message', { data: arr });
|
||||
}, "An attempt to pass a view backed by a shared array buffer should throw");
|
||||
|
||||
}, "APIs without [AllowShared] do not accept SharedArrayBuffer-backed views with pre-existing wrapper");
|
||||
|
||||
</script>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: global=window,dedicatedworker
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: global=window,dedicatedworker
|
||||
|
||||
test(function() {
|
||||
assert_own_property(self, "DOMException", "property of global");
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: global=window,dedicatedworker
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: global=window,dedicatedworker
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: global=window,dedicatedworker
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
Vendored
+80
@@ -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");
|
||||
@@ -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");
|
||||
+1
-1
@@ -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";
|
||||
|
||||
|
||||
@@ -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": [
|
||||
|
||||
Reference in new issue
Block a user