Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url: make URL.parse enumerable #53720

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,12 @@ ObjectDefineProperties(URL, {
writable: true,
enumerable: true,
},
parse: {
__proto__: null,
configurable: true,
writable: true,
enumerable: true,
},
});

function installObjectURLMethods() {
Expand Down
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
Loading
Loading