2021-01-28 15:37:21 -05:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
2021-12-09 17:12:21 -05:00
|
|
|
// deno-lint-ignore-file no-var
|
|
|
|
|
2021-01-28 15:37:21 -05:00
|
|
|
/// <reference no-default-lib="true" />
|
|
|
|
/// <reference lib="esnext" />
|
|
|
|
|
|
|
|
declare namespace globalThis {
|
|
|
|
declare namespace __bootstrap {
|
2021-04-08 09:05:08 -04:00
|
|
|
declare var infra: {
|
|
|
|
collectSequenceOfCodepoints(
|
|
|
|
input: string,
|
|
|
|
position: number,
|
|
|
|
condition: (char: string) => boolean,
|
|
|
|
): {
|
|
|
|
result: string;
|
|
|
|
position: number;
|
|
|
|
};
|
2021-04-18 19:00:13 -04:00
|
|
|
ASCII_DIGIT: string[];
|
|
|
|
ASCII_UPPER_ALPHA: string[];
|
|
|
|
ASCII_LOWER_ALPHA: string[];
|
|
|
|
ASCII_ALPHA: string[];
|
|
|
|
ASCII_ALPHANUMERIC: string[];
|
|
|
|
HTTP_TAB_OR_SPACE: string[];
|
|
|
|
HTTP_WHITESPACE: string[];
|
|
|
|
HTTP_TOKEN_CODE_POINT: string[];
|
|
|
|
HTTP_TOKEN_CODE_POINT_RE: RegExp;
|
|
|
|
HTTP_QUOTED_STRING_TOKEN_POINT: string[];
|
|
|
|
HTTP_QUOTED_STRING_TOKEN_POINT_RE: RegExp;
|
2021-04-20 08:47:22 -04:00
|
|
|
HTTP_TAB_OR_SPACE_PREFIX_RE: RegExp;
|
|
|
|
HTTP_TAB_OR_SPACE_SUFFIX_RE: RegExp;
|
2021-04-18 19:00:13 -04:00
|
|
|
HTTP_WHITESPACE_PREFIX_RE: RegExp;
|
|
|
|
HTTP_WHITESPACE_SUFFIX_RE: RegExp;
|
2021-09-30 12:39:55 -04:00
|
|
|
httpTrim(s: string): string;
|
2021-04-18 19:00:13 -04:00
|
|
|
regexMatcher(chars: string[]): string;
|
|
|
|
byteUpperCase(s: string): string;
|
|
|
|
byteLowerCase(s: string): string;
|
2021-04-20 08:47:22 -04:00
|
|
|
collectHttpQuotedString(
|
|
|
|
input: string,
|
|
|
|
position: number,
|
|
|
|
extractValue: boolean,
|
|
|
|
): {
|
|
|
|
result: string;
|
|
|
|
position: number;
|
|
|
|
};
|
2021-06-05 17:10:07 -04:00
|
|
|
forgivingBase64Encode(data: Uint8Array): string;
|
|
|
|
forgivingBase64Decode(data: string): Uint8Array;
|
2021-04-08 09:05:08 -04:00
|
|
|
};
|
|
|
|
|
2021-07-03 15:32:28 -04:00
|
|
|
declare var domException: {
|
|
|
|
DOMException: typeof DOMException;
|
|
|
|
};
|
|
|
|
|
2021-04-18 19:00:13 -04:00
|
|
|
declare namespace mimesniff {
|
|
|
|
declare interface MimeType {
|
2021-04-08 09:05:08 -04:00
|
|
|
type: string;
|
|
|
|
subtype: string;
|
|
|
|
parameters: Map<string, string>;
|
2021-04-18 19:00:13 -04:00
|
|
|
}
|
|
|
|
declare function parseMimeType(input: string): MimeType | null;
|
2021-04-20 08:47:22 -04:00
|
|
|
declare function essence(mimeType: MimeType): string;
|
|
|
|
declare function serializeMimeType(mimeType: MimeType): string;
|
2021-04-18 19:00:13 -04:00
|
|
|
}
|
2021-04-08 09:05:08 -04:00
|
|
|
|
2021-03-01 05:31:13 -05:00
|
|
|
declare var eventTarget: {
|
|
|
|
EventTarget: typeof EventTarget;
|
|
|
|
};
|
|
|
|
|
2021-01-28 15:37:21 -05:00
|
|
|
declare var location: {
|
|
|
|
getLocationHref(): string | undefined;
|
|
|
|
};
|
2021-04-06 06:55:05 -04:00
|
|
|
|
|
|
|
declare var base64: {
|
2021-06-05 17:10:07 -04:00
|
|
|
atob(data: string): string;
|
|
|
|
btoa(data: string): string;
|
2021-04-06 06:55:05 -04:00
|
|
|
};
|
2021-06-10 09:26:10 -04:00
|
|
|
|
|
|
|
declare var file: {
|
fix: a `Request` whose URL is a revoked blob URL should still fetch (#11947)
In the spec, a URL record has an associated "blob URL entry", which for
`blob:` URLs is populated during parsing to contain a reference to the
`Blob` object that backs that object URL. It is this blob URL entry that
the `fetch` API uses to resolve an object URL.
Therefore, since the `Request` constructor parses URL inputs, it will
have an associated blob URL entry which will be used when fetching, even
if the object URL has been revoked since the construction of the
`Request` object. (The `Request` constructor takes the URL as a string
and parses it, so the object URL must be live at the time it is called.)
This PR adds a new `blobFromObjectUrl` JS function (backed by a new
`op_blob_from_object_url` op) that, if the URL is a valid object URL,
returns a new `Blob` object whose parts are references to the same Rust
`BlobPart`s used by the original `Blob` object. It uses this function to
add a new `blobUrlEntry` field to inner requests, which will be `null`
or such a `Blob`, and then uses `Blob.prototype.stream()` as the
response's body. As a result of this, the `blob:` URL resolution from
`op_fetch` is now useless, and has been removed.
2021-09-08 05:29:21 -04:00
|
|
|
blobFromObjectUrl(url: string): Blob | null;
|
2021-07-05 09:34:37 -04:00
|
|
|
getParts(blob: Blob): string[];
|
|
|
|
Blob: typeof Blob;
|
|
|
|
File: typeof File;
|
2021-06-10 09:26:10 -04:00
|
|
|
};
|
2021-06-14 07:51:02 -04:00
|
|
|
|
|
|
|
declare var streams: {
|
|
|
|
ReadableStream: typeof ReadableStream;
|
|
|
|
isReadableStreamDisturbed(stream: ReadableStream): boolean;
|
2021-06-23 10:00:23 -04:00
|
|
|
createProxy<T>(stream: ReadableStream<T>): ReadableStream<T>;
|
2021-06-14 07:51:02 -04:00
|
|
|
};
|
2021-06-21 13:53:52 -04:00
|
|
|
|
|
|
|
declare namespace messagePort {
|
|
|
|
declare type Transferable = {
|
|
|
|
kind: "messagePort";
|
|
|
|
data: number;
|
2021-08-25 07:48:53 -04:00
|
|
|
} | {
|
|
|
|
kind: "arrayBuffer";
|
|
|
|
data: number;
|
2021-06-21 13:53:52 -04:00
|
|
|
};
|
|
|
|
declare interface MessageData {
|
|
|
|
data: Uint8Array;
|
|
|
|
transferables: Transferable[];
|
|
|
|
}
|
|
|
|
}
|
2021-01-28 15:37:21 -05:00
|
|
|
}
|
|
|
|
}
|