Skip to content

Add URL types #450

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

Merged
merged 1 commit into from
Apr 23, 2018
Merged
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
9 changes: 7 additions & 2 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13972,7 +13972,7 @@ interface URL {
search: string;
readonly searchParams: URLSearchParams;
username: string;
toString(): string;
toJSON(): string;
}

declare var URL: {
Expand All @@ -13982,6 +13982,9 @@ declare var URL: {
revokeObjectURL(url: string): void;
};

type webkitURL = URL;
declare var webkitURL: typeof URL;

interface URLSearchParams {
/**
* Appends a specified key/value pair as a new search parameter.
Expand All @@ -14007,11 +14010,13 @@ interface URLSearchParams {
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
*/
set(name: string, value: string): void;
sort(): void;
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
}

declare var URLSearchParams: {
prototype: URLSearchParams;
new (init?: string | URLSearchParams): URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
};

interface VRDisplay extends EventTarget {
Expand Down
6 changes: 4 additions & 2 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ interface URL {
search: string;
readonly searchParams: URLSearchParams;
username: string;
toString(): string;
toJSON(): string;
}

declare var URL: {
Expand Down Expand Up @@ -1487,11 +1487,13 @@ interface URLSearchParams {
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
*/
set(name: string, value: string): void;
sort(): void;
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
}

declare var URLSearchParams: {
prototype: URLSearchParams;
new (init?: string | URLSearchParams): URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
};

interface WebSocketEventMap {
Expand Down
51 changes: 1 addition & 50 deletions inputfiles/addedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,63 +469,14 @@
},
"URLSearchParams": {
"name": "URLSearchParams",
"methods": {
"method": {
"append": {
"name": "append",
"override-signatures": [
"append(name: string, value: string): void"
]
},
"delete": {
"name": "delete",
"override-signatures": [
"delete(name: string): void"
]
},
"get": {
"name": "get",
"override-signatures": [
"get(name: string): string | null"
]
},
"getAll": {
"name": "getAll",
"override-signatures": [
"getAll(name: string): string[]"
]
},
"has": {
"name": "has",
"override-signatures": [
"has(name: string): boolean"
]
},
"set": {
"name": "set",
"override-signatures": [
"set(name: string, value: string): void"
]
}
}
},
"constructor": {
"override-signatures": [
"new (init?: string | URLSearchParams): URLSearchParams"
"new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams"
]
}
},
"URL": {
"name": "URL",
"properties": {
"property": {
"searchParams": {
"name": "searchParams",
"read-only": 1,
"override-type": "URLSearchParams"
}
}
},
"methods": {
"method": {
"createObjectURL": {
Expand Down
35 changes: 35 additions & 0 deletions inputfiles/idl/URL.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[Constructor(USVString url, optional USVString base),
Exposed=(Window,Worker),
LegacyWindowAlias=webkitURL]
interface URL {
stringifier attribute USVString href;
readonly attribute USVString origin;
attribute USVString protocol;
attribute USVString username;
attribute USVString password;
attribute USVString host;
attribute USVString hostname;
attribute USVString port;
attribute USVString pathname;
attribute USVString search;
[SameObject] readonly attribute URLSearchParams searchParams;
attribute USVString hash;

USVString toJSON();
};

[Constructor(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = ""),
Exposed=(Window,Worker)]
interface URLSearchParams {
void append(USVString name, USVString value);
void delete(USVString name);
USVString? get(USVString name);
sequence<USVString> getAll(USVString name);
boolean has(USVString name);
void set(USVString name, USVString value);

void sort();

iterable<USVString, USVString>;
stringifier;
};
4 changes: 4 additions & 0 deletions inputfiles/idlSources.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
"url": "https://w3c.github.io/touch-events/",
"title": "Touch Events"
},
{
"url": "https://url.spec.whatwg.org/",
"title": "URL"
},
{
"url": "https://www.w3.org/TR/user-timing-2/",
"title": "User Timing"
Expand Down