Skip to content

feat: add serviceworker and sharedworker libs #997

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

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
93 changes: 81 additions & 12 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/////////////////////////////
/// DOM APIs
/// Window APIs
/////////////////////////////

interface AddEventListenerOptions extends EventListenerOptions {
Expand Down Expand Up @@ -1578,7 +1578,7 @@ interface RequestInit {
*/
cache?: RequestCache;
/**
* A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials.
* A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL — as well as whether any credentials sent back in the response will be used always, never, or only when received from a same-origin URL. Sets request's credentials. If input is a string, it defaults to "same-origin".
*/
credentials?: RequestCredentials;
/**
Expand All @@ -1598,7 +1598,7 @@ interface RequestInit {
*/
method?: string;
/**
* A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode.
* A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. If input is a string, it defaults to "cors".
*/
mode?: RequestMode;
/**
Expand Down Expand Up @@ -2560,12 +2560,33 @@ declare var Blob: {
};

interface Body {
/**
* Returns requestOrResponse's body as ReadableStream.
*/
readonly body: ReadableStream<Uint8Array> | null;
/**
* Returns whether requestOrResponse's body has been read from.
*/
readonly bodyUsed: boolean;
/**
* Returns a promise fulfilled with requestOrResponse's body as ArrayBuffer.
*/
arrayBuffer(): Promise<ArrayBuffer>;
/**
* Returns a promise fulfilled with requestOrResponse's body as Blob.
*/
blob(): Promise<Blob>;
/**
* Returns a promise fulfilled with requestOrResponse's body as FormData.
*/
formData(): Promise<FormData>;
/**
* Returns a promise fulfilled with requestOrResponse's body parsed as JSON.
*/
json(): Promise<any>;
/**
* Returns a promise fulfilled with requestOrResponse's body as string.
*/
text(): Promise<string>;
}

Expand Down Expand Up @@ -8981,10 +9002,25 @@ declare var HashChangeEvent: {

/** This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */
interface Headers {
/**
* Appends a header to headers.
*/
append(name: string, value: string): void;
/**
* Removes a header from headers.
*/
delete(name: string): void;
/**
* Returns as a string the values of all headers whose name is name, separated by a comma and a space.
*/
get(name: string): string | null;
/**
* Returns whether there is a header whose name is name.
*/
has(name: string): boolean;
/**
* Replaces the value of the first header whose name is name with value and removes any remaining headers whose name is name.
*/
set(name: string, value: string): void;
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
}
Expand Down Expand Up @@ -12497,6 +12533,9 @@ interface Request extends Body {
* Returns the URL of request as a string.
*/
readonly url: string;
/**
* Returns a clone of request.
*/
clone(): Request;
}

Expand Down Expand Up @@ -12540,21 +12579,50 @@ declare var ResizeObserverSize: {

/** This Fetch API interface represents the response to a request. */
interface Response extends Body {
/**
* Returns response's headers as Headers.
*/
readonly headers: Headers;
/**
* Returns whether response's status is an ok status.
*/
readonly ok: boolean;
/**
* Returns whether response was obtained through a redirect.
*/
readonly redirected: boolean;
/**
* Returns response's status.
*/
readonly status: number;
/**
* Returns response's status message.
*/
readonly statusText: string;
readonly trailer: Promise<Headers>;
/**
* Returns response's type, e.g., "cors".
*/
readonly type: ResponseType;
/**
* Returns response's URL, if it has one; otherwise the empty string.
*/
readonly url: string;
/**
* Returns a clone of response.
*/
clone(): Response;
}

declare var Response: {
prototype: Response;
new(body?: BodyInit | null, init?: ResponseInit): Response;
/**
* Creates network error Response.
*/
error(): Response;
/**
* Creates a redirect Response that redirects to url with status status.
*/
redirect(url: string, status?: number): Response;
};

Expand Down Expand Up @@ -18490,11 +18558,11 @@ interface XMLHttpRequest extends XMLHttpRequestEventTarget {
*/
readonly readyState: number;
/**
* Returns the response's body.
* Returns the response body.
*/
readonly response: any;
/**
* Returns the text response.
* Returns response as text.
*
* Throws an "InvalidStateError" DOMException if responseType is not the empty string or "text".
*/
Expand All @@ -18513,15 +18581,15 @@ interface XMLHttpRequest extends XMLHttpRequestEventTarget {
responseType: XMLHttpRequestResponseType;
readonly responseURL: string;
/**
* Returns the document response.
* Returns the response as document.
*
* Throws an "InvalidStateError" DOMException if responseType is not the empty string or "document".
*/
readonly responseXML: Document | null;
readonly status: number;
readonly statusText: string;
/**
* Can be set to a time in milliseconds. When set to a non-zero value will cause fetching to terminate after the given time has passed. When the time has passed, the request has not yet completed, and the synchronous flag is unset, a timeout event will then be dispatched, or a "TimeoutError" DOMException will be thrown otherwise (for the send() method).
* Can be set to a time in milliseconds. When set to a non-zero value will cause fetching to terminate after the given time has passed. When the time has passed, the request has not yet completed, and this's synchronous flag is unset, a timeout event will then be dispatched, or a "TimeoutError" DOMException will be thrown otherwise (for the send() method).
*
* When set: throws an "InvalidAccessError" DOMException if the synchronous flag is set and current global object is a Window object.
*/
Expand All @@ -18545,7 +18613,7 @@ interface XMLHttpRequest extends XMLHttpRequestEventTarget {
/**
* Sets the request method, request URL, and synchronous flag.
*
* Throws a "SyntaxError" DOMException if either method is not a valid HTTP method or url cannot be parsed.
* Throws a "SyntaxError" DOMException if either method is not a valid method or url cannot be parsed.
*
* Throws a "SecurityError" DOMException if method is a case-insensitive match for `CONNECT`, `TRACE`, or `TRACK`.
*
Expand All @@ -18554,7 +18622,7 @@ interface XMLHttpRequest extends XMLHttpRequestEventTarget {
open(method: string, url: string): void;
open(method: string, url: string, async: boolean, username?: string | null, password?: string | null): void;
/**
* Acts as if the `Content-Type` header value for response is mime. (It does not actually change the header though.)
* Acts as if the `Content-Type` header value for a response is mime. (It does not change the header.)
*
* Throws an "InvalidStateError" DOMException if state is loading or done.
*/
Expand All @@ -18564,7 +18632,7 @@ interface XMLHttpRequest extends XMLHttpRequestEventTarget {
*
* Throws an "InvalidStateError" DOMException if either state is not opened or the send() flag is set.
*/
send(body?: Document | BodyInit | null): void;
send(body?: Document | XMLHttpRequestBodyInit | null): void;
/**
* Combines a header in author request headers.
*
Expand Down Expand Up @@ -19650,6 +19718,7 @@ declare function addEventListener(type: string, listener: EventListenerOrEventLi
declare function removeEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
type HeadersInit = Headers | string[][] | Record<string, string>;
type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string;
type BodyInit = Blob | BufferSource | FormData | URLSearchParams | ReadableStream<Uint8Array> | string;
type RequestInfo = Request | string;
type BlobPart = BufferSource | Blob | string;
Expand Down Expand Up @@ -19820,7 +19889,7 @@ type ReadyState = "closed" | "ended" | "open";
type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
type RequestCredentials = "include" | "omit" | "same-origin";
type RequestDestination = "" | "audio" | "audioworklet" | "document" | "embed" | "font" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt";
type RequestDestination = "" | "audio" | "audioworklet" | "document" | "embed" | "font" | "frame" | "iframe" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt";
type RequestMode = "cors" | "navigate" | "no-cors" | "same-origin";
type RequestRedirect = "error" | "follow" | "manual";
type ResidentKeyRequirement = "discouraged" | "preferred" | "required";
Expand Down
2 changes: 1 addition & 1 deletion baselines/dom.iterable.generated.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/////////////////////////////
/// DOM Iterable APIs
/// Window Iterable APIs
/////////////////////////////

interface AudioParam {
Expand Down
Loading