Skip to content

Commit

Permalink
test: update WPT WebIDL interfaces
Browse files Browse the repository at this point in the history
PR-URL: #53720
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
panva authored and aduh95 committed Jul 16, 2024
1 parent 76032fd commit bc48090
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 32 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Last update:
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
- html/webappapis/structured-clone: https://github.com/web-platform-tests/wpt/tree/47d3fb280c/html/webappapis/structured-clone
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/5873f2d8f1/html/webappapis/timers
- interfaces: https://github.com/web-platform-tests/wpt/tree/727995f043/interfaces
- interfaces: https://github.com/web-platform-tests/wpt/tree/e90ece61d6/interfaces
- performance-timeline: https://github.com/web-platform-tests/wpt/tree/17ebc3aea0/performance-timeline
- resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing
- resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/wpt/interfaces/FileAPI.idl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface Blob {
[NewObject] ReadableStream stream();
[NewObject] Promise<USVString> text();
[NewObject] Promise<ArrayBuffer> arrayBuffer();
[NewObject] Promise<Uint8Array> bytes();
};

enum EndingType { "transparent", "native" };
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/interfaces/WebCryptoAPI.idl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ interface SubtleCrypto {
sequence<KeyUsage> keyUsages );
Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm,
CryptoKey baseKey,
unsigned long length);
optional unsigned long? length = null);

Promise<CryptoKey> importKey(KeyFormat format,
(BufferSource or JsonWebKey) keyData,
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/interfaces/compression.idl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: Compression Streams (https://wicg.github.io/compression/)
// Source: Compression Standard (https://compression.spec.whatwg.org/)

enum CompressionFormat {
"deflate",
Expand Down
16 changes: 10 additions & 6 deletions test/fixtures/wpt/interfaces/dom.idl
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ interface mixin ParentNode {
readonly attribute Element? lastElementChild;
readonly attribute unsigned long childElementCount;

[CEReactions, Unscopable] undefined prepend((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined append((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceChildren((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined prepend((Node or TrustedScript or DOMString)... nodes);
[CEReactions, Unscopable] undefined append((Node or TrustedScript or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceChildren((Node or TrustedScript or DOMString)... nodes);

Element? querySelector(DOMString selectors);
[NewObject] NodeList querySelectorAll(DOMString selectors);
Expand All @@ -139,9 +139,9 @@ Element includes NonDocumentTypeChildNode;
CharacterData includes NonDocumentTypeChildNode;

interface mixin ChildNode {
[CEReactions, Unscopable] undefined before((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined after((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined before((Node or TrustedScript or DOMString)... nodes);
[CEReactions, Unscopable] undefined after((Node or TrustedScript or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceWith((Node or TrustedScript or DOMString)... nodes);
[CEReactions, Unscopable] undefined remove();
};
DocumentType includes ChildNode;
Expand Down Expand Up @@ -339,6 +339,8 @@ interface ShadowRoot : DocumentFragment {
readonly attribute ShadowRootMode mode;
readonly attribute boolean delegatesFocus;
readonly attribute SlotAssignmentMode slotAssignment;
readonly attribute boolean clonable;
readonly attribute boolean serializable;
readonly attribute Element host;
attribute EventHandler onslotchange;
};
Expand Down Expand Up @@ -396,6 +398,8 @@ dictionary ShadowRootInit {
required ShadowRootMode mode;
boolean delegatesFocus = false;
SlotAssignmentMode slotAssignment = "named";
boolean clonable = false;
boolean serializable = false;
};

[Exposed=Window,
Expand Down
130 changes: 119 additions & 11 deletions test/fixtures/wpt/interfaces/html.idl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;

[LegacyOverrideBuiltIns]
partial interface Document {
static Document parseHTMLUnsafe((TrustedHTML or DOMString) html);

// resource metadata management
[PutForwards=href, LegacyUnforgeable] readonly attribute Location? location;
attribute USVString domain;
Expand Down Expand Up @@ -75,8 +77,8 @@ partial interface Document {
[CEReactions] Document open(optional DOMString unused1, optional DOMString unused2); // both arguments are ignored
WindowProxy? open(USVString url, DOMString name, DOMString features);
[CEReactions] undefined close();
[CEReactions] undefined write(DOMString... text);
[CEReactions] undefined writeln(DOMString... text);
[CEReactions] undefined write((TrustedHTML or DOMString)... text);
[CEReactions] undefined writeln((TrustedHTML or DOMString)... text);

// user interaction
readonly attribute WindowProxy? defaultView;
Expand Down Expand Up @@ -121,6 +123,7 @@ interface HTMLElement : Element {
readonly attribute DOMString accessKeyLabel;
[CEReactions] attribute boolean draggable;
[CEReactions] attribute boolean spellcheck;
[CEReactions] attribute DOMString writingSuggestions;
[CEReactions] attribute DOMString autocapitalize;

[CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
Expand Down Expand Up @@ -449,7 +452,7 @@ interface HTMLIFrameElement : HTMLElement {
[HTMLConstructor] constructor();

[CEReactions] attribute USVString src;
[CEReactions] attribute DOMString srcdoc;
[CEReactions] attribute (TrustedHTML or DOMString) srcdoc;
[CEReactions] attribute DOMString name;
[SameObject, PutForwards=value] readonly attribute DOMTokenList sandbox;
[CEReactions] attribute DOMString allow;
Expand Down Expand Up @@ -999,6 +1002,8 @@ interface HTMLSelectElement : HTMLElement {
boolean reportValidity();
undefined setCustomValidity(DOMString error);

undefined showPicker();

readonly attribute NodeList labels;
};

Expand Down Expand Up @@ -1196,6 +1201,7 @@ dictionary FormDataEventInit : EventInit {
interface HTMLDetailsElement : HTMLElement {
[HTMLConstructor] constructor();

[CEReactions] attribute DOMString name;
[CEReactions] attribute boolean open;
};

Expand Down Expand Up @@ -1236,6 +1242,10 @@ interface HTMLTemplateElement : HTMLElement {
[HTMLConstructor] constructor();

readonly attribute DocumentFragment content;
[CEReactions] attribute DOMString shadowRootMode;
[CEReactions] attribute boolean shadowRootDelegatesFocus;
[CEReactions] attribute boolean shadowRootClonable;
[CEReactions] attribute boolean shadowRootSerializable;
};

[Exposed=Window]
Expand Down Expand Up @@ -1570,7 +1580,6 @@ interface OffscreenCanvas : EventTarget {

[Exposed=(Window,Worker)]
interface OffscreenCanvasRenderingContext2D {
undefined commit();
readonly attribute OffscreenCanvas canvas;
};

Expand Down Expand Up @@ -1626,6 +1635,9 @@ interface ElementInternals {
boolean reportValidity();

readonly attribute NodeList labels;

// Custom state pseudo-class
[SameObject] readonly attribute CustomStateSet states;
};

// Accessibility semantics
Expand All @@ -1644,6 +1656,11 @@ dictionary ValidityStateFlags {
boolean customError = false;
};

[Exposed=Window]
interface CustomStateSet {
setlike<DOMString>;
};

[Exposed=(Window)]
interface VisibilityStateEntry : PerformanceEntry {
readonly attribute DOMString name; // shadows inherited name
Expand Down Expand Up @@ -1686,6 +1703,22 @@ interface mixin ElementContentEditable {
[CEReactions] attribute DOMString inputMode;
};

[Exposed=Window]
interface CloseWatcher : EventTarget {
constructor(optional CloseWatcherOptions options = {});

undefined requestClose();
undefined close();
undefined destroy();

attribute EventHandler oncancel;
attribute EventHandler onclose;
};

dictionary CloseWatcherOptions {
AbortSignal signal;
};

[Exposed=Window]
interface DataTransfer {
constructor();
Expand Down Expand Up @@ -1849,6 +1882,7 @@ interface Navigation : EventTarget {
readonly attribute NavigationHistoryEntry? currentEntry;
undefined updateCurrentEntry(NavigationUpdateCurrentEntryOptions options);
readonly attribute NavigationTransition? transition;
readonly attribute NavigationActivation? activation;

readonly attribute boolean canGoBack;
readonly attribute boolean canGoForward;
Expand Down Expand Up @@ -1921,6 +1955,13 @@ interface NavigationTransition {
readonly attribute Promise<undefined> finished;
};

[Exposed=Window]
interface NavigationActivation {
readonly attribute NavigationHistoryEntry? from;
readonly attribute NavigationHistoryEntry entry;
readonly attribute NavigationType navigationType;
};

[Exposed=Window]
interface NavigateEvent : Event {
constructor(DOMString type, NavigateEventInit eventInitDict);
Expand Down Expand Up @@ -2021,6 +2062,28 @@ dictionary HashChangeEventInit : EventInit {
USVString newURL = "";
};

[Exposed=Window]
interface PageSwapEvent : Event {
constructor(DOMString type, optional PageSwapEventInit eventInitDict = {});
readonly attribute NavigationActivation? activation;
readonly attribute ViewTransition? viewTransition;
};

dictionary PageSwapEventInit : EventInit {
NavigationActivation? activation = null;
ViewTransition? viewTransition = null;
};

[Exposed=Window]
interface PageRevealEvent : Event {
constructor(DOMString type, optional PageRevealEventInit eventInitDict = {});
readonly attribute ViewTransition? viewTransition;
};

dictionary PageRevealEventInit : EventInit {
ViewTransition? viewTransition = null;
};

[Exposed=Window]
interface PageTransitionEvent : Event {
constructor(DOMString type, optional PageTransitionEventInit eventInitDict = {});
Expand All @@ -2037,6 +2100,23 @@ interface BeforeUnloadEvent : Event {
attribute DOMString returnValue;
};

[Exposed=Window]
interface NotRestoredReasonDetails {
readonly attribute DOMString reason;
[Default] object toJSON();
};

[Exposed=Window]
interface NotRestoredReasons {
readonly attribute DOMString? src;
readonly attribute DOMString? id;
readonly attribute DOMString? name;
readonly attribute DOMString? url;
readonly attribute FrozenArray<NotRestoredReasonDetails>? reasons;
readonly attribute FrozenArray<NotRestoredReasons>? children;
[Default] object toJSON();
};

[Exposed=*]
interface ErrorEvent : Event {
constructor(DOMString type, optional ErrorEventInit eventInitDict = {});
Expand All @@ -2060,12 +2140,12 @@ dictionary ErrorEventInit : EventInit {
interface PromiseRejectionEvent : Event {
constructor(DOMString type, PromiseRejectionEventInit eventInitDict);

readonly attribute Promise<any> promise;
readonly attribute object promise;
readonly attribute any reason;
};

dictionary PromiseRejectionEventInit : EventInit {
required Promise<any> promise;
required object promise;
any reason;
};

Expand Down Expand Up @@ -2170,15 +2250,17 @@ interface mixin WindowEventHandlers {
attribute EventHandler onoffline;
attribute EventHandler ononline;
attribute EventHandler onpagehide;
attribute EventHandler onpagereveal;
attribute EventHandler onpageshow;
attribute EventHandler onpageswap;
attribute EventHandler onpopstate;
attribute EventHandler onrejectionhandled;
attribute EventHandler onstorage;
attribute EventHandler onunhandledrejection;
attribute EventHandler onunload;
};

typedef (DOMString or Function) TimerHandler;
typedef (DOMString or Function or TrustedScript) TimerHandler;

interface mixin WindowOrWorkerGlobalScope {
[Replaceable] readonly attribute USVString origin;
Expand Down Expand Up @@ -2210,11 +2292,32 @@ interface mixin WindowOrWorkerGlobalScope {
Window includes WindowOrWorkerGlobalScope;
WorkerGlobalScope includes WindowOrWorkerGlobalScope;

partial interface Element {
[CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html);
DOMString getHTML(optional GetHTMLOptions options = {});

[CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML;
[CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) outerHTML;
[CEReactions] undefined insertAdjacentHTML(DOMString position, (TrustedHTML or DOMString) string);
};

partial interface ShadowRoot {
[CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html);
DOMString getHTML(optional GetHTMLOptions options = {});

[CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML;
};

dictionary GetHTMLOptions {
boolean serializableShadowRoots = false;
sequence<ShadowRoot> shadowRoots = [];
};

[Exposed=Window]
interface DOMParser {
constructor();

[NewObject] Document parseFromString(DOMString string, DOMParserSupportedType type);
[NewObject] Document parseFromString((TrustedHTML or DOMString) string, DOMParserSupportedType type);
};

enum DOMParserSupportedType {
Expand All @@ -2225,6 +2328,10 @@ enum DOMParserSupportedType {
"image/svg+xml"
};

partial interface Range {
[CEReactions, NewObject] DocumentFragment createContextualFragment((TrustedHTML or DOMString) string);
};

[Exposed=Window]
interface Navigator {
// objects implementing this interface also implement the interfaces given below
Expand Down Expand Up @@ -2414,6 +2521,7 @@ interface MessagePort : EventTarget {
// event handlers
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
attribute EventHandler onclose;
};

dictionary StructuredSerializeOptions {
Expand All @@ -2436,7 +2544,7 @@ interface WorkerGlobalScope : EventTarget {
readonly attribute WorkerGlobalScope self;
readonly attribute WorkerLocation location;
readonly attribute WorkerNavigator navigator;
undefined importScripts(USVString... urls);
undefined importScripts((TrustedScriptURL or USVString)... urls);

attribute OnErrorEventHandler onerror;
attribute EventHandler onlanguagechange;
Expand Down Expand Up @@ -2474,7 +2582,7 @@ interface mixin AbstractWorker {

[Exposed=(Window,DedicatedWorker,SharedWorker)]
interface Worker : EventTarget {
constructor(USVString scriptURL, optional WorkerOptions options = {});
constructor((TrustedScriptURL or USVString) scriptURL, optional WorkerOptions options = {});

undefined terminate();

Expand All @@ -2496,7 +2604,7 @@ Worker includes AbstractWorker;

[Exposed=Window]
interface SharedWorker : EventTarget {
constructor(USVString scriptURL, optional (DOMString or WorkerOptions) options = {});
constructor((TrustedScriptURL or USVString) scriptURL, optional (DOMString or WorkerOptions) options = {});

readonly attribute MessagePort port;
};
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/wpt/interfaces/performance-timeline.idl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ typedef sequence<PerformanceEntry> PerformanceEntryList;

[Exposed=(Window,Worker)]
interface PerformanceEntry {
readonly attribute unsigned long long id;
readonly attribute DOMString name;
readonly attribute DOMString entryType;
readonly attribute DOMHighResTimeStamp startTime;
readonly attribute DOMHighResTimeStamp duration;
readonly attribute unsigned long long navigationId;
[Default] object toJSON();
};

Expand Down
Loading

0 comments on commit bc48090

Please sign in to comment.