mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
refactor: update runtime code for primordial checks for "instanceof" (#13497)
This commit is contained in:
parent
dcf8f144ab
commit
884143218f
41 changed files with 1030 additions and 660 deletions
|
@ -195,6 +195,7 @@
|
||||||
this.name = "BadResource";
|
this.name = "BadResource";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const BadResourcePrototype = BadResource.prototype;
|
||||||
|
|
||||||
class Interrupted extends Error {
|
class Interrupted extends Error {
|
||||||
constructor(msg) {
|
constructor(msg) {
|
||||||
|
@ -202,6 +203,7 @@
|
||||||
this.name = "Interrupted";
|
this.name = "Interrupted";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const InterruptedPrototype = Interrupted.prototype;
|
||||||
|
|
||||||
// Extra Deno.core.* exports
|
// Extra Deno.core.* exports
|
||||||
const core = ObjectAssign(globalThis.Deno.core, {
|
const core = ObjectAssign(globalThis.Deno.core, {
|
||||||
|
@ -221,7 +223,9 @@
|
||||||
opresolve,
|
opresolve,
|
||||||
syncOpsCache,
|
syncOpsCache,
|
||||||
BadResource,
|
BadResource,
|
||||||
|
BadResourcePrototype,
|
||||||
Interrupted,
|
Interrupted,
|
||||||
|
InterruptedPrototype,
|
||||||
});
|
});
|
||||||
|
|
||||||
ObjectAssign(globalThis.__bootstrap, { core });
|
ObjectAssign(globalThis.__bootstrap, { core });
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
postMessage(message) {
|
postMessage(message) {
|
||||||
webidl.assertBranded(this, BroadcastChannel);
|
webidl.assertBranded(this, BroadcastChannelPrototype);
|
||||||
|
|
||||||
const prefix = "Failed to execute 'postMessage' on 'BroadcastChannel'";
|
const prefix = "Failed to execute 'postMessage' on 'BroadcastChannel'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
webidl.assertBranded(this, BroadcastChannel);
|
webidl.assertBranded(this, BroadcastChannelPrototype);
|
||||||
this[_closed] = true;
|
this[_closed] = true;
|
||||||
|
|
||||||
const index = ArrayPrototypeIndexOf(channels, this);
|
const index = ArrayPrototypeIndexOf(channels, this);
|
||||||
|
@ -134,6 +134,7 @@
|
||||||
|
|
||||||
defineEventHandler(BroadcastChannel.prototype, "message");
|
defineEventHandler(BroadcastChannel.prototype, "message");
|
||||||
defineEventHandler(BroadcastChannel.prototype, "messageerror");
|
defineEventHandler(BroadcastChannel.prototype, "messageerror");
|
||||||
|
const BroadcastChannelPrototype = BroadcastChannel.prototype;
|
||||||
|
|
||||||
window.__bootstrap.broadcastChannel = { BroadcastChannel };
|
window.__bootstrap.broadcastChannel = { BroadcastChannel };
|
||||||
})(this);
|
})(this);
|
||||||
|
|
|
@ -10,12 +10,13 @@
|
||||||
const {
|
const {
|
||||||
ArrayBufferIsView,
|
ArrayBufferIsView,
|
||||||
isNaN,
|
isNaN,
|
||||||
DataView,
|
DataViewPrototype,
|
||||||
Date,
|
DatePrototype,
|
||||||
DateNow,
|
DateNow,
|
||||||
DatePrototypeGetTime,
|
DatePrototypeGetTime,
|
||||||
DatePrototypeToISOString,
|
DatePrototypeToISOString,
|
||||||
Boolean,
|
Boolean,
|
||||||
|
BooleanPrototype,
|
||||||
BooleanPrototypeToString,
|
BooleanPrototypeToString,
|
||||||
ObjectKeys,
|
ObjectKeys,
|
||||||
ObjectCreate,
|
ObjectCreate,
|
||||||
|
@ -27,9 +28,11 @@
|
||||||
ObjectGetOwnPropertyDescriptor,
|
ObjectGetOwnPropertyDescriptor,
|
||||||
ObjectGetOwnPropertySymbols,
|
ObjectGetOwnPropertySymbols,
|
||||||
ObjectPrototypeHasOwnProperty,
|
ObjectPrototypeHasOwnProperty,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectPrototypePropertyIsEnumerable,
|
ObjectPrototypePropertyIsEnumerable,
|
||||||
Promise,
|
PromisePrototype,
|
||||||
String,
|
String,
|
||||||
|
StringPrototype,
|
||||||
StringPrototypeRepeat,
|
StringPrototypeRepeat,
|
||||||
StringPrototypeReplace,
|
StringPrototypeReplace,
|
||||||
StringPrototypeReplaceAll,
|
StringPrototypeReplaceAll,
|
||||||
|
@ -47,11 +50,13 @@
|
||||||
TypeError,
|
TypeError,
|
||||||
NumberParseInt,
|
NumberParseInt,
|
||||||
RegExp,
|
RegExp,
|
||||||
|
RegExpPrototype,
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
RegExpPrototypeToString,
|
RegExpPrototypeToString,
|
||||||
Set,
|
SetPrototype,
|
||||||
SetPrototypeEntries,
|
SetPrototypeEntries,
|
||||||
Symbol,
|
Symbol,
|
||||||
|
SymbolPrototype,
|
||||||
SymbolPrototypeToString,
|
SymbolPrototypeToString,
|
||||||
SymbolPrototypeValueOf,
|
SymbolPrototypeValueOf,
|
||||||
SymbolToStringTag,
|
SymbolToStringTag,
|
||||||
|
@ -73,6 +78,7 @@
|
||||||
ArrayPrototypeFind,
|
ArrayPrototypeFind,
|
||||||
FunctionPrototypeBind,
|
FunctionPrototypeBind,
|
||||||
Map,
|
Map,
|
||||||
|
MapPrototype,
|
||||||
MapPrototypeHas,
|
MapPrototypeHas,
|
||||||
MapPrototypeGet,
|
MapPrototypeGet,
|
||||||
MapPrototypeSet,
|
MapPrototypeSet,
|
||||||
|
@ -80,6 +86,7 @@
|
||||||
MapPrototypeEntries,
|
MapPrototypeEntries,
|
||||||
MapPrototypeForEach,
|
MapPrototypeForEach,
|
||||||
Error,
|
Error,
|
||||||
|
ErrorPrototype,
|
||||||
ErrorCaptureStackTrace,
|
ErrorCaptureStackTrace,
|
||||||
MathAbs,
|
MathAbs,
|
||||||
MathMax,
|
MathMax,
|
||||||
|
@ -88,16 +95,17 @@
|
||||||
MathRound,
|
MathRound,
|
||||||
MathFloor,
|
MathFloor,
|
||||||
Number,
|
Number,
|
||||||
|
NumberPrototype,
|
||||||
NumberPrototypeToString,
|
NumberPrototypeToString,
|
||||||
NumberPrototypeValueOf,
|
NumberPrototypeValueOf,
|
||||||
BigInt,
|
BigIntPrototype,
|
||||||
BigIntPrototypeToString,
|
BigIntPrototypeToString,
|
||||||
Proxy,
|
Proxy,
|
||||||
ReflectGet,
|
ReflectGet,
|
||||||
ReflectGetOwnPropertyDescriptor,
|
ReflectGetOwnPropertyDescriptor,
|
||||||
ReflectGetPrototypeOf,
|
ReflectGetPrototypeOf,
|
||||||
WeakMap,
|
WeakMapPrototype,
|
||||||
WeakSet,
|
WeakSetPrototype,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
function isInvalidDate(x) {
|
function isInvalidDate(x) {
|
||||||
|
@ -126,7 +134,8 @@
|
||||||
// Forked from Node's lib/internal/cli_table.js
|
// Forked from Node's lib/internal/cli_table.js
|
||||||
|
|
||||||
function isTypedArray(x) {
|
function isTypedArray(x) {
|
||||||
return ArrayBufferIsView(x) && !(x instanceof DataView);
|
return ArrayBufferIsView(x) &&
|
||||||
|
!ObjectPrototypeIsPrototypeOf(DataViewPrototype, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tableChars = {
|
const tableChars = {
|
||||||
|
@ -888,7 +897,8 @@
|
||||||
|
|
||||||
let err = value;
|
let err = value;
|
||||||
while (
|
while (
|
||||||
err.cause instanceof Error && err.cause !== value &&
|
ObjectPrototypeIsPrototypeOf(ErrorPrototype, err.cause) &&
|
||||||
|
err.cause !== value &&
|
||||||
!ArrayPrototypeIncludes(causes, err.cause) // circular check
|
!ArrayPrototypeIncludes(causes, err.cause) // circular check
|
||||||
) {
|
) {
|
||||||
ArrayPrototypePush(causes, err.cause);
|
ArrayPrototypePush(causes, err.cause);
|
||||||
|
@ -1160,33 +1170,33 @@
|
||||||
// namespace is always enabled.
|
// namespace is always enabled.
|
||||||
return String(value[privateCustomInspect](inspect));
|
return String(value[privateCustomInspect](inspect));
|
||||||
}
|
}
|
||||||
if (value instanceof Error) {
|
if (ObjectPrototypeIsPrototypeOf(ErrorPrototype, value)) {
|
||||||
return inspectError(value);
|
return inspectError(value);
|
||||||
} else if (ArrayIsArray(value)) {
|
} else if (ArrayIsArray(value)) {
|
||||||
return inspectArray(value, level, inspectOptions);
|
return inspectArray(value, level, inspectOptions);
|
||||||
} else if (value instanceof Number) {
|
} else if (ObjectPrototypeIsPrototypeOf(NumberPrototype, value)) {
|
||||||
return inspectNumberObject(value, inspectOptions);
|
return inspectNumberObject(value, inspectOptions);
|
||||||
} else if (value instanceof BigInt) {
|
} else if (ObjectPrototypeIsPrototypeOf(BigIntPrototype, value)) {
|
||||||
return inspectBigIntObject(value, inspectOptions);
|
return inspectBigIntObject(value, inspectOptions);
|
||||||
} else if (value instanceof Boolean) {
|
} else if (ObjectPrototypeIsPrototypeOf(BooleanPrototype, value)) {
|
||||||
return inspectBooleanObject(value, inspectOptions);
|
return inspectBooleanObject(value, inspectOptions);
|
||||||
} else if (value instanceof String) {
|
} else if (ObjectPrototypeIsPrototypeOf(StringPrototype, value)) {
|
||||||
return inspectStringObject(value, inspectOptions);
|
return inspectStringObject(value, inspectOptions);
|
||||||
} else if (value instanceof Symbol) {
|
} else if (ObjectPrototypeIsPrototypeOf(SymbolPrototype, value)) {
|
||||||
return inspectSymbolObject(value, inspectOptions);
|
return inspectSymbolObject(value, inspectOptions);
|
||||||
} else if (value instanceof Promise) {
|
} else if (ObjectPrototypeIsPrototypeOf(PromisePrototype, value)) {
|
||||||
return inspectPromise(value, level, inspectOptions);
|
return inspectPromise(value, level, inspectOptions);
|
||||||
} else if (value instanceof RegExp) {
|
} else if (ObjectPrototypeIsPrototypeOf(RegExpPrototype, value)) {
|
||||||
return inspectRegExp(value, inspectOptions);
|
return inspectRegExp(value, inspectOptions);
|
||||||
} else if (value instanceof Date) {
|
} else if (ObjectPrototypeIsPrototypeOf(DatePrototype, value)) {
|
||||||
return inspectDate(value, inspectOptions);
|
return inspectDate(value, inspectOptions);
|
||||||
} else if (value instanceof Set) {
|
} else if (ObjectPrototypeIsPrototypeOf(SetPrototype, value)) {
|
||||||
return inspectSet(value, level, inspectOptions);
|
return inspectSet(value, level, inspectOptions);
|
||||||
} else if (value instanceof Map) {
|
} else if (ObjectPrototypeIsPrototypeOf(MapPrototype, value)) {
|
||||||
return inspectMap(value, level, inspectOptions);
|
return inspectMap(value, level, inspectOptions);
|
||||||
} else if (value instanceof WeakSet) {
|
} else if (ObjectPrototypeIsPrototypeOf(WeakSetPrototype, value)) {
|
||||||
return inspectWeakSet(inspectOptions);
|
return inspectWeakSet(inspectOptions);
|
||||||
} else if (value instanceof WeakMap) {
|
} else if (ObjectPrototypeIsPrototypeOf(WeakMapPrototype, value)) {
|
||||||
return inspectWeakMap(inspectOptions);
|
return inspectWeakMap(inspectOptions);
|
||||||
} else if (isTypedArray(value)) {
|
} else if (isTypedArray(value)) {
|
||||||
return inspectTypedArray(
|
return inspectTypedArray(
|
||||||
|
@ -1911,14 +1921,14 @@
|
||||||
const toTable = (header, body) => this.log(cliTable(header, body));
|
const toTable = (header, body) => this.log(cliTable(header, body));
|
||||||
|
|
||||||
let resultData;
|
let resultData;
|
||||||
const isSet = data instanceof Set;
|
const isSet = ObjectPrototypeIsPrototypeOf(SetPrototype, data);
|
||||||
const isMap = data instanceof Map;
|
const isMap = ObjectPrototypeIsPrototypeOf(MapPrototype, data);
|
||||||
const valuesKey = "Values";
|
const valuesKey = "Values";
|
||||||
const indexKey = isSet || isMap ? "(iter idx)" : "(idx)";
|
const indexKey = isSet || isMap ? "(iter idx)" : "(idx)";
|
||||||
|
|
||||||
if (data instanceof Set) {
|
if (isSet) {
|
||||||
resultData = [...data];
|
resultData = [...data];
|
||||||
} else if (data instanceof Map) {
|
} else if (isMap) {
|
||||||
let idx = 0;
|
let idx = 0;
|
||||||
resultData = {};
|
resultData = {};
|
||||||
|
|
||||||
|
|
|
@ -15,18 +15,20 @@
|
||||||
const { TextEncoder, TextDecoder } = window.__bootstrap.encoding;
|
const { TextEncoder, TextDecoder } = window.__bootstrap.encoding;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
ArrayBuffer,
|
ArrayBufferPrototype,
|
||||||
ArrayBufferIsView,
|
ArrayBufferIsView,
|
||||||
ArrayPrototypeEvery,
|
ArrayPrototypeEvery,
|
||||||
ArrayPrototypeFind,
|
ArrayPrototypeFind,
|
||||||
ArrayPrototypeIncludes,
|
ArrayPrototypeIncludes,
|
||||||
BigInt64Array,
|
BigInt64ArrayPrototype,
|
||||||
Int16Array,
|
BigUint64ArrayPrototype,
|
||||||
Int32Array,
|
Int16ArrayPrototype,
|
||||||
Int8Array,
|
Int32ArrayPrototype,
|
||||||
|
Int8ArrayPrototype,
|
||||||
JSONParse,
|
JSONParse,
|
||||||
JSONStringify,
|
JSONStringify,
|
||||||
ObjectAssign,
|
ObjectAssign,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
StringPrototypeToLowerCase,
|
StringPrototypeToLowerCase,
|
||||||
StringPrototypeToUpperCase,
|
StringPrototypeToUpperCase,
|
||||||
Symbol,
|
Symbol,
|
||||||
|
@ -34,10 +36,11 @@
|
||||||
SyntaxError,
|
SyntaxError,
|
||||||
TypedArrayPrototypeSlice,
|
TypedArrayPrototypeSlice,
|
||||||
TypeError,
|
TypeError,
|
||||||
Uint16Array,
|
Uint16ArrayPrototype,
|
||||||
Uint32Array,
|
Uint32ArrayPrototype,
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
Uint8ClampedArray,
|
Uint8ArrayPrototype,
|
||||||
|
Uint8ClampedArrayPrototype,
|
||||||
WeakMap,
|
WeakMap,
|
||||||
WeakMapPrototypeGet,
|
WeakMapPrototypeGet,
|
||||||
WeakMapPrototypeSet,
|
WeakMapPrototypeSet,
|
||||||
|
@ -286,26 +289,26 @@
|
||||||
|
|
||||||
/** @returns {string} */
|
/** @returns {string} */
|
||||||
get type() {
|
get type() {
|
||||||
webidl.assertBranded(this, CryptoKey);
|
webidl.assertBranded(this, CryptoKeyPrototype);
|
||||||
return this[_type];
|
return this[_type];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {boolean} */
|
/** @returns {boolean} */
|
||||||
get extractable() {
|
get extractable() {
|
||||||
webidl.assertBranded(this, CryptoKey);
|
webidl.assertBranded(this, CryptoKeyPrototype);
|
||||||
return this[_extractable];
|
return this[_extractable];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {string[]} */
|
/** @returns {string[]} */
|
||||||
get usages() {
|
get usages() {
|
||||||
webidl.assertBranded(this, CryptoKey);
|
webidl.assertBranded(this, CryptoKeyPrototype);
|
||||||
// TODO(lucacasonato): return a SameObject copy
|
// TODO(lucacasonato): return a SameObject copy
|
||||||
return this[_usages];
|
return this[_usages];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {object} */
|
/** @returns {object} */
|
||||||
get algorithm() {
|
get algorithm() {
|
||||||
webidl.assertBranded(this, CryptoKey);
|
webidl.assertBranded(this, CryptoKeyPrototype);
|
||||||
// TODO(lucacasonato): return a SameObject copy
|
// TODO(lucacasonato): return a SameObject copy
|
||||||
return this[_algorithm];
|
return this[_algorithm];
|
||||||
}
|
}
|
||||||
|
@ -323,6 +326,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(CryptoKey);
|
webidl.configurePrototype(CryptoKey);
|
||||||
|
const CryptoKeyPrototype = CryptoKey.prototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} type
|
* @param {string} type
|
||||||
|
@ -429,7 +433,7 @@
|
||||||
* @returns {Promise<Uint8Array>}
|
* @returns {Promise<Uint8Array>}
|
||||||
*/
|
*/
|
||||||
async digest(algorithm, data) {
|
async digest(algorithm, data) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'digest' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'digest' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||||
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
||||||
|
@ -461,7 +465,7 @@
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
async encrypt(algorithm, key, data) {
|
async encrypt(algorithm, key, data) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'encrypt' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'encrypt' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 3, { prefix });
|
webidl.requiredArguments(arguments.length, 3, { prefix });
|
||||||
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
||||||
|
@ -509,7 +513,7 @@
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
async decrypt(algorithm, key, data) {
|
async decrypt(algorithm, key, data) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'decrypt' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'decrypt' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 3, { prefix });
|
webidl.requiredArguments(arguments.length, 3, { prefix });
|
||||||
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
||||||
|
@ -705,7 +709,7 @@
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
async sign(algorithm, key, data) {
|
async sign(algorithm, key, data) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'sign' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'sign' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 3, { prefix });
|
webidl.requiredArguments(arguments.length, 3, { prefix });
|
||||||
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
||||||
|
@ -837,7 +841,7 @@
|
||||||
*/
|
*/
|
||||||
// deno-lint-ignore require-await
|
// deno-lint-ignore require-await
|
||||||
async importKey(format, keyData, algorithm, extractable, keyUsages) {
|
async importKey(format, keyData, algorithm, extractable, keyUsages) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'importKey' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'importKey' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 4, { prefix });
|
webidl.requiredArguments(arguments.length, 4, { prefix });
|
||||||
format = webidl.converters.KeyFormat(format, {
|
format = webidl.converters.KeyFormat(format, {
|
||||||
|
@ -863,13 +867,19 @@
|
||||||
|
|
||||||
// 2.
|
// 2.
|
||||||
if (format !== "jwk") {
|
if (format !== "jwk") {
|
||||||
if (ArrayBufferIsView(keyData) || keyData instanceof ArrayBuffer) {
|
if (
|
||||||
|
ArrayBufferIsView(keyData) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, keyData)
|
||||||
|
) {
|
||||||
keyData = copyBuffer(keyData);
|
keyData = copyBuffer(keyData);
|
||||||
} else {
|
} else {
|
||||||
throw new TypeError("keyData is a JsonWebKey");
|
throw new TypeError("keyData is a JsonWebKey");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ArrayBufferIsView(keyData) || keyData instanceof ArrayBuffer) {
|
if (
|
||||||
|
ArrayBufferIsView(keyData) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, keyData)
|
||||||
|
) {
|
||||||
throw new TypeError("keyData is not a JsonWebKey");
|
throw new TypeError("keyData is not a JsonWebKey");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -949,7 +959,7 @@
|
||||||
*/
|
*/
|
||||||
// deno-lint-ignore require-await
|
// deno-lint-ignore require-await
|
||||||
async exportKey(format, key) {
|
async exportKey(format, key) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'exportKey' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'exportKey' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||||
format = webidl.converters.KeyFormat(format, {
|
format = webidl.converters.KeyFormat(format, {
|
||||||
|
@ -999,7 +1009,7 @@
|
||||||
* @returns {Promise<ArrayBuffer>}
|
* @returns {Promise<ArrayBuffer>}
|
||||||
*/
|
*/
|
||||||
async deriveBits(algorithm, baseKey, length) {
|
async deriveBits(algorithm, baseKey, length) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'deriveBits' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'deriveBits' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 3, { prefix });
|
webidl.requiredArguments(arguments.length, 3, { prefix });
|
||||||
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
||||||
|
@ -1047,7 +1057,7 @@
|
||||||
extractable,
|
extractable,
|
||||||
keyUsages,
|
keyUsages,
|
||||||
) {
|
) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'deriveKey' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'deriveKey' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 5, { prefix });
|
webidl.requiredArguments(arguments.length, 5, { prefix });
|
||||||
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
||||||
|
@ -1142,7 +1152,7 @@
|
||||||
* @returns {Promise<boolean>}
|
* @returns {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
async verify(algorithm, key, signature, data) {
|
async verify(algorithm, key, signature, data) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'verify' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'verify' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 4, { prefix });
|
webidl.requiredArguments(arguments.length, 4, { prefix });
|
||||||
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
||||||
|
@ -1263,7 +1273,7 @@
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
async wrapKey(format, key, wrappingKey, wrapAlgorithm) {
|
async wrapKey(format, key, wrappingKey, wrapAlgorithm) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'wrapKey' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'wrapKey' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 4, { prefix });
|
webidl.requiredArguments(arguments.length, 4, { prefix });
|
||||||
format = webidl.converters.KeyFormat(format, {
|
format = webidl.converters.KeyFormat(format, {
|
||||||
|
@ -1396,7 +1406,7 @@
|
||||||
extractable,
|
extractable,
|
||||||
keyUsages,
|
keyUsages,
|
||||||
) {
|
) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'unwrapKey' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'unwrapKey' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 7, { prefix });
|
webidl.requiredArguments(arguments.length, 7, { prefix });
|
||||||
format = webidl.converters.KeyFormat(format, {
|
format = webidl.converters.KeyFormat(format, {
|
||||||
|
@ -1554,7 +1564,7 @@
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
async generateKey(algorithm, extractable, keyUsages) {
|
async generateKey(algorithm, extractable, keyUsages) {
|
||||||
webidl.assertBranded(this, SubtleCrypto);
|
webidl.assertBranded(this, SubtleCryptoPrototype);
|
||||||
const prefix = "Failed to execute 'generateKey' on 'SubtleCrypto'";
|
const prefix = "Failed to execute 'generateKey' on 'SubtleCrypto'";
|
||||||
webidl.requiredArguments(arguments.length, 3, { prefix });
|
webidl.requiredArguments(arguments.length, 3, { prefix });
|
||||||
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
algorithm = webidl.converters.AlgorithmIdentifier(algorithm, {
|
||||||
|
@ -1580,12 +1590,14 @@
|
||||||
usages,
|
usages,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result instanceof CryptoKey) {
|
if (ObjectPrototypeIsPrototypeOf(CryptoKeyPrototype, result)) {
|
||||||
const type = result[_type];
|
const type = result[_type];
|
||||||
if ((type === "secret" || type === "private") && usages.length === 0) {
|
if ((type === "secret" || type === "private") && usages.length === 0) {
|
||||||
throw new DOMException("Invalid key usages", "SyntaxError");
|
throw new DOMException("Invalid key usages", "SyntaxError");
|
||||||
}
|
}
|
||||||
} else if (result.privateKey instanceof CryptoKey) {
|
} else if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(CryptoKeyPrototype, result.privateKey)
|
||||||
|
) {
|
||||||
if (result.privateKey[_usages].length === 0) {
|
if (result.privateKey[_usages].length === 0) {
|
||||||
throw new DOMException("Invalid key usages", "SyntaxError");
|
throw new DOMException("Invalid key usages", "SyntaxError");
|
||||||
}
|
}
|
||||||
|
@ -1594,6 +1606,7 @@
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const SubtleCryptoPrototype = SubtleCrypto.prototype;
|
||||||
|
|
||||||
async function generateKey(normalizedAlgorithm, extractable, usages) {
|
async function generateKey(normalizedAlgorithm, extractable, usages) {
|
||||||
const algorithmName = normalizedAlgorithm.name;
|
const algorithmName = normalizedAlgorithm.name;
|
||||||
|
@ -3826,7 +3839,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
getRandomValues(arrayBufferView) {
|
getRandomValues(arrayBufferView) {
|
||||||
webidl.assertBranded(this, Crypto);
|
webidl.assertBranded(this, CryptoPrototype);
|
||||||
const prefix = "Failed to execute 'getRandomValues' on 'Crypto'";
|
const prefix = "Failed to execute 'getRandomValues' on 'Crypto'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
arrayBufferView = webidl.converters.ArrayBufferView(arrayBufferView, {
|
arrayBufferView = webidl.converters.ArrayBufferView(arrayBufferView, {
|
||||||
|
@ -3835,15 +3848,21 @@
|
||||||
});
|
});
|
||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
arrayBufferView instanceof Int8Array ||
|
ObjectPrototypeIsPrototypeOf(Int8ArrayPrototype, arrayBufferView) ||
|
||||||
arrayBufferView instanceof Uint8Array ||
|
ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, arrayBufferView) ||
|
||||||
arrayBufferView instanceof Uint8ClampedArray ||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
arrayBufferView instanceof Int16Array ||
|
Uint8ClampedArrayPrototype,
|
||||||
arrayBufferView instanceof Uint16Array ||
|
arrayBufferView,
|
||||||
arrayBufferView instanceof Int32Array ||
|
) ||
|
||||||
arrayBufferView instanceof Uint32Array ||
|
ObjectPrototypeIsPrototypeOf(Int16ArrayPrototype, arrayBufferView) ||
|
||||||
arrayBufferView instanceof BigInt64Array ||
|
ObjectPrototypeIsPrototypeOf(Uint16ArrayPrototype, arrayBufferView) ||
|
||||||
arrayBufferView instanceof BigUint64Array
|
ObjectPrototypeIsPrototypeOf(Int32ArrayPrototype, arrayBufferView) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(Uint32ArrayPrototype, arrayBufferView) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
BigInt64ArrayPrototype,
|
||||||
|
arrayBufferView,
|
||||||
|
) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(BigUint64ArrayPrototype, arrayBufferView)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
throw new DOMException(
|
throw new DOMException(
|
||||||
|
@ -3861,12 +3880,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
randomUUID() {
|
randomUUID() {
|
||||||
webidl.assertBranded(this, Crypto);
|
webidl.assertBranded(this, CryptoPrototype);
|
||||||
return core.opSync("op_crypto_random_uuid");
|
return core.opSync("op_crypto_random_uuid");
|
||||||
}
|
}
|
||||||
|
|
||||||
get subtle() {
|
get subtle() {
|
||||||
webidl.assertBranded(this, Crypto);
|
webidl.assertBranded(this, CryptoPrototype);
|
||||||
return subtle;
|
return subtle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3876,6 +3895,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(Crypto);
|
webidl.configurePrototype(Crypto);
|
||||||
|
const CryptoPrototype = Crypto.prototype;
|
||||||
|
|
||||||
window.__bootstrap.crypto = {
|
window.__bootstrap.crypto = {
|
||||||
SubtleCrypto,
|
SubtleCrypto,
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
((window) => {
|
((window) => {
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const { CryptoKey } = window.__bootstrap.crypto;
|
const { CryptoKey } = window.__bootstrap.crypto;
|
||||||
const { ArrayBufferIsView, ArrayBuffer } = window.__bootstrap.primordials;
|
const {
|
||||||
|
ArrayBufferIsView,
|
||||||
|
ArrayBufferPrototype,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
webidl.converters.AlgorithmIdentifier = (V, opts) => {
|
webidl.converters.AlgorithmIdentifier = (V, opts) => {
|
||||||
// Union for (object or DOMString)
|
// Union for (object or DOMString)
|
||||||
|
@ -21,7 +25,10 @@
|
||||||
|
|
||||||
webidl.converters["BufferSource or JsonWebKey"] = (V, opts) => {
|
webidl.converters["BufferSource or JsonWebKey"] = (V, opts) => {
|
||||||
// Union for (BufferSource or JsonWebKey)
|
// Union for (BufferSource or JsonWebKey)
|
||||||
if (ArrayBufferIsView(V) || V instanceof ArrayBuffer) {
|
if (
|
||||||
|
ArrayBufferIsView(V) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V)
|
||||||
|
) {
|
||||||
return webidl.converters.BufferSource(V, opts);
|
return webidl.converters.BufferSource(V, opts);
|
||||||
}
|
}
|
||||||
return webidl.converters.JsonWebKey(V, opts);
|
return webidl.converters.JsonWebKey(V, opts);
|
||||||
|
@ -460,7 +467,7 @@
|
||||||
|
|
||||||
webidl.converters.CryptoKey = webidl.createInterfaceConverter(
|
webidl.converters.CryptoKey = webidl.createInterfaceConverter(
|
||||||
"CryptoKey",
|
"CryptoKey",
|
||||||
CryptoKey,
|
CryptoKey.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
const dictCryptoKeyPair = [
|
const dictCryptoKeyPair = [
|
||||||
|
|
|
@ -263,7 +263,7 @@
|
||||||
* @param {string} value
|
* @param {string} value
|
||||||
*/
|
*/
|
||||||
append(name, value) {
|
append(name, value) {
|
||||||
webidl.assertBranded(this, Headers);
|
webidl.assertBranded(this, HeadersPrototype);
|
||||||
const prefix = "Failed to execute 'append' on 'Headers'";
|
const prefix = "Failed to execute 'append' on 'Headers'";
|
||||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||||
name = webidl.converters["ByteString"](name, {
|
name = webidl.converters["ByteString"](name, {
|
||||||
|
@ -354,7 +354,7 @@
|
||||||
* @param {string} value
|
* @param {string} value
|
||||||
*/
|
*/
|
||||||
set(name, value) {
|
set(name, value) {
|
||||||
webidl.assertBranded(this, Headers);
|
webidl.assertBranded(this, HeadersPrototype);
|
||||||
const prefix = "Failed to execute 'set' on 'Headers'";
|
const prefix = "Failed to execute 'set' on 'Headers'";
|
||||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||||
name = webidl.converters["ByteString"](name, {
|
name = webidl.converters["ByteString"](name, {
|
||||||
|
@ -411,6 +411,7 @@
|
||||||
webidl.mixinPairIterable("Headers", Headers, _iterableHeaders, 0, 1);
|
webidl.mixinPairIterable("Headers", Headers, _iterableHeaders, 0, 1);
|
||||||
|
|
||||||
webidl.configurePrototype(Headers);
|
webidl.configurePrototype(Headers);
|
||||||
|
const HeadersPrototype = Headers.prototype;
|
||||||
|
|
||||||
webidl.converters["HeadersInit"] = (V, opts) => {
|
webidl.converters["HeadersInit"] = (V, opts) => {
|
||||||
// Union for (sequence<sequence<ByteString>> or record<ByteString, ByteString>)
|
// Union for (sequence<sequence<ByteString>> or record<ByteString, ByteString>)
|
||||||
|
@ -428,7 +429,7 @@
|
||||||
};
|
};
|
||||||
webidl.converters["Headers"] = webidl.createInterfaceConverter(
|
webidl.converters["Headers"] = webidl.createInterfaceConverter(
|
||||||
"Headers",
|
"Headers",
|
||||||
Headers,
|
Headers.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
((window) => {
|
((window) => {
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const webidl = globalThis.__bootstrap.webidl;
|
const webidl = globalThis.__bootstrap.webidl;
|
||||||
const { Blob, File } = globalThis.__bootstrap.file;
|
const { Blob, BlobPrototype, File, FilePrototype } =
|
||||||
|
globalThis.__bootstrap.file;
|
||||||
const {
|
const {
|
||||||
ArrayPrototypeMap,
|
ArrayPrototypeMap,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
MapPrototypeGet,
|
MapPrototypeGet,
|
||||||
MapPrototypeSet,
|
MapPrototypeSet,
|
||||||
MathRandom,
|
MathRandom,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
Symbol,
|
Symbol,
|
||||||
StringFromCharCode,
|
StringFromCharCode,
|
||||||
StringPrototypeTrim,
|
StringPrototypeTrim,
|
||||||
|
@ -48,10 +50,16 @@
|
||||||
* @returns {FormDataEntry}
|
* @returns {FormDataEntry}
|
||||||
*/
|
*/
|
||||||
function createEntry(name, value, filename) {
|
function createEntry(name, value, filename) {
|
||||||
if (value instanceof Blob && !(value instanceof File)) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(BlobPrototype, value) &&
|
||||||
|
!ObjectPrototypeIsPrototypeOf(FilePrototype, value)
|
||||||
|
) {
|
||||||
value = new File([value], "blob", { type: value.type });
|
value = new File([value], "blob", { type: value.type });
|
||||||
}
|
}
|
||||||
if (value instanceof File && filename !== undefined) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(FilePrototype, value) &&
|
||||||
|
filename !== undefined
|
||||||
|
) {
|
||||||
value = new File([value], filename, {
|
value = new File([value], filename, {
|
||||||
type: value.type,
|
type: value.type,
|
||||||
lastModified: value.lastModified,
|
lastModified: value.lastModified,
|
||||||
|
@ -89,7 +97,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
append(name, valueOrBlobValue, filename) {
|
append(name, valueOrBlobValue, filename) {
|
||||||
webidl.assertBranded(this, FormData);
|
webidl.assertBranded(this, FormDataPrototype);
|
||||||
const prefix = "Failed to execute 'append' on 'FormData'";
|
const prefix = "Failed to execute 'append' on 'FormData'";
|
||||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||||
|
|
||||||
|
@ -97,7 +105,7 @@
|
||||||
prefix,
|
prefix,
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
});
|
});
|
||||||
if (valueOrBlobValue instanceof Blob) {
|
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, valueOrBlobValue)) {
|
||||||
valueOrBlobValue = webidl.converters["Blob"](valueOrBlobValue, {
|
valueOrBlobValue = webidl.converters["Blob"](valueOrBlobValue, {
|
||||||
prefix,
|
prefix,
|
||||||
context: "Argument 2",
|
context: "Argument 2",
|
||||||
|
@ -125,7 +133,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
delete(name) {
|
delete(name) {
|
||||||
webidl.assertBranded(this, FormData);
|
webidl.assertBranded(this, FormDataPrototype);
|
||||||
const prefix = "Failed to execute 'name' on 'FormData'";
|
const prefix = "Failed to execute 'name' on 'FormData'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
|
||||||
|
@ -148,7 +156,7 @@
|
||||||
* @returns {FormDataEntryValue | null}
|
* @returns {FormDataEntryValue | null}
|
||||||
*/
|
*/
|
||||||
get(name) {
|
get(name) {
|
||||||
webidl.assertBranded(this, FormData);
|
webidl.assertBranded(this, FormDataPrototype);
|
||||||
const prefix = "Failed to execute 'get' on 'FormData'";
|
const prefix = "Failed to execute 'get' on 'FormData'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
|
||||||
|
@ -168,7 +176,7 @@
|
||||||
* @returns {FormDataEntryValue[]}
|
* @returns {FormDataEntryValue[]}
|
||||||
*/
|
*/
|
||||||
getAll(name) {
|
getAll(name) {
|
||||||
webidl.assertBranded(this, FormData);
|
webidl.assertBranded(this, FormDataPrototype);
|
||||||
const prefix = "Failed to execute 'getAll' on 'FormData'";
|
const prefix = "Failed to execute 'getAll' on 'FormData'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
|
||||||
|
@ -189,7 +197,7 @@
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
has(name) {
|
has(name) {
|
||||||
webidl.assertBranded(this, FormData);
|
webidl.assertBranded(this, FormDataPrototype);
|
||||||
const prefix = "Failed to execute 'has' on 'FormData'";
|
const prefix = "Failed to execute 'has' on 'FormData'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
|
||||||
|
@ -211,7 +219,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
set(name, valueOrBlobValue, filename) {
|
set(name, valueOrBlobValue, filename) {
|
||||||
webidl.assertBranded(this, FormData);
|
webidl.assertBranded(this, FormDataPrototype);
|
||||||
const prefix = "Failed to execute 'set' on 'FormData'";
|
const prefix = "Failed to execute 'set' on 'FormData'";
|
||||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||||
|
|
||||||
|
@ -219,7 +227,7 @@
|
||||||
prefix,
|
prefix,
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
});
|
});
|
||||||
if (valueOrBlobValue instanceof Blob) {
|
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, valueOrBlobValue)) {
|
||||||
valueOrBlobValue = webidl.converters["Blob"](valueOrBlobValue, {
|
valueOrBlobValue = webidl.converters["Blob"](valueOrBlobValue, {
|
||||||
prefix,
|
prefix,
|
||||||
context: "Argument 2",
|
context: "Argument 2",
|
||||||
|
@ -261,6 +269,7 @@
|
||||||
webidl.mixinPairIterable("FormData", FormData, entryList, "name", "value");
|
webidl.mixinPairIterable("FormData", FormData, entryList, "name", "value");
|
||||||
|
|
||||||
webidl.configurePrototype(FormData);
|
webidl.configurePrototype(FormData);
|
||||||
|
const FormDataPrototype = FormData.prototype;
|
||||||
|
|
||||||
const escape = (str, isFilename) =>
|
const escape = (str, isFilename) =>
|
||||||
StringPrototypeReplace(
|
StringPrototypeReplace(
|
||||||
|
@ -491,10 +500,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.converters["FormData"] = webidl
|
webidl.converters["FormData"] = webidl
|
||||||
.createInterfaceConverter("FormData", FormData);
|
.createInterfaceConverter("FormData", FormDataPrototype);
|
||||||
|
|
||||||
globalThis.__bootstrap.formData = {
|
globalThis.__bootstrap.formData = {
|
||||||
FormData,
|
FormData,
|
||||||
|
FormDataPrototype,
|
||||||
formDataToBlob,
|
formDataToBlob,
|
||||||
parseFormData,
|
parseFormData,
|
||||||
formDataFromEntries,
|
formDataFromEntries,
|
||||||
|
|
|
@ -16,23 +16,35 @@
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const webidl = globalThis.__bootstrap.webidl;
|
const webidl = globalThis.__bootstrap.webidl;
|
||||||
const { parseUrlEncoded } = globalThis.__bootstrap.url;
|
const { parseUrlEncoded } = globalThis.__bootstrap.url;
|
||||||
const { parseFormData, formDataFromEntries, formDataToBlob } =
|
const { URLSearchParamsPrototype } = globalThis.__bootstrap.url;
|
||||||
globalThis.__bootstrap.formData;
|
|
||||||
const mimesniff = globalThis.__bootstrap.mimesniff;
|
|
||||||
const { isReadableStreamDisturbed, errorReadableStream, createProxy } =
|
|
||||||
globalThis.__bootstrap.streams;
|
|
||||||
const {
|
const {
|
||||||
ArrayBuffer,
|
parseFormData,
|
||||||
|
formDataFromEntries,
|
||||||
|
formDataToBlob,
|
||||||
|
FormDataPrototype,
|
||||||
|
} = globalThis.__bootstrap.formData;
|
||||||
|
const mimesniff = globalThis.__bootstrap.mimesniff;
|
||||||
|
const { BlobPrototype } = globalThis.__bootstrap.file;
|
||||||
|
const {
|
||||||
|
isReadableStreamDisturbed,
|
||||||
|
errorReadableStream,
|
||||||
|
createProxy,
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
} = globalThis.__bootstrap.streams;
|
||||||
|
const {
|
||||||
|
ArrayBufferPrototype,
|
||||||
ArrayBufferIsView,
|
ArrayBufferIsView,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
ArrayPrototypeMap,
|
ArrayPrototypeMap,
|
||||||
JSONParse,
|
JSONParse,
|
||||||
ObjectDefineProperties,
|
ObjectDefineProperties,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
PromiseResolve,
|
PromiseResolve,
|
||||||
TypedArrayPrototypeSet,
|
TypedArrayPrototypeSet,
|
||||||
TypedArrayPrototypeSlice,
|
TypedArrayPrototypeSlice,
|
||||||
TypeError,
|
TypeError,
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
|
Uint8ArrayPrototype,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,7 +78,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get stream() {
|
get stream() {
|
||||||
if (!(this.streamOrStatic instanceof ReadableStream)) {
|
if (
|
||||||
|
!ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
this.streamOrStatic,
|
||||||
|
)
|
||||||
|
) {
|
||||||
const { body, consumed } = this.streamOrStatic;
|
const { body, consumed } = this.streamOrStatic;
|
||||||
if (consumed) {
|
if (consumed) {
|
||||||
this.streamOrStatic = new ReadableStream();
|
this.streamOrStatic = new ReadableStream();
|
||||||
|
@ -88,7 +105,12 @@
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
unusable() {
|
unusable() {
|
||||||
if (this.streamOrStatic instanceof ReadableStream) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
this.streamOrStatic,
|
||||||
|
)
|
||||||
|
) {
|
||||||
return this.streamOrStatic.locked ||
|
return this.streamOrStatic.locked ||
|
||||||
isReadableStreamDisturbed(this.streamOrStatic);
|
isReadableStreamDisturbed(this.streamOrStatic);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +121,12 @@
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
consumed() {
|
consumed() {
|
||||||
if (this.streamOrStatic instanceof ReadableStream) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
this.streamOrStatic,
|
||||||
|
)
|
||||||
|
) {
|
||||||
return isReadableStreamDisturbed(this.streamOrStatic);
|
return isReadableStreamDisturbed(this.streamOrStatic);
|
||||||
}
|
}
|
||||||
return this.streamOrStatic.consumed;
|
return this.streamOrStatic.consumed;
|
||||||
|
@ -111,7 +138,12 @@
|
||||||
*/
|
*/
|
||||||
async consume() {
|
async consume() {
|
||||||
if (this.unusable()) throw new TypeError("Body already consumed.");
|
if (this.unusable()) throw new TypeError("Body already consumed.");
|
||||||
if (this.streamOrStatic instanceof ReadableStream) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
this.streamOrStatic,
|
||||||
|
)
|
||||||
|
) {
|
||||||
const reader = this.stream.getReader();
|
const reader = this.stream.getReader();
|
||||||
/** @type {Uint8Array[]} */
|
/** @type {Uint8Array[]} */
|
||||||
const chunks = [];
|
const chunks = [];
|
||||||
|
@ -136,7 +168,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel(error) {
|
cancel(error) {
|
||||||
if (this.streamOrStatic instanceof ReadableStream) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
this.streamOrStatic,
|
||||||
|
)
|
||||||
|
) {
|
||||||
this.streamOrStatic.cancel(error);
|
this.streamOrStatic.cancel(error);
|
||||||
} else {
|
} else {
|
||||||
this.streamOrStatic.consumed = true;
|
this.streamOrStatic.consumed = true;
|
||||||
|
@ -144,7 +181,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
error(error) {
|
error(error) {
|
||||||
if (this.streamOrStatic instanceof ReadableStream) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
this.streamOrStatic,
|
||||||
|
)
|
||||||
|
) {
|
||||||
errorReadableStream(this.streamOrStatic, error);
|
errorReadableStream(this.streamOrStatic, error);
|
||||||
} else {
|
} else {
|
||||||
this.streamOrStatic.consumed = true;
|
this.streamOrStatic.consumed = true;
|
||||||
|
@ -168,7 +210,12 @@
|
||||||
*/
|
*/
|
||||||
createProxy() {
|
createProxy() {
|
||||||
let proxyStreamOrStatic;
|
let proxyStreamOrStatic;
|
||||||
if (this.streamOrStatic instanceof ReadableStream) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
this.streamOrStatic,
|
||||||
|
)
|
||||||
|
) {
|
||||||
proxyStreamOrStatic = createProxy(this.streamOrStatic);
|
proxyStreamOrStatic = createProxy(this.streamOrStatic);
|
||||||
} else {
|
} else {
|
||||||
proxyStreamOrStatic = { ...this.streamOrStatic };
|
proxyStreamOrStatic = { ...this.streamOrStatic };
|
||||||
|
@ -282,7 +329,7 @@
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
return ObjectDefineProperties(prototype.prototype, mixin);
|
return ObjectDefineProperties(prototype, mixin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -341,18 +388,21 @@
|
||||||
let source = null;
|
let source = null;
|
||||||
let length = null;
|
let length = null;
|
||||||
let contentType = null;
|
let contentType = null;
|
||||||
if (object instanceof Blob) {
|
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, object)) {
|
||||||
stream = object.stream();
|
stream = object.stream();
|
||||||
source = object;
|
source = object;
|
||||||
length = object.size;
|
length = object.size;
|
||||||
if (object.type.length !== 0) {
|
if (object.type.length !== 0) {
|
||||||
contentType = object.type;
|
contentType = object.type;
|
||||||
}
|
}
|
||||||
} else if (object instanceof Uint8Array) {
|
} else if (ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, object)) {
|
||||||
// Fast(er) path for common case of Uint8Array
|
// Fast(er) path for common case of Uint8Array
|
||||||
const copy = TypedArrayPrototypeSlice(object, 0, object.byteLength);
|
const copy = TypedArrayPrototypeSlice(object, 0, object.byteLength);
|
||||||
source = copy;
|
source = copy;
|
||||||
} else if (ArrayBufferIsView(object) || object instanceof ArrayBuffer) {
|
} else if (
|
||||||
|
ArrayBufferIsView(object) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, object)
|
||||||
|
) {
|
||||||
const u8 = ArrayBufferIsView(object)
|
const u8 = ArrayBufferIsView(object)
|
||||||
? new Uint8Array(
|
? new Uint8Array(
|
||||||
object.buffer,
|
object.buffer,
|
||||||
|
@ -362,26 +412,28 @@
|
||||||
: new Uint8Array(object);
|
: new Uint8Array(object);
|
||||||
const copy = TypedArrayPrototypeSlice(u8, 0, u8.byteLength);
|
const copy = TypedArrayPrototypeSlice(u8, 0, u8.byteLength);
|
||||||
source = copy;
|
source = copy;
|
||||||
} else if (object instanceof FormData) {
|
} else if (ObjectPrototypeIsPrototypeOf(FormDataPrototype, object)) {
|
||||||
const res = formDataToBlob(object);
|
const res = formDataToBlob(object);
|
||||||
stream = res.stream();
|
stream = res.stream();
|
||||||
source = res;
|
source = res;
|
||||||
length = res.size;
|
length = res.size;
|
||||||
contentType = res.type;
|
contentType = res.type;
|
||||||
} else if (object instanceof URLSearchParams) {
|
} else if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(URLSearchParamsPrototype, object)
|
||||||
|
) {
|
||||||
// TODO(@satyarohith): not sure what primordial here.
|
// TODO(@satyarohith): not sure what primordial here.
|
||||||
source = object.toString();
|
source = object.toString();
|
||||||
contentType = "application/x-www-form-urlencoded;charset=UTF-8";
|
contentType = "application/x-www-form-urlencoded;charset=UTF-8";
|
||||||
} else if (typeof object === "string") {
|
} else if (typeof object === "string") {
|
||||||
source = object;
|
source = object;
|
||||||
contentType = "text/plain;charset=UTF-8";
|
contentType = "text/plain;charset=UTF-8";
|
||||||
} else if (object instanceof ReadableStream) {
|
} else if (ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, object)) {
|
||||||
stream = object;
|
stream = object;
|
||||||
if (object.locked || isReadableStreamDisturbed(object)) {
|
if (object.locked || isReadableStreamDisturbed(object)) {
|
||||||
throw new TypeError("ReadableStream is locked or disturbed");
|
throw new TypeError("ReadableStream is locked or disturbed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (source instanceof Uint8Array) {
|
if (ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, source)) {
|
||||||
stream = { body: source, consumed: false };
|
stream = { body: source, consumed: false };
|
||||||
length = source.byteLength;
|
length = source.byteLength;
|
||||||
} else if (typeof source === "string") {
|
} else if (typeof source === "string") {
|
||||||
|
@ -399,19 +451,22 @@
|
||||||
|
|
||||||
webidl.converters["BodyInit_DOMString"] = (V, opts) => {
|
webidl.converters["BodyInit_DOMString"] = (V, opts) => {
|
||||||
// Union for (ReadableStream or Blob or ArrayBufferView or ArrayBuffer or FormData or URLSearchParams or USVString)
|
// Union for (ReadableStream or Blob or ArrayBufferView or ArrayBuffer or FormData or URLSearchParams or USVString)
|
||||||
if (V instanceof ReadableStream) {
|
if (ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, V)) {
|
||||||
// TODO(lucacasonato): ReadableStream is not branded
|
// TODO(lucacasonato): ReadableStream is not branded
|
||||||
return V;
|
return V;
|
||||||
} else if (V instanceof Blob) {
|
} else if (ObjectPrototypeIsPrototypeOf(BlobPrototype, V)) {
|
||||||
return webidl.converters["Blob"](V, opts);
|
return webidl.converters["Blob"](V, opts);
|
||||||
} else if (V instanceof FormData) {
|
} else if (ObjectPrototypeIsPrototypeOf(FormDataPrototype, V)) {
|
||||||
return webidl.converters["FormData"](V, opts);
|
return webidl.converters["FormData"](V, opts);
|
||||||
} else if (V instanceof URLSearchParams) {
|
} else if (ObjectPrototypeIsPrototypeOf(URLSearchParamsPrototype, V)) {
|
||||||
// TODO(lucacasonato): URLSearchParams is not branded
|
// TODO(lucacasonato): URLSearchParams is not branded
|
||||||
return V;
|
return V;
|
||||||
}
|
}
|
||||||
if (typeof V === "object") {
|
if (typeof V === "object") {
|
||||||
if (V instanceof ArrayBuffer || V instanceof SharedArrayBuffer) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V)
|
||||||
|
) {
|
||||||
return webidl.converters["ArrayBuffer"](V, opts);
|
return webidl.converters["ArrayBuffer"](V, opts);
|
||||||
}
|
}
|
||||||
if (ArrayBufferIsView(V)) {
|
if (ArrayBufferIsView(V)) {
|
||||||
|
|
|
@ -34,8 +34,10 @@
|
||||||
core.close(this.rid);
|
core.close(this.rid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const HttpClientPrototype = HttpClient.prototype;
|
||||||
|
|
||||||
window.__bootstrap.fetch ??= {};
|
window.__bootstrap.fetch ??= {};
|
||||||
window.__bootstrap.fetch.createHttpClient = createHttpClient;
|
window.__bootstrap.fetch.createHttpClient = createHttpClient;
|
||||||
window.__bootstrap.fetch.HttpClient = HttpClient;
|
window.__bootstrap.fetch.HttpClient = HttpClient;
|
||||||
|
window.__bootstrap.fetch.HttpClientPrototype = HttpClientPrototype;
|
||||||
})(globalThis);
|
})(globalThis);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
fillHeaders,
|
fillHeaders,
|
||||||
getDecodeSplitHeader,
|
getDecodeSplitHeader,
|
||||||
} = window.__bootstrap.headers;
|
} = window.__bootstrap.headers;
|
||||||
const { HttpClient } = window.__bootstrap.fetch;
|
const { HttpClientPrototype } = window.__bootstrap.fetch;
|
||||||
const abortSignal = window.__bootstrap.abortSignal;
|
const abortSignal = window.__bootstrap.abortSignal;
|
||||||
const {
|
const {
|
||||||
ArrayPrototypeMap,
|
ArrayPrototypeMap,
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
MapPrototypeGet,
|
MapPrototypeGet,
|
||||||
MapPrototypeSet,
|
MapPrototypeSet,
|
||||||
ObjectKeys,
|
ObjectKeys,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
|
@ -241,7 +242,9 @@
|
||||||
const parsedURL = new URL(input, baseURL);
|
const parsedURL = new URL(input, baseURL);
|
||||||
request = newInnerRequest("GET", parsedURL.href, [], null, true);
|
request = newInnerRequest("GET", parsedURL.href, [], null, true);
|
||||||
} else { // 6.
|
} else { // 6.
|
||||||
if (!(input instanceof Request)) throw new TypeError("Unreachable");
|
if (!ObjectPrototypeIsPrototypeOf(RequestPrototype, input)) {
|
||||||
|
throw new TypeError("Unreachable");
|
||||||
|
}
|
||||||
request = input[_request];
|
request = input[_request];
|
||||||
signal = input[_signal];
|
signal = input[_signal];
|
||||||
}
|
}
|
||||||
|
@ -268,7 +271,10 @@
|
||||||
|
|
||||||
// NOTE: non standard extension. This handles Deno.HttpClient parameter
|
// NOTE: non standard extension. This handles Deno.HttpClient parameter
|
||||||
if (init.client !== undefined) {
|
if (init.client !== undefined) {
|
||||||
if (init.client !== null && !(init.client instanceof HttpClient)) {
|
if (
|
||||||
|
init.client !== null &&
|
||||||
|
!ObjectPrototypeIsPrototypeOf(HttpClientPrototype, init.client)
|
||||||
|
) {
|
||||||
throw webidl.makeException(
|
throw webidl.makeException(
|
||||||
TypeError,
|
TypeError,
|
||||||
"`client` must be a Deno.HttpClient",
|
"`client` must be a Deno.HttpClient",
|
||||||
|
@ -312,7 +318,7 @@
|
||||||
|
|
||||||
// 33.
|
// 33.
|
||||||
let inputBody = null;
|
let inputBody = null;
|
||||||
if (input instanceof Request) {
|
if (ObjectPrototypeIsPrototypeOf(RequestPrototype, input)) {
|
||||||
inputBody = input[_body];
|
inputBody = input[_body];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,32 +362,32 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get method() {
|
get method() {
|
||||||
webidl.assertBranded(this, Request);
|
webidl.assertBranded(this, RequestPrototype);
|
||||||
return this[_request].method;
|
return this[_request].method;
|
||||||
}
|
}
|
||||||
|
|
||||||
get url() {
|
get url() {
|
||||||
webidl.assertBranded(this, Request);
|
webidl.assertBranded(this, RequestPrototype);
|
||||||
return this[_request].url();
|
return this[_request].url();
|
||||||
}
|
}
|
||||||
|
|
||||||
get headers() {
|
get headers() {
|
||||||
webidl.assertBranded(this, Request);
|
webidl.assertBranded(this, RequestPrototype);
|
||||||
return this[_headers];
|
return this[_headers];
|
||||||
}
|
}
|
||||||
|
|
||||||
get redirect() {
|
get redirect() {
|
||||||
webidl.assertBranded(this, Request);
|
webidl.assertBranded(this, RequestPrototype);
|
||||||
return this[_request].redirectMode;
|
return this[_request].redirectMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
get signal() {
|
get signal() {
|
||||||
webidl.assertBranded(this, Request);
|
webidl.assertBranded(this, RequestPrototype);
|
||||||
return this[_signal];
|
return this[_signal];
|
||||||
}
|
}
|
||||||
|
|
||||||
clone() {
|
clone() {
|
||||||
webidl.assertBranded(this, Request);
|
webidl.assertBranded(this, RequestPrototype);
|
||||||
if (this[_body] && this[_body].unusable()) {
|
if (this[_body] && this[_body].unusable()) {
|
||||||
throw new TypeError("Body is unusable.");
|
throw new TypeError("Body is unusable.");
|
||||||
}
|
}
|
||||||
|
@ -398,7 +404,7 @@
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof Request,
|
evaluate: ObjectPrototypeIsPrototypeOf(RequestPrototype, this),
|
||||||
keys: [
|
keys: [
|
||||||
"bodyUsed",
|
"bodyUsed",
|
||||||
"headers",
|
"headers",
|
||||||
|
@ -410,18 +416,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mixinBody(Request, _body, _mimeType);
|
|
||||||
|
|
||||||
webidl.configurePrototype(Request);
|
webidl.configurePrototype(Request);
|
||||||
|
const RequestPrototype = Request.prototype;
|
||||||
|
mixinBody(RequestPrototype, _body, _mimeType);
|
||||||
|
|
||||||
webidl.converters["Request"] = webidl.createInterfaceConverter(
|
webidl.converters["Request"] = webidl.createInterfaceConverter(
|
||||||
"Request",
|
"Request",
|
||||||
Request,
|
RequestPrototype,
|
||||||
);
|
);
|
||||||
webidl.converters["RequestInfo_DOMString"] = (V, opts) => {
|
webidl.converters["RequestInfo_DOMString"] = (V, opts) => {
|
||||||
// Union for (Request or USVString)
|
// Union for (Request or USVString)
|
||||||
if (typeof V == "object") {
|
if (typeof V == "object") {
|
||||||
if (V instanceof Request) {
|
if (ObjectPrototypeIsPrototypeOf(RequestPrototype, V)) {
|
||||||
return webidl.converters["Request"](V, opts);
|
return webidl.converters["Request"](V, opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
MapPrototypeHas,
|
MapPrototypeHas,
|
||||||
MapPrototypeGet,
|
MapPrototypeGet,
|
||||||
MapPrototypeSet,
|
MapPrototypeSet,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
RangeError,
|
RangeError,
|
||||||
RegExp,
|
RegExp,
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
|
@ -297,7 +298,7 @@
|
||||||
* @returns {"basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"}
|
* @returns {"basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"}
|
||||||
*/
|
*/
|
||||||
get type() {
|
get type() {
|
||||||
webidl.assertBranded(this, Response);
|
webidl.assertBranded(this, ResponsePrototype);
|
||||||
return this[_response].type;
|
return this[_response].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +306,7 @@
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
get url() {
|
get url() {
|
||||||
webidl.assertBranded(this, Response);
|
webidl.assertBranded(this, ResponsePrototype);
|
||||||
const url = this[_response].url();
|
const url = this[_response].url();
|
||||||
if (url === null) return "";
|
if (url === null) return "";
|
||||||
const newUrl = new URL(url);
|
const newUrl = new URL(url);
|
||||||
|
@ -317,7 +318,7 @@
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
get redirected() {
|
get redirected() {
|
||||||
webidl.assertBranded(this, Response);
|
webidl.assertBranded(this, ResponsePrototype);
|
||||||
return this[_response].urlList.length > 1;
|
return this[_response].urlList.length > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +326,7 @@
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
get status() {
|
get status() {
|
||||||
webidl.assertBranded(this, Response);
|
webidl.assertBranded(this, ResponsePrototype);
|
||||||
return this[_response].status;
|
return this[_response].status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +334,7 @@
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
get ok() {
|
get ok() {
|
||||||
webidl.assertBranded(this, Response);
|
webidl.assertBranded(this, ResponsePrototype);
|
||||||
const status = this[_response].status;
|
const status = this[_response].status;
|
||||||
return status >= 200 && status <= 299;
|
return status >= 200 && status <= 299;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +343,7 @@
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
get statusText() {
|
get statusText() {
|
||||||
webidl.assertBranded(this, Response);
|
webidl.assertBranded(this, ResponsePrototype);
|
||||||
return this[_response].statusMessage;
|
return this[_response].statusMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +351,7 @@
|
||||||
* @returns {Headers}
|
* @returns {Headers}
|
||||||
*/
|
*/
|
||||||
get headers() {
|
get headers() {
|
||||||
webidl.assertBranded(this, Response);
|
webidl.assertBranded(this, ResponsePrototype);
|
||||||
return this[_headers];
|
return this[_headers];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +359,7 @@
|
||||||
* @returns {Response}
|
* @returns {Response}
|
||||||
*/
|
*/
|
||||||
clone() {
|
clone() {
|
||||||
webidl.assertBranded(this, Response);
|
webidl.assertBranded(this, ResponsePrototype);
|
||||||
if (this[_body] && this[_body].unusable()) {
|
if (this[_body] && this[_body].unusable()) {
|
||||||
throw new TypeError("Body is unusable.");
|
throw new TypeError("Body is unusable.");
|
||||||
}
|
}
|
||||||
|
@ -375,7 +376,7 @@
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof Response,
|
evaluate: ObjectPrototypeIsPrototypeOf(ResponsePrototype, this),
|
||||||
keys: [
|
keys: [
|
||||||
"body",
|
"body",
|
||||||
"bodyUsed",
|
"bodyUsed",
|
||||||
|
@ -390,13 +391,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mixinBody(Response, _body, _mimeType);
|
|
||||||
|
|
||||||
webidl.configurePrototype(Response);
|
webidl.configurePrototype(Response);
|
||||||
|
const ResponsePrototype = Response.prototype;
|
||||||
|
mixinBody(ResponsePrototype, _body, _mimeType);
|
||||||
|
|
||||||
webidl.converters["Response"] = webidl.createInterfaceConverter(
|
webidl.converters["Response"] = webidl.createInterfaceConverter(
|
||||||
"Response",
|
"Response",
|
||||||
Response,
|
ResponsePrototype,
|
||||||
);
|
);
|
||||||
webidl.converters["ResponseInit"] = webidl.createDictionaryConverter(
|
webidl.converters["ResponseInit"] = webidl.createDictionaryConverter(
|
||||||
"ResponseInit",
|
"ResponseInit",
|
||||||
|
@ -457,6 +458,7 @@
|
||||||
|
|
||||||
window.__bootstrap.fetch ??= {};
|
window.__bootstrap.fetch ??= {};
|
||||||
window.__bootstrap.fetch.Response = Response;
|
window.__bootstrap.fetch.Response = Response;
|
||||||
|
window.__bootstrap.fetch.ResponsePrototype = ResponsePrototype;
|
||||||
window.__bootstrap.fetch.newInnerResponse = newInnerResponse;
|
window.__bootstrap.fetch.newInnerResponse = newInnerResponse;
|
||||||
window.__bootstrap.fetch.toInnerResponse = toInnerResponse;
|
window.__bootstrap.fetch.toInnerResponse = toInnerResponse;
|
||||||
window.__bootstrap.fetch.fromInnerResponse = fromInnerResponse;
|
window.__bootstrap.fetch.fromInnerResponse = fromInnerResponse;
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const { byteLowerCase } = window.__bootstrap.infra;
|
const { byteLowerCase } = window.__bootstrap.infra;
|
||||||
const { errorReadableStream } = window.__bootstrap.streams;
|
const { BlobPrototype } = window.__bootstrap.file;
|
||||||
|
const { errorReadableStream, ReadableStreamPrototype } =
|
||||||
|
window.__bootstrap.streams;
|
||||||
const { InnerBody, extractBody } = window.__bootstrap.fetchBody;
|
const { InnerBody, extractBody } = window.__bootstrap.fetchBody;
|
||||||
const {
|
const {
|
||||||
toInnerRequest,
|
toInnerRequest,
|
||||||
|
@ -32,6 +34,7 @@
|
||||||
ArrayPrototypeSplice,
|
ArrayPrototypeSplice,
|
||||||
ArrayPrototypeFilter,
|
ArrayPrototypeFilter,
|
||||||
ArrayPrototypeIncludes,
|
ArrayPrototypeIncludes,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
Promise,
|
Promise,
|
||||||
PromisePrototypeThen,
|
PromisePrototypeThen,
|
||||||
PromisePrototypeCatch,
|
PromisePrototypeCatch,
|
||||||
|
@ -41,6 +44,7 @@
|
||||||
TypedArrayPrototypeSubarray,
|
TypedArrayPrototypeSubarray,
|
||||||
TypeError,
|
TypeError,
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
|
Uint8ArrayPrototype,
|
||||||
WeakMap,
|
WeakMap,
|
||||||
WeakMapPrototypeDelete,
|
WeakMapPrototypeDelete,
|
||||||
WeakMapPrototypeGet,
|
WeakMapPrototypeGet,
|
||||||
|
@ -172,8 +176,16 @@
|
||||||
let reqBody = null;
|
let reqBody = null;
|
||||||
|
|
||||||
if (req.body !== null) {
|
if (req.body !== null) {
|
||||||
if (req.body.streamOrStatic instanceof ReadableStream) {
|
if (
|
||||||
if (req.body.length === null || req.body.source instanceof Blob) {
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
req.body.streamOrStatic,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (
|
||||||
|
req.body.length === null ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(BlobPrototype, req.body.source)
|
||||||
|
) {
|
||||||
reqBody = req.body.stream;
|
reqBody = req.body.stream;
|
||||||
} else {
|
} else {
|
||||||
const reader = req.body.stream.getReader();
|
const reader = req.body.stream.getReader();
|
||||||
|
@ -196,14 +208,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { requestRid, requestBodyRid, cancelHandleRid } = opFetch({
|
const { requestRid, requestBodyRid, cancelHandleRid } = opFetch(
|
||||||
|
{
|
||||||
method: req.method,
|
method: req.method,
|
||||||
url: req.currentUrl(),
|
url: req.currentUrl(),
|
||||||
headers: req.headerList,
|
headers: req.headerList,
|
||||||
clientRid: req.clientRid,
|
clientRid: req.clientRid,
|
||||||
hasBody: reqBody !== null,
|
hasBody: reqBody !== null,
|
||||||
bodyLength: req.body?.length,
|
bodyLength: req.body?.length,
|
||||||
}, reqBody instanceof Uint8Array ? reqBody : null);
|
},
|
||||||
|
ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, reqBody)
|
||||||
|
? reqBody
|
||||||
|
: null,
|
||||||
|
);
|
||||||
|
|
||||||
function onAbort() {
|
function onAbort() {
|
||||||
if (cancelHandleRid !== null) {
|
if (cancelHandleRid !== null) {
|
||||||
|
@ -216,7 +233,10 @@
|
||||||
terminator[abortSignal.add](onAbort);
|
terminator[abortSignal.add](onAbort);
|
||||||
|
|
||||||
if (requestBodyRid !== null) {
|
if (requestBodyRid !== null) {
|
||||||
if (reqBody === null || !(reqBody instanceof ReadableStream)) {
|
if (
|
||||||
|
reqBody === null ||
|
||||||
|
!ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, reqBody)
|
||||||
|
) {
|
||||||
throw new TypeError("Unreachable");
|
throw new TypeError("Unreachable");
|
||||||
}
|
}
|
||||||
const reader = reqBody.getReader();
|
const reader = reqBody.getReader();
|
||||||
|
@ -231,7 +251,7 @@
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (done) break;
|
if (done) break;
|
||||||
if (!(value instanceof Uint8Array)) {
|
if (!ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, value)) {
|
||||||
await reader.cancel("value not a Uint8Array");
|
await reader.cancel("value not a Uint8Array");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const __bootstrap = window.__bootstrap;
|
const __bootstrap = window.__bootstrap;
|
||||||
const {
|
const {
|
||||||
ArrayBuffer,
|
ArrayBufferPrototype,
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
BigInt,
|
BigInt,
|
||||||
Number,
|
Number,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
TypeError,
|
TypeError,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
|
@ -141,6 +142,7 @@
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const UnsafePointerPrototype = UnsafePointer.prototype;
|
||||||
|
|
||||||
function prepareArgs(types, args) {
|
function prepareArgs(types, args) {
|
||||||
const parameters = [];
|
const parameters = [];
|
||||||
|
@ -152,12 +154,12 @@
|
||||||
|
|
||||||
if (type === "pointer") {
|
if (type === "pointer") {
|
||||||
if (
|
if (
|
||||||
arg?.buffer instanceof ArrayBuffer &&
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, arg?.buffer) &&
|
||||||
arg.byteLength !== undefined
|
arg.byteLength !== undefined
|
||||||
) {
|
) {
|
||||||
parameters.push(buffers.length);
|
parameters.push(buffers.length);
|
||||||
buffers.push(arg);
|
buffers.push(arg);
|
||||||
} else if (arg instanceof UnsafePointer) {
|
} else if (ObjectPrototypeIsPrototypeOf(UnsafePointerPrototype, arg)) {
|
||||||
parameters.push(packU64(arg.value));
|
parameters.push(packU64(arg.value));
|
||||||
buffers.push(undefined);
|
buffers.push(undefined);
|
||||||
} else if (arg === null) {
|
} else if (arg === null) {
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const { InnerBody } = window.__bootstrap.fetchBody;
|
const { InnerBody } = window.__bootstrap.fetchBody;
|
||||||
const { setEventTargetData } = window.__bootstrap.eventTarget;
|
const { setEventTargetData } = window.__bootstrap.eventTarget;
|
||||||
|
const { BlobPrototype } = window.__bootstrap.file;
|
||||||
const {
|
const {
|
||||||
Response,
|
ResponsePrototype,
|
||||||
fromInnerRequest,
|
fromInnerRequest,
|
||||||
toInnerResponse,
|
toInnerResponse,
|
||||||
newInnerRequest,
|
newInnerRequest,
|
||||||
|
@ -14,8 +15,9 @@
|
||||||
fromInnerResponse,
|
fromInnerResponse,
|
||||||
} = window.__bootstrap.fetch;
|
} = window.__bootstrap.fetch;
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const { BadResource, Interrupted } = core;
|
const { BadResourcePrototype, InterruptedPrototype } = core;
|
||||||
const { ReadableStream } = window.__bootstrap.streams;
|
const { ReadableStream, ReadableStreamPrototype } =
|
||||||
|
window.__bootstrap.streams;
|
||||||
const abortSignal = window.__bootstrap.abortSignal;
|
const abortSignal = window.__bootstrap.abortSignal;
|
||||||
const {
|
const {
|
||||||
WebSocket,
|
WebSocket,
|
||||||
|
@ -32,7 +34,8 @@
|
||||||
ArrayPrototypeIncludes,
|
ArrayPrototypeIncludes,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
ArrayPrototypeSome,
|
ArrayPrototypeSome,
|
||||||
Promise,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
|
PromisePrototype,
|
||||||
Set,
|
Set,
|
||||||
SetPrototypeAdd,
|
SetPrototypeAdd,
|
||||||
SetPrototypeDelete,
|
SetPrototypeDelete,
|
||||||
|
@ -46,6 +49,7 @@
|
||||||
TypedArrayPrototypeSubarray,
|
TypedArrayPrototypeSubarray,
|
||||||
TypeError,
|
TypeError,
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
|
Uint8ArrayPrototype,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
const connErrorSymbol = Symbol("connError");
|
const connErrorSymbol = Symbol("connError");
|
||||||
|
@ -81,8 +85,8 @@
|
||||||
// those with it.
|
// those with it.
|
||||||
this[connErrorSymbol] = error;
|
this[connErrorSymbol] = error;
|
||||||
if (
|
if (
|
||||||
error instanceof BadResource ||
|
ObjectPrototypeIsPrototypeOf(BadResourcePrototype, error) ||
|
||||||
error instanceof Interrupted ||
|
ObjectPrototypeIsPrototypeOf(InterruptedPrototype, error) ||
|
||||||
StringPrototypeIncludes(error.message, "connection closed")
|
StringPrototypeIncludes(error.message, "connection closed")
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -158,11 +162,11 @@
|
||||||
function createRespondWith(httpConn, streamRid) {
|
function createRespondWith(httpConn, streamRid) {
|
||||||
return async function respondWith(resp) {
|
return async function respondWith(resp) {
|
||||||
try {
|
try {
|
||||||
if (resp instanceof Promise) {
|
if (ObjectPrototypeIsPrototypeOf(PromisePrototype, resp)) {
|
||||||
resp = await resp;
|
resp = await resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(resp instanceof Response)) {
|
if (!(ObjectPrototypeIsPrototypeOf(ResponsePrototype, resp))) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
"First argument to respondWith must be a Response or a promise resolving to a Response.",
|
"First argument to respondWith must be a Response or a promise resolving to a Response.",
|
||||||
);
|
);
|
||||||
|
@ -179,10 +183,18 @@
|
||||||
if (innerResp.body.unusable()) {
|
if (innerResp.body.unusable()) {
|
||||||
throw new TypeError("Body is unusable.");
|
throw new TypeError("Body is unusable.");
|
||||||
}
|
}
|
||||||
if (innerResp.body.streamOrStatic instanceof ReadableStream) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamPrototype,
|
||||||
|
innerResp.body.streamOrStatic,
|
||||||
|
)
|
||||||
|
) {
|
||||||
if (
|
if (
|
||||||
innerResp.body.length === null ||
|
innerResp.body.length === null ||
|
||||||
innerResp.body.source instanceof Blob
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
BlobPrototype,
|
||||||
|
innerResp.body.source,
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
respBody = innerResp.body.stream;
|
respBody = innerResp.body.stream;
|
||||||
} else {
|
} else {
|
||||||
|
@ -204,7 +216,8 @@
|
||||||
respBody = new Uint8Array(0);
|
respBody = new Uint8Array(0);
|
||||||
}
|
}
|
||||||
const isStreamingResponseBody = !(
|
const isStreamingResponseBody = !(
|
||||||
typeof respBody === "string" || respBody instanceof Uint8Array
|
typeof respBody === "string" ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, respBody)
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -215,25 +228,34 @@
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const connError = httpConn[connErrorSymbol];
|
const connError = httpConn[connErrorSymbol];
|
||||||
if (error instanceof BadResource && connError != null) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(BadResourcePrototype, error) &&
|
||||||
|
connError != null
|
||||||
|
) {
|
||||||
// deno-lint-ignore no-ex-assign
|
// deno-lint-ignore no-ex-assign
|
||||||
error = new connError.constructor(connError.message);
|
error = new connError.constructor(connError.message);
|
||||||
}
|
}
|
||||||
if (respBody !== null && respBody instanceof ReadableStream) {
|
if (
|
||||||
|
respBody !== null &&
|
||||||
|
ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, respBody)
|
||||||
|
) {
|
||||||
await respBody.cancel(error);
|
await respBody.cancel(error);
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isStreamingResponseBody) {
|
if (isStreamingResponseBody) {
|
||||||
if (respBody === null || !(respBody instanceof ReadableStream)) {
|
if (
|
||||||
|
respBody === null ||
|
||||||
|
!ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, respBody)
|
||||||
|
) {
|
||||||
throw new TypeError("Unreachable");
|
throw new TypeError("Unreachable");
|
||||||
}
|
}
|
||||||
const reader = respBody.getReader();
|
const reader = respBody.getReader();
|
||||||
while (true) {
|
while (true) {
|
||||||
const { value, done } = await reader.read();
|
const { value, done } = await reader.read();
|
||||||
if (done) break;
|
if (done) break;
|
||||||
if (!(value instanceof Uint8Array)) {
|
if (!ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, value)) {
|
||||||
await reader.cancel(new TypeError("Value not a Uint8Array"));
|
await reader.cancel(new TypeError("Value not a Uint8Array"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +263,10 @@
|
||||||
await core.opAsync("op_http_write", streamRid, value);
|
await core.opAsync("op_http_write", streamRid, value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const connError = httpConn[connErrorSymbol];
|
const connError = httpConn[connErrorSymbol];
|
||||||
if (error instanceof BadResource && connError != null) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(BadResourcePrototype, error) &&
|
||||||
|
connError != null
|
||||||
|
) {
|
||||||
// deno-lint-ignore no-ex-assign
|
// deno-lint-ignore no-ex-assign
|
||||||
error = new connError.constructor(connError.message);
|
error = new connError.constructor(connError.message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const { BadResource, Interrupted } = core;
|
const { BadResourcePrototype, InterruptedPrototype } = core;
|
||||||
const {
|
const {
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
PromiseResolve,
|
PromiseResolve,
|
||||||
SymbolAsyncIterator,
|
SymbolAsyncIterator,
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
|
@ -124,7 +125,10 @@
|
||||||
try {
|
try {
|
||||||
conn = await this.accept();
|
conn = await this.accept();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof BadResource || error instanceof Interrupted) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(BadResourcePrototype, error) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(InterruptedPrototype, error)
|
||||||
|
) {
|
||||||
return { value: undefined, done: true };
|
return { value: undefined, done: true };
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -191,7 +195,10 @@
|
||||||
try {
|
try {
|
||||||
yield await this.receive();
|
yield await this.receive();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof BadResource || err instanceof Interrupted) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(BadResourcePrototype, err) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(InterruptedPrototype, err)
|
||||||
|
) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
// deno-lint-ignore camelcase
|
// deno-lint-ignore camelcase
|
||||||
NumberPOSITIVE_INFINITY,
|
NumberPOSITIVE_INFINITY,
|
||||||
PromisePrototypeThen,
|
PromisePrototypeThen,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
TypeError,
|
TypeError,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -287,7 +288,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err instanceof core.Interrupted) {
|
if (ObjectPrototypeIsPrototypeOf(core.InterruptedPrototype, err)) {
|
||||||
// The timer was cancelled.
|
// The timer was cancelled.
|
||||||
removeFromScheduledTimers(timerObject);
|
removeFromScheduledTimers(timerObject);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
ArrayPrototypeReverse,
|
ArrayPrototypeReverse,
|
||||||
ArrayPrototypeSlice,
|
ArrayPrototypeSlice,
|
||||||
ObjectKeys,
|
ObjectKeys,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -127,22 +128,22 @@
|
||||||
[_duration] = 0;
|
[_duration] = 0;
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
webidl.assertBranded(this, PerformanceEntry);
|
webidl.assertBranded(this, PerformanceEntryPrototype);
|
||||||
return this[_name];
|
return this[_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
get entryType() {
|
get entryType() {
|
||||||
webidl.assertBranded(this, PerformanceEntry);
|
webidl.assertBranded(this, PerformanceEntryPrototype);
|
||||||
return this[_entryType];
|
return this[_entryType];
|
||||||
}
|
}
|
||||||
|
|
||||||
get startTime() {
|
get startTime() {
|
||||||
webidl.assertBranded(this, PerformanceEntry);
|
webidl.assertBranded(this, PerformanceEntryPrototype);
|
||||||
return this[_startTime];
|
return this[_startTime];
|
||||||
}
|
}
|
||||||
|
|
||||||
get duration() {
|
get duration() {
|
||||||
webidl.assertBranded(this, PerformanceEntry);
|
webidl.assertBranded(this, PerformanceEntryPrototype);
|
||||||
return this[_duration];
|
return this[_duration];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
toJSON() {
|
toJSON() {
|
||||||
webidl.assertBranded(this, PerformanceEntry);
|
webidl.assertBranded(this, PerformanceEntryPrototype);
|
||||||
return {
|
return {
|
||||||
name: this[_name],
|
name: this[_name],
|
||||||
entryType: this[_entryType],
|
entryType: this[_entryType],
|
||||||
|
@ -177,7 +178,10 @@
|
||||||
[customInspect](inspect) {
|
[customInspect](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof PerformanceEntry,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
PerformanceEntryPrototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: [
|
keys: [
|
||||||
"name",
|
"name",
|
||||||
"entryType",
|
"entryType",
|
||||||
|
@ -188,18 +192,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
webidl.configurePrototype(PerformanceEntry);
|
webidl.configurePrototype(PerformanceEntry);
|
||||||
|
const PerformanceEntryPrototype = PerformanceEntry.prototype;
|
||||||
|
|
||||||
const _detail = Symbol("[[detail]]");
|
const _detail = Symbol("[[detail]]");
|
||||||
class PerformanceMark extends PerformanceEntry {
|
class PerformanceMark extends PerformanceEntry {
|
||||||
[_detail] = null;
|
[_detail] = null;
|
||||||
|
|
||||||
get detail() {
|
get detail() {
|
||||||
webidl.assertBranded(this, PerformanceMark);
|
webidl.assertBranded(this, PerformanceMarkPrototype);
|
||||||
return this[_detail];
|
return this[_detail];
|
||||||
}
|
}
|
||||||
|
|
||||||
get entryType() {
|
get entryType() {
|
||||||
webidl.assertBranded(this, PerformanceMark);
|
webidl.assertBranded(this, PerformanceMarkPrototype);
|
||||||
return "mark";
|
return "mark";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +236,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
toJSON() {
|
toJSON() {
|
||||||
webidl.assertBranded(this, PerformanceMark);
|
webidl.assertBranded(this, PerformanceMarkPrototype);
|
||||||
return {
|
return {
|
||||||
name: this.name,
|
name: this.name,
|
||||||
entryType: this.entryType,
|
entryType: this.entryType,
|
||||||
|
@ -244,7 +249,7 @@
|
||||||
[customInspect](inspect) {
|
[customInspect](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof PerformanceMark,
|
evaluate: ObjectPrototypeIsPrototypeOf(PerformanceMarkPrototype, this),
|
||||||
keys: [
|
keys: [
|
||||||
"name",
|
"name",
|
||||||
"entryType",
|
"entryType",
|
||||||
|
@ -256,17 +261,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
webidl.configurePrototype(PerformanceMark);
|
webidl.configurePrototype(PerformanceMark);
|
||||||
|
const PerformanceMarkPrototype = PerformanceMark.prototype;
|
||||||
class PerformanceMeasure extends PerformanceEntry {
|
class PerformanceMeasure extends PerformanceEntry {
|
||||||
[_detail] = null;
|
[_detail] = null;
|
||||||
|
|
||||||
get detail() {
|
get detail() {
|
||||||
webidl.assertBranded(this, PerformanceMeasure);
|
webidl.assertBranded(this, PerformanceMeasurePrototype);
|
||||||
return this[_detail];
|
return this[_detail];
|
||||||
}
|
}
|
||||||
|
|
||||||
get entryType() {
|
get entryType() {
|
||||||
webidl.assertBranded(this, PerformanceMeasure);
|
webidl.assertBranded(this, PerformanceMeasurePrototype);
|
||||||
return "measure";
|
return "measure";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +292,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
toJSON() {
|
toJSON() {
|
||||||
webidl.assertBranded(this, PerformanceMeasure);
|
webidl.assertBranded(this, PerformanceMeasurePrototype);
|
||||||
return {
|
return {
|
||||||
name: this.name,
|
name: this.name,
|
||||||
entryType: this.entryType,
|
entryType: this.entryType,
|
||||||
|
@ -300,7 +305,10 @@
|
||||||
[customInspect](inspect) {
|
[customInspect](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof PerformanceMeasure,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
PerformanceMeasurePrototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: [
|
keys: [
|
||||||
"name",
|
"name",
|
||||||
"entryType",
|
"entryType",
|
||||||
|
@ -312,14 +320,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
webidl.configurePrototype(PerformanceMeasure);
|
webidl.configurePrototype(PerformanceMeasure);
|
||||||
|
const PerformanceMeasurePrototype = PerformanceMeasure.prototype;
|
||||||
class Performance {
|
class Performance {
|
||||||
constructor() {
|
constructor() {
|
||||||
webidl.illegalConstructor();
|
webidl.illegalConstructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearMarks(markName = undefined) {
|
clearMarks(markName = undefined) {
|
||||||
webidl.assertBranded(this, Performance);
|
webidl.assertBranded(this, PerformancePrototype);
|
||||||
if (markName !== undefined) {
|
if (markName !== undefined) {
|
||||||
markName = webidl.converters.DOMString(markName, {
|
markName = webidl.converters.DOMString(markName, {
|
||||||
prefix: "Failed to execute 'clearMarks' on 'Performance'",
|
prefix: "Failed to execute 'clearMarks' on 'Performance'",
|
||||||
|
@ -339,7 +347,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
clearMeasures(measureName = undefined) {
|
clearMeasures(measureName = undefined) {
|
||||||
webidl.assertBranded(this, Performance);
|
webidl.assertBranded(this, PerformancePrototype);
|
||||||
if (measureName !== undefined) {
|
if (measureName !== undefined) {
|
||||||
measureName = webidl.converters.DOMString(measureName, {
|
measureName = webidl.converters.DOMString(measureName, {
|
||||||
prefix: "Failed to execute 'clearMeasures' on 'Performance'",
|
prefix: "Failed to execute 'clearMeasures' on 'Performance'",
|
||||||
|
@ -360,7 +368,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
getEntries() {
|
getEntries() {
|
||||||
webidl.assertBranded(this, Performance);
|
webidl.assertBranded(this, PerformancePrototype);
|
||||||
return filterByNameType();
|
return filterByNameType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +376,7 @@
|
||||||
name,
|
name,
|
||||||
type = undefined,
|
type = undefined,
|
||||||
) {
|
) {
|
||||||
webidl.assertBranded(this, Performance);
|
webidl.assertBranded(this, PerformancePrototype);
|
||||||
const prefix = "Failed to execute 'getEntriesByName' on 'Performance'";
|
const prefix = "Failed to execute 'getEntriesByName' on 'Performance'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
|
||||||
|
@ -388,7 +396,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
getEntriesByType(type) {
|
getEntriesByType(type) {
|
||||||
webidl.assertBranded(this, Performance);
|
webidl.assertBranded(this, PerformancePrototype);
|
||||||
const prefix = "Failed to execute 'getEntriesByName' on 'Performance'";
|
const prefix = "Failed to execute 'getEntriesByName' on 'Performance'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
|
||||||
|
@ -404,7 +412,7 @@
|
||||||
markName,
|
markName,
|
||||||
markOptions = {},
|
markOptions = {},
|
||||||
) {
|
) {
|
||||||
webidl.assertBranded(this, Performance);
|
webidl.assertBranded(this, PerformancePrototype);
|
||||||
const prefix = "Failed to execute 'mark' on 'Performance'";
|
const prefix = "Failed to execute 'mark' on 'Performance'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
|
||||||
|
@ -432,7 +440,7 @@
|
||||||
startOrMeasureOptions = {},
|
startOrMeasureOptions = {},
|
||||||
endMark = undefined,
|
endMark = undefined,
|
||||||
) {
|
) {
|
||||||
webidl.assertBranded(this, Performance);
|
webidl.assertBranded(this, PerformancePrototype);
|
||||||
const prefix = "Failed to execute 'measure' on 'Performance'";
|
const prefix = "Failed to execute 'measure' on 'Performance'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
|
||||||
|
@ -531,24 +539,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
now() {
|
now() {
|
||||||
webidl.assertBranded(this, Performance);
|
webidl.assertBranded(this, PerformancePrototype);
|
||||||
return now();
|
return now();
|
||||||
}
|
}
|
||||||
|
|
||||||
toJSON() {
|
toJSON() {
|
||||||
webidl.assertBranded(this, Performance);
|
webidl.assertBranded(this, PerformancePrototype);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
[customInspect](inspect) {
|
[customInspect](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof Performance,
|
evaluate: ObjectPrototypeIsPrototypeOf(PerformancePrototype, this),
|
||||||
keys: [],
|
keys: [],
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
webidl.configurePrototype(Performance);
|
webidl.configurePrototype(Performance);
|
||||||
|
const PerformancePrototype = Performance.prototype;
|
||||||
|
|
||||||
window.__bootstrap.performance = {
|
window.__bootstrap.performance = {
|
||||||
PerformanceEntry,
|
PerformanceEntry,
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
* @param {string} value
|
* @param {string} value
|
||||||
*/
|
*/
|
||||||
append(name, value) {
|
append(name, value) {
|
||||||
webidl.assertBranded(this, URLSearchParams);
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
||||||
const prefix = "Failed to execute 'append' on 'URLSearchParams'";
|
const prefix = "Failed to execute 'append' on 'URLSearchParams'";
|
||||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||||
name = webidl.converters.USVString(name, {
|
name = webidl.converters.USVString(name, {
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
*/
|
*/
|
||||||
delete(name) {
|
delete(name) {
|
||||||
webidl.assertBranded(this, URLSearchParams);
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
||||||
const prefix = "Failed to execute 'append' on 'URLSearchParams'";
|
const prefix = "Failed to execute 'append' on 'URLSearchParams'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
name = webidl.converters.USVString(name, {
|
name = webidl.converters.USVString(name, {
|
||||||
|
@ -177,7 +177,7 @@
|
||||||
* @returns {string[]}
|
* @returns {string[]}
|
||||||
*/
|
*/
|
||||||
getAll(name) {
|
getAll(name) {
|
||||||
webidl.assertBranded(this, URLSearchParams);
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
||||||
const prefix = "Failed to execute 'getAll' on 'URLSearchParams'";
|
const prefix = "Failed to execute 'getAll' on 'URLSearchParams'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
name = webidl.converters.USVString(name, {
|
name = webidl.converters.USVString(name, {
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
* @return {string | null}
|
* @return {string | null}
|
||||||
*/
|
*/
|
||||||
get(name) {
|
get(name) {
|
||||||
webidl.assertBranded(this, URLSearchParams);
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
||||||
const prefix = "Failed to execute 'get' on 'URLSearchParams'";
|
const prefix = "Failed to execute 'get' on 'URLSearchParams'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
name = webidl.converters.USVString(name, {
|
name = webidl.converters.USVString(name, {
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
has(name) {
|
has(name) {
|
||||||
webidl.assertBranded(this, URLSearchParams);
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
||||||
const prefix = "Failed to execute 'has' on 'URLSearchParams'";
|
const prefix = "Failed to execute 'has' on 'URLSearchParams'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
name = webidl.converters.USVString(name, {
|
name = webidl.converters.USVString(name, {
|
||||||
|
@ -233,7 +233,7 @@
|
||||||
* @param {string} value
|
* @param {string} value
|
||||||
*/
|
*/
|
||||||
set(name, value) {
|
set(name, value) {
|
||||||
webidl.assertBranded(this, URLSearchParams);
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
||||||
const prefix = "Failed to execute 'set' on 'URLSearchParams'";
|
const prefix = "Failed to execute 'set' on 'URLSearchParams'";
|
||||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||||
name = webidl.converters.USVString(name, {
|
name = webidl.converters.USVString(name, {
|
||||||
|
@ -276,7 +276,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
sort() {
|
sort() {
|
||||||
webidl.assertBranded(this, URLSearchParams);
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
||||||
ArrayPrototypeSort(
|
ArrayPrototypeSort(
|
||||||
this[_list],
|
this[_list],
|
||||||
(a, b) => (a[0] === b[0] ? 0 : a[0] > b[0] ? 1 : -1),
|
(a, b) => (a[0] === b[0] ? 0 : a[0] > b[0] ? 1 : -1),
|
||||||
|
@ -288,7 +288,7 @@
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
toString() {
|
toString() {
|
||||||
webidl.assertBranded(this, URLSearchParams);
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
||||||
return core.opSync("op_url_stringify_search_params", this[_list]);
|
return core.opSync("op_url_stringify_search_params", this[_list]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,6 +296,7 @@
|
||||||
webidl.mixinPairIterable("URLSearchParams", URLSearchParams, _list, 0, 1);
|
webidl.mixinPairIterable("URLSearchParams", URLSearchParams, _list, 0, 1);
|
||||||
|
|
||||||
webidl.configurePrototype(URLSearchParams);
|
webidl.configurePrototype(URLSearchParams);
|
||||||
|
const URLSearchParamsPrototype = URLSearchParams.prototype;
|
||||||
|
|
||||||
const _url = Symbol("url");
|
const _url = Symbol("url");
|
||||||
|
|
||||||
|
@ -350,13 +351,13 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get hash() {
|
get hash() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].hash;
|
return this[_url].hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set hash(value) {
|
set hash(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'hash' on 'URL'";
|
const prefix = "Failed to set 'hash' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -372,13 +373,13 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get host() {
|
get host() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].host;
|
return this[_url].host;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set host(value) {
|
set host(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'host' on 'URL'";
|
const prefix = "Failed to set 'host' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -394,13 +395,13 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get hostname() {
|
get hostname() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].hostname;
|
return this[_url].hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set hostname(value) {
|
set hostname(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'hostname' on 'URL'";
|
const prefix = "Failed to set 'hostname' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -416,13 +417,13 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get href() {
|
get href() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].href;
|
return this[_url].href;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set href(value) {
|
set href(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'href' on 'URL'";
|
const prefix = "Failed to set 'href' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -435,19 +436,19 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get origin() {
|
get origin() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].origin;
|
return this[_url].origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get password() {
|
get password() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].password;
|
return this[_url].password;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set password(value) {
|
set password(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'password' on 'URL'";
|
const prefix = "Failed to set 'password' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -463,13 +464,13 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get pathname() {
|
get pathname() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].pathname;
|
return this[_url].pathname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set pathname(value) {
|
set pathname(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'pathname' on 'URL'";
|
const prefix = "Failed to set 'pathname' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -485,13 +486,13 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get port() {
|
get port() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].port;
|
return this[_url].port;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set port(value) {
|
set port(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'port' on 'URL'";
|
const prefix = "Failed to set 'port' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -507,13 +508,13 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get protocol() {
|
get protocol() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].protocol;
|
return this[_url].protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set protocol(value) {
|
set protocol(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'protocol' on 'URL'";
|
const prefix = "Failed to set 'protocol' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -529,13 +530,13 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get search() {
|
get search() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].search;
|
return this[_url].search;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set search(value) {
|
set search(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'search' on 'URL'";
|
const prefix = "Failed to set 'search' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -552,13 +553,13 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
get username() {
|
get username() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].username;
|
return this[_url].username;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {string} value */
|
/** @param {string} value */
|
||||||
set username(value) {
|
set username(value) {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
const prefix = "Failed to set 'username' on 'URL'";
|
const prefix = "Failed to set 'username' on 'URL'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
|
@ -583,18 +584,19 @@
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
toString() {
|
toString() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].href;
|
return this[_url].href;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {string} */
|
/** @return {string} */
|
||||||
toJSON() {
|
toJSON() {
|
||||||
webidl.assertBranded(this, URL);
|
webidl.assertBranded(this, URLPrototype);
|
||||||
return this[_url].href;
|
return this[_url].href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(URL);
|
webidl.configurePrototype(URL);
|
||||||
|
const URLPrototype = URL.prototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function implements application/x-www-form-urlencoded parsing.
|
* This function implements application/x-www-form-urlencoded parsing.
|
||||||
|
@ -622,7 +624,9 @@
|
||||||
|
|
||||||
window.__bootstrap.url = {
|
window.__bootstrap.url = {
|
||||||
URL,
|
URL,
|
||||||
|
URLPrototype,
|
||||||
URLSearchParams,
|
URLSearchParams,
|
||||||
|
URLSearchParamsPrototype,
|
||||||
parseUrlEncoded,
|
parseUrlEncoded,
|
||||||
};
|
};
|
||||||
})(this);
|
})(this);
|
||||||
|
|
|
@ -85,42 +85,42 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get protocol() {
|
get protocol() {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
return this[_components].protocol.patternString;
|
return this[_components].protocol.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
get username() {
|
get username() {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
return this[_components].username.patternString;
|
return this[_components].username.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
get password() {
|
get password() {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
return this[_components].password.patternString;
|
return this[_components].password.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
get hostname() {
|
get hostname() {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
return this[_components].hostname.patternString;
|
return this[_components].hostname.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
get port() {
|
get port() {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
return this[_components].port.patternString;
|
return this[_components].port.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
get pathname() {
|
get pathname() {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
return this[_components].pathname.patternString;
|
return this[_components].pathname.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
get search() {
|
get search() {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
return this[_components].search.patternString;
|
return this[_components].search.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
get hash() {
|
get hash() {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
return this[_components].hash.patternString;
|
return this[_components].hash.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
test(input, baseURL = undefined) {
|
test(input, baseURL = undefined) {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
const prefix = "Failed to execute 'test' on 'URLPattern'";
|
const prefix = "Failed to execute 'test' on 'URLPattern'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
input = webidl.converters.URLPatternInput(input, {
|
input = webidl.converters.URLPatternInput(input, {
|
||||||
|
@ -170,7 +170,7 @@
|
||||||
* @returns {URLPatternResult | null}
|
* @returns {URLPatternResult | null}
|
||||||
*/
|
*/
|
||||||
exec(input, baseURL = undefined) {
|
exec(input, baseURL = undefined) {
|
||||||
webidl.assertBranded(this, URLPattern);
|
webidl.assertBranded(this, URLPatternPrototype);
|
||||||
const prefix = "Failed to execute 'exec' on 'URLPattern'";
|
const prefix = "Failed to execute 'exec' on 'URLPattern'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
input = webidl.converters.URLPatternInput(input, {
|
input = webidl.converters.URLPatternInput(input, {
|
||||||
|
@ -241,6 +241,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(URLPattern);
|
webidl.configurePrototype(URLPattern);
|
||||||
|
const URLPatternPrototype = URLPattern.prototype;
|
||||||
|
|
||||||
webidl.converters.URLPatternInit = webidl
|
webidl.converters.URLPatternInit = webidl
|
||||||
.createDictionaryConverter("URLPatternInit", [
|
.createDictionaryConverter("URLPatternInit", [
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
ErrorPrototype,
|
ErrorPrototype,
|
||||||
ObjectDefineProperty,
|
ObjectDefineProperty,
|
||||||
ObjectEntries,
|
ObjectEntries,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectSetPrototypeOf,
|
ObjectSetPrototypeOf,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -126,7 +127,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
if (this instanceof DOMException) {
|
if (ObjectPrototypeIsPrototypeOf(DOMExceptionPrototype, this)) {
|
||||||
return `DOMException: ${this.#message}`;
|
return `DOMException: ${this.#message}`;
|
||||||
} else {
|
} else {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
|
@ -145,6 +146,7 @@
|
||||||
ObjectSetPrototypeOf(DOMException.prototype, ErrorPrototype);
|
ObjectSetPrototypeOf(DOMException.prototype, ErrorPrototype);
|
||||||
|
|
||||||
webidl.configurePrototype(DOMException);
|
webidl.configurePrototype(DOMException);
|
||||||
|
const DOMExceptionPrototype = DOMException.prototype;
|
||||||
|
|
||||||
for (
|
for (
|
||||||
const [key, value] of ObjectEntries({
|
const [key, value] of ObjectEntries({
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
ObjectCreate,
|
ObjectCreate,
|
||||||
ObjectDefineProperty,
|
ObjectDefineProperty,
|
||||||
ObjectGetOwnPropertyDescriptor,
|
ObjectGetOwnPropertyDescriptor,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ReflectDefineProperty,
|
ReflectDefineProperty,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
|
@ -174,7 +175,7 @@
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof Event,
|
evaluate: ObjectPrototypeIsPrototypeOf(Event.prototype, this),
|
||||||
keys: EVENT_PROPS,
|
keys: EVENT_PROPS,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -1058,7 +1059,7 @@
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof ErrorEvent,
|
evaluate: ObjectPrototypeIsPrototypeOf(ErrorEvent.prototype, this),
|
||||||
keys: [
|
keys: [
|
||||||
...EVENT_PROPS,
|
...EVENT_PROPS,
|
||||||
"message",
|
"message",
|
||||||
|
@ -1119,7 +1120,7 @@
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof CloseEvent,
|
evaluate: ObjectPrototypeIsPrototypeOf(CloseEvent.prototype, this),
|
||||||
keys: [
|
keys: [
|
||||||
...EVENT_PROPS,
|
...EVENT_PROPS,
|
||||||
"wasClean",
|
"wasClean",
|
||||||
|
@ -1151,7 +1152,7 @@
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof MessageEvent,
|
evaluate: ObjectPrototypeIsPrototypeOf(MessageEvent.prototype, this),
|
||||||
keys: [
|
keys: [
|
||||||
...EVENT_PROPS,
|
...EVENT_PROPS,
|
||||||
"data",
|
"data",
|
||||||
|
@ -1184,7 +1185,7 @@
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof CustomEvent,
|
evaluate: ObjectPrototypeIsPrototypeOf(CustomEvent.prototype, this),
|
||||||
keys: [
|
keys: [
|
||||||
...EVENT_PROPS,
|
...EVENT_PROPS,
|
||||||
"detail",
|
"detail",
|
||||||
|
@ -1214,7 +1215,7 @@
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof ProgressEvent,
|
evaluate: ObjectPrototypeIsPrototypeOf(ProgressEvent.prototype, this),
|
||||||
keys: [
|
keys: [
|
||||||
...EVENT_PROPS,
|
...EVENT_PROPS,
|
||||||
"lengthComputable",
|
"lengthComputable",
|
||||||
|
@ -1238,7 +1239,8 @@
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isSpecialErrorEventHandler &&
|
isSpecialErrorEventHandler &&
|
||||||
evt instanceof ErrorEvent && evt.type === "error"
|
ObjectPrototypeIsPrototypeOf(ErrorEvent.prototype, evt) &&
|
||||||
|
evt.type === "error"
|
||||||
) {
|
) {
|
||||||
const ret = FunctionPrototypeCall(
|
const ret = FunctionPrototypeCall(
|
||||||
wrappedHandler.handler,
|
wrappedHandler.handler,
|
||||||
|
|
|
@ -13,10 +13,12 @@
|
||||||
const { DOMException } = window.__bootstrap.domException;
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
const {
|
const {
|
||||||
ArrayBuffer,
|
ArrayBuffer,
|
||||||
|
ArrayBufferPrototype,
|
||||||
ArrayBufferIsView,
|
ArrayBufferIsView,
|
||||||
DataView,
|
DataViewPrototype,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
TypedArrayPrototypeSlice,
|
TypedArrayPrototypeSlice,
|
||||||
TypeError,
|
TypeErrorPrototype,
|
||||||
WeakMap,
|
WeakMap,
|
||||||
WeakMapPrototypeSet,
|
WeakMapPrototypeSet,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -42,7 +44,7 @@
|
||||||
function structuredClone(value) {
|
function structuredClone(value) {
|
||||||
// Performance optimization for buffers, otherwise
|
// Performance optimization for buffers, otherwise
|
||||||
// `serialize/deserialize` will allocate new buffer.
|
// `serialize/deserialize` will allocate new buffer.
|
||||||
if (value instanceof ArrayBuffer) {
|
if (ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, value)) {
|
||||||
const cloned = cloneArrayBuffer(
|
const cloned = cloneArrayBuffer(
|
||||||
value,
|
value,
|
||||||
0,
|
0,
|
||||||
|
@ -59,7 +61,7 @@
|
||||||
// only DataView has a length in bytes and TypedArrays use a length in
|
// only DataView has a length in bytes and TypedArrays use a length in
|
||||||
// terms of elements, so we adjust for that.
|
// terms of elements, so we adjust for that.
|
||||||
let length;
|
let length;
|
||||||
if (value instanceof DataView) {
|
if (ObjectPrototypeIsPrototypeOf(DataViewPrototype, view)) {
|
||||||
length = value.byteLength;
|
length = value.byteLength;
|
||||||
} else {
|
} else {
|
||||||
length = value.length;
|
length = value.length;
|
||||||
|
@ -74,7 +76,7 @@
|
||||||
try {
|
try {
|
||||||
return core.deserialize(core.serialize(value));
|
return core.deserialize(core.serialize(value));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof TypeError) {
|
if (ObjectPrototypeIsPrototypeOf(TypeErrorPrototype, e)) {
|
||||||
throw new DOMException("Uncloneable value", "DataCloneError");
|
throw new DOMException("Uncloneable value", "DataCloneError");
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -77,17 +77,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get aborted() {
|
get aborted() {
|
||||||
webidl.assertBranded(this, AbortSignal);
|
webidl.assertBranded(this, AbortSignalPrototype);
|
||||||
return this[abortReason] !== undefined;
|
return this[abortReason] !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
get reason() {
|
get reason() {
|
||||||
webidl.assertBranded(this, AbortSignal);
|
webidl.assertBranded(this, AbortSignalPrototype);
|
||||||
return this[abortReason];
|
return this[abortReason];
|
||||||
}
|
}
|
||||||
|
|
||||||
throwIfAborted() {
|
throwIfAborted() {
|
||||||
webidl.assertBranded(this, AbortSignal);
|
webidl.assertBranded(this, AbortSignalPrototype);
|
||||||
if (this[abortReason] !== undefined) {
|
if (this[abortReason] !== undefined) {
|
||||||
throw this[abortReason];
|
throw this[abortReason];
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,7 @@
|
||||||
defineEventHandler(AbortSignal.prototype, "abort");
|
defineEventHandler(AbortSignal.prototype, "abort");
|
||||||
|
|
||||||
webidl.configurePrototype(AbortSignal);
|
webidl.configurePrototype(AbortSignal);
|
||||||
|
const AbortSignalPrototype = AbortSignal.prototype;
|
||||||
|
|
||||||
class AbortController {
|
class AbortController {
|
||||||
[signal] = new AbortSignal(illegalConstructorKey);
|
[signal] = new AbortSignal(illegalConstructorKey);
|
||||||
|
@ -105,21 +106,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get signal() {
|
get signal() {
|
||||||
webidl.assertBranded(this, AbortController);
|
webidl.assertBranded(this, AbortControllerPrototype);
|
||||||
return this[signal];
|
return this[signal];
|
||||||
}
|
}
|
||||||
|
|
||||||
abort(reason) {
|
abort(reason) {
|
||||||
webidl.assertBranded(this, AbortController);
|
webidl.assertBranded(this, AbortControllerPrototype);
|
||||||
this[signal][signalAbort](reason);
|
this[signal][signalAbort](reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(AbortController);
|
webidl.configurePrototype(AbortController);
|
||||||
|
const AbortControllerPrototype = AbortController.prototype;
|
||||||
|
|
||||||
webidl.converters["AbortSignal"] = webidl.createInterfaceConverter(
|
webidl.converters["AbortSignal"] = webidl.createInterfaceConverter(
|
||||||
"AbortSignal",
|
"AbortSignal",
|
||||||
AbortSignal,
|
AbortSignal.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
function newSignal() {
|
function newSignal() {
|
||||||
|
@ -142,6 +144,7 @@
|
||||||
window.AbortSignal = AbortSignal;
|
window.AbortSignal = AbortSignal;
|
||||||
window.AbortController = AbortController;
|
window.AbortController = AbortController;
|
||||||
window.__bootstrap.abortSignal = {
|
window.__bootstrap.abortSignal = {
|
||||||
|
AbortSignalPrototype,
|
||||||
add,
|
add,
|
||||||
signalAbort,
|
signalAbort,
|
||||||
remove,
|
remove,
|
||||||
|
|
|
@ -9,21 +9,22 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const { add, remove, signalAbort, newSignal } =
|
const { add, remove, signalAbort, newSignal, AbortSignalPrototype } =
|
||||||
window.__bootstrap.abortSignal;
|
window.__bootstrap.abortSignal;
|
||||||
const {
|
const {
|
||||||
ArrayBuffer,
|
ArrayBuffer,
|
||||||
|
ArrayBufferPrototype,
|
||||||
ArrayBufferIsView,
|
ArrayBufferIsView,
|
||||||
ArrayPrototypeMap,
|
ArrayPrototypeMap,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
ArrayPrototypeShift,
|
ArrayPrototypeShift,
|
||||||
BigInt64Array,
|
BigInt64ArrayPrototype,
|
||||||
BigUint64Array,
|
BigUint64ArrayPrototype,
|
||||||
DataView,
|
DataView,
|
||||||
Error,
|
Error,
|
||||||
Int8Array,
|
Int8ArrayPrototype,
|
||||||
Int16Array,
|
Int16ArrayPrototype,
|
||||||
Int32Array,
|
Int32ArrayPrototype,
|
||||||
NumberIsInteger,
|
NumberIsInteger,
|
||||||
NumberIsNaN,
|
NumberIsNaN,
|
||||||
MathMin,
|
MathMin,
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
ObjectDefineProperties,
|
ObjectDefineProperties,
|
||||||
ObjectDefineProperty,
|
ObjectDefineProperty,
|
||||||
ObjectGetPrototypeOf,
|
ObjectGetPrototypeOf,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectSetPrototypeOf,
|
ObjectSetPrototypeOf,
|
||||||
Promise,
|
Promise,
|
||||||
PromiseAll,
|
PromiseAll,
|
||||||
|
@ -46,9 +48,10 @@
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
TypeError,
|
TypeError,
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
Uint16Array,
|
Uint8ArrayPrototype,
|
||||||
Uint32Array,
|
Uint16ArrayPrototype,
|
||||||
Uint8ClampedArray,
|
Uint32ArrayPrototype,
|
||||||
|
Uint8ClampedArrayPrototype,
|
||||||
WeakMap,
|
WeakMap,
|
||||||
WeakMapPrototypeGet,
|
WeakMapPrototypeGet,
|
||||||
WeakMapPrototypeHas,
|
WeakMapPrototypeHas,
|
||||||
|
@ -134,7 +137,7 @@
|
||||||
|
|
||||||
/** @param {any} e */
|
/** @param {any} e */
|
||||||
function rethrowAssertionErrorRejection(e) {
|
function rethrowAssertionErrorRejection(e) {
|
||||||
if (e && e instanceof AssertionError) {
|
if (e && ObjectPrototypeIsPrototypeOf(AssertionError.prototype, e)) {
|
||||||
queueMicrotask(() => {
|
queueMicrotask(() => {
|
||||||
console.error(`Internal Error: ${e.stack}`);
|
console.error(`Internal Error: ${e.stack}`);
|
||||||
});
|
});
|
||||||
|
@ -214,7 +217,10 @@
|
||||||
*/
|
*/
|
||||||
function canTransferArrayBuffer(O) {
|
function canTransferArrayBuffer(O) {
|
||||||
assert(typeof O === "object");
|
assert(typeof O === "object");
|
||||||
assert(O instanceof ArrayBuffer || O instanceof SharedArrayBuffer);
|
assert(
|
||||||
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, O) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, O),
|
||||||
|
);
|
||||||
if (isDetachedBuffer(O)) {
|
if (isDetachedBuffer(O)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1364,15 +1370,15 @@
|
||||||
let ctor = DataView;
|
let ctor = DataView;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
view instanceof Int8Array ||
|
ObjectPrototypeIsPrototypeOf(Int8ArrayPrototype, view) ||
|
||||||
view instanceof Uint8Array ||
|
ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, view) ||
|
||||||
view instanceof Uint8ClampedArray ||
|
ObjectPrototypeIsPrototypeOf(Uint8ClampedArrayPrototype, view) ||
|
||||||
view instanceof Int16Array ||
|
ObjectPrototypeIsPrototypeOf(Int16ArrayPrototype, view) ||
|
||||||
view instanceof Uint16Array ||
|
ObjectPrototypeIsPrototypeOf(Uint16ArrayPrototype, view) ||
|
||||||
view instanceof Int32Array ||
|
ObjectPrototypeIsPrototypeOf(Int32ArrayPrototype, view) ||
|
||||||
view instanceof Uint32Array ||
|
ObjectPrototypeIsPrototypeOf(Uint32ArrayPrototype, view) ||
|
||||||
view instanceof BigInt64Array ||
|
ObjectPrototypeIsPrototypeOf(BigInt64ArrayPrototype, view) ||
|
||||||
view instanceof BigUint64Array
|
ObjectPrototypeIsPrototypeOf(BigUint64ArrayPrototype, view)
|
||||||
) {
|
) {
|
||||||
elementSize = view.constructor.BYTES_PER_ELEMENT;
|
elementSize = view.constructor.BYTES_PER_ELEMENT;
|
||||||
ctor = view.constructor;
|
ctor = view.constructor;
|
||||||
|
@ -1983,7 +1989,10 @@
|
||||||
typeof preventClose === "boolean" && typeof preventAbort === "boolean" &&
|
typeof preventClose === "boolean" && typeof preventAbort === "boolean" &&
|
||||||
typeof preventCancel === "boolean",
|
typeof preventCancel === "boolean",
|
||||||
);
|
);
|
||||||
assert(signal === undefined || signal instanceof AbortSignal);
|
assert(
|
||||||
|
signal === undefined ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(AbortSignalPrototype, signal),
|
||||||
|
);
|
||||||
assert(!isReadableStreamLocked(source));
|
assert(!isReadableStreamLocked(source));
|
||||||
assert(!isWritableStreamLocked(dest));
|
assert(!isWritableStreamLocked(dest));
|
||||||
// We use acquireReadableStreamDefaultReader even in case of ReadableByteStreamController
|
// We use acquireReadableStreamDefaultReader even in case of ReadableByteStreamController
|
||||||
|
@ -2327,7 +2336,12 @@
|
||||||
function readableStreamTee(stream, cloneForBranch2) {
|
function readableStreamTee(stream, cloneForBranch2) {
|
||||||
assert(isReadableStream(stream));
|
assert(isReadableStream(stream));
|
||||||
assert(typeof cloneForBranch2 === "boolean");
|
assert(typeof cloneForBranch2 === "boolean");
|
||||||
if (stream[_controller] instanceof ReadableByteStreamController) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableByteStreamControllerPrototype,
|
||||||
|
stream[_controller],
|
||||||
|
)
|
||||||
|
) {
|
||||||
return readableByteStreamTee(stream);
|
return readableByteStreamTee(stream);
|
||||||
} else {
|
} else {
|
||||||
return readableStreamDefaultTee(stream, cloneForBranch2);
|
return readableStreamDefaultTee(stream, cloneForBranch2);
|
||||||
|
@ -2491,7 +2505,12 @@
|
||||||
*/
|
*/
|
||||||
function readableByteStreamTee(stream) {
|
function readableByteStreamTee(stream) {
|
||||||
assert(isReadableStream(stream));
|
assert(isReadableStream(stream));
|
||||||
assert(stream[_controller] instanceof ReadableByteStreamController);
|
assert(
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableByteStreamControllerPrototype,
|
||||||
|
stream[_controller],
|
||||||
|
),
|
||||||
|
);
|
||||||
let reader = acquireReadableStreamDefaultReader(stream);
|
let reader = acquireReadableStreamDefaultReader(stream);
|
||||||
let reading = false;
|
let reading = false;
|
||||||
let readAgainForBranch1 = false;
|
let readAgainForBranch1 = false;
|
||||||
|
@ -2999,7 +3018,12 @@
|
||||||
if (isReadableStreamLocked(stream)) {
|
if (isReadableStreamLocked(stream)) {
|
||||||
throw new TypeError("ReadableStream is locked.");
|
throw new TypeError("ReadableStream is locked.");
|
||||||
}
|
}
|
||||||
if (!(stream[_controller] instanceof ReadableByteStreamController)) {
|
if (
|
||||||
|
!(ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableByteStreamControllerPrototype,
|
||||||
|
stream[_controller],
|
||||||
|
))
|
||||||
|
) {
|
||||||
throw new TypeError("Cannot use a BYOB reader with a non-byte stream");
|
throw new TypeError("Cannot use a BYOB reader with a non-byte stream");
|
||||||
}
|
}
|
||||||
readableStreamReaderGenericInitialize(reader, stream);
|
readableStreamReaderGenericInitialize(reader, stream);
|
||||||
|
@ -3032,7 +3056,7 @@
|
||||||
transformAlgorithm,
|
transformAlgorithm,
|
||||||
flushAlgorithm,
|
flushAlgorithm,
|
||||||
) {
|
) {
|
||||||
assert(stream instanceof TransformStream);
|
assert(ObjectPrototypeIsPrototypeOf(TransformStreamPrototype, stream));
|
||||||
assert(stream[_controller] === undefined);
|
assert(stream[_controller] === undefined);
|
||||||
controller[_stream] = stream;
|
controller[_stream] = stream;
|
||||||
stream[_controller] = controller;
|
stream[_controller] = controller;
|
||||||
|
@ -4174,13 +4198,13 @@
|
||||||
|
|
||||||
/** @returns {number} */
|
/** @returns {number} */
|
||||||
get highWaterMark() {
|
get highWaterMark() {
|
||||||
webidl.assertBranded(this, ByteLengthQueuingStrategy);
|
webidl.assertBranded(this, ByteLengthQueuingStrategyPrototype);
|
||||||
return this[_highWaterMark];
|
return this[_highWaterMark];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {(chunk: ArrayBufferView) => number} */
|
/** @returns {(chunk: ArrayBufferView) => number} */
|
||||||
get size() {
|
get size() {
|
||||||
webidl.assertBranded(this, ByteLengthQueuingStrategy);
|
webidl.assertBranded(this, ByteLengthQueuingStrategyPrototype);
|
||||||
initializeByteLengthSizeFunction(this[_globalObject]);
|
initializeByteLengthSizeFunction(this[_globalObject]);
|
||||||
return WeakMapPrototypeGet(byteSizeFunctionWeakMap, this[_globalObject]);
|
return WeakMapPrototypeGet(byteSizeFunctionWeakMap, this[_globalObject]);
|
||||||
}
|
}
|
||||||
|
@ -4188,7 +4212,10 @@
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof ByteLengthQueuingStrategy,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
ByteLengthQueuingStrategyPrototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: [
|
keys: [
|
||||||
"highWaterMark",
|
"highWaterMark",
|
||||||
"size",
|
"size",
|
||||||
|
@ -4198,6 +4225,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(ByteLengthQueuingStrategy);
|
webidl.configurePrototype(ByteLengthQueuingStrategy);
|
||||||
|
const ByteLengthQueuingStrategyPrototype =
|
||||||
|
ByteLengthQueuingStrategy.prototype;
|
||||||
|
|
||||||
/** @type {WeakMap<typeof globalThis, (chunk: ArrayBufferView) => number>} */
|
/** @type {WeakMap<typeof globalThis, (chunk: ArrayBufferView) => number>} */
|
||||||
const byteSizeFunctionWeakMap = new WeakMap();
|
const byteSizeFunctionWeakMap = new WeakMap();
|
||||||
|
@ -4226,13 +4255,13 @@
|
||||||
|
|
||||||
/** @returns {number} */
|
/** @returns {number} */
|
||||||
get highWaterMark() {
|
get highWaterMark() {
|
||||||
webidl.assertBranded(this, CountQueuingStrategy);
|
webidl.assertBranded(this, CountQueuingStrategyPrototype);
|
||||||
return this[_highWaterMark];
|
return this[_highWaterMark];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {(chunk: any) => 1} */
|
/** @returns {(chunk: any) => 1} */
|
||||||
get size() {
|
get size() {
|
||||||
webidl.assertBranded(this, CountQueuingStrategy);
|
webidl.assertBranded(this, CountQueuingStrategyPrototype);
|
||||||
initializeCountSizeFunction(this[_globalObject]);
|
initializeCountSizeFunction(this[_globalObject]);
|
||||||
return WeakMapPrototypeGet(countSizeFunctionWeakMap, this[_globalObject]);
|
return WeakMapPrototypeGet(countSizeFunctionWeakMap, this[_globalObject]);
|
||||||
}
|
}
|
||||||
|
@ -4240,7 +4269,10 @@
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof CountQueuingStrategy,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
CountQueuingStrategyPrototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: [
|
keys: [
|
||||||
"highWaterMark",
|
"highWaterMark",
|
||||||
"size",
|
"size",
|
||||||
|
@ -4250,6 +4282,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(CountQueuingStrategy);
|
webidl.configurePrototype(CountQueuingStrategy);
|
||||||
|
const CountQueuingStrategyPrototype = CountQueuingStrategy.prototype;
|
||||||
|
|
||||||
/** @type {WeakMap<typeof globalThis, () => 1>} */
|
/** @type {WeakMap<typeof globalThis, () => 1>} */
|
||||||
const countSizeFunctionWeakMap = new WeakMap();
|
const countSizeFunctionWeakMap = new WeakMap();
|
||||||
|
@ -4333,7 +4366,7 @@
|
||||||
|
|
||||||
/** @returns {boolean} */
|
/** @returns {boolean} */
|
||||||
get locked() {
|
get locked() {
|
||||||
webidl.assertBranded(this, ReadableStream);
|
webidl.assertBranded(this, ReadableStreamPrototype);
|
||||||
return isReadableStreamLocked(this);
|
return isReadableStreamLocked(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4343,7 +4376,7 @@
|
||||||
*/
|
*/
|
||||||
cancel(reason = undefined) {
|
cancel(reason = undefined) {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, ReadableStream);
|
webidl.assertBranded(this, ReadableStreamPrototype);
|
||||||
if (reason !== undefined) {
|
if (reason !== undefined) {
|
||||||
reason = webidl.converters.any(reason);
|
reason = webidl.converters.any(reason);
|
||||||
}
|
}
|
||||||
|
@ -4363,7 +4396,7 @@
|
||||||
* @returns {ReadableStreamDefaultReader<R> | ReadableStreamBYOBReader}
|
* @returns {ReadableStreamDefaultReader<R> | ReadableStreamBYOBReader}
|
||||||
*/
|
*/
|
||||||
getReader(options = {}) {
|
getReader(options = {}) {
|
||||||
webidl.assertBranded(this, ReadableStream);
|
webidl.assertBranded(this, ReadableStreamPrototype);
|
||||||
const prefix = "Failed to execute 'getReader' on 'ReadableStream'";
|
const prefix = "Failed to execute 'getReader' on 'ReadableStream'";
|
||||||
options = webidl.converters.ReadableStreamGetReaderOptions(options, {
|
options = webidl.converters.ReadableStreamGetReaderOptions(options, {
|
||||||
prefix,
|
prefix,
|
||||||
|
@ -4384,7 +4417,7 @@
|
||||||
* @returns {ReadableStream<T>}
|
* @returns {ReadableStream<T>}
|
||||||
*/
|
*/
|
||||||
pipeThrough(transform, options = {}) {
|
pipeThrough(transform, options = {}) {
|
||||||
webidl.assertBranded(this, ReadableStream);
|
webidl.assertBranded(this, ReadableStreamPrototype);
|
||||||
const prefix = "Failed to execute 'pipeThrough' on 'ReadableStream'";
|
const prefix = "Failed to execute 'pipeThrough' on 'ReadableStream'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
transform = webidl.converters.ReadableWritablePair(transform, {
|
transform = webidl.converters.ReadableWritablePair(transform, {
|
||||||
|
@ -4422,7 +4455,7 @@
|
||||||
*/
|
*/
|
||||||
pipeTo(destination, options = {}) {
|
pipeTo(destination, options = {}) {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, ReadableStream);
|
webidl.assertBranded(this, ReadableStreamPrototype);
|
||||||
const prefix = "Failed to execute 'pipeTo' on 'ReadableStream'";
|
const prefix = "Failed to execute 'pipeTo' on 'ReadableStream'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
destination = webidl.converters.WritableStream(destination, {
|
destination = webidl.converters.WritableStream(destination, {
|
||||||
|
@ -4459,7 +4492,7 @@
|
||||||
|
|
||||||
/** @returns {[ReadableStream<R>, ReadableStream<R>]} */
|
/** @returns {[ReadableStream<R>, ReadableStream<R>]} */
|
||||||
tee() {
|
tee() {
|
||||||
webidl.assertBranded(this, ReadableStream);
|
webidl.assertBranded(this, ReadableStreamPrototype);
|
||||||
return readableStreamTee(this, false);
|
return readableStreamTee(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4469,7 +4502,7 @@
|
||||||
* @returns {AsyncIterableIterator<R>}
|
* @returns {AsyncIterableIterator<R>}
|
||||||
*/
|
*/
|
||||||
values(options = {}) {
|
values(options = {}) {
|
||||||
webidl.assertBranded(this, ReadableStream);
|
webidl.assertBranded(this, ReadableStreamPrototype);
|
||||||
const prefix = "Failed to execute 'values' on 'ReadableStream'";
|
const prefix = "Failed to execute 'values' on 'ReadableStream'";
|
||||||
options = webidl.converters.ReadableStreamIteratorOptions(options, {
|
options = webidl.converters.ReadableStreamIteratorOptions(options, {
|
||||||
prefix,
|
prefix,
|
||||||
|
@ -4498,6 +4531,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
webidl.configurePrototype(ReadableStream);
|
webidl.configurePrototype(ReadableStream);
|
||||||
|
const ReadableStreamPrototype = ReadableStream.prototype;
|
||||||
|
|
||||||
function errorReadableStream(stream, e) {
|
function errorReadableStream(stream, e) {
|
||||||
readableStreamDefaultControllerError(stream[_controller], e);
|
readableStreamDefaultControllerError(stream[_controller], e);
|
||||||
|
@ -4527,7 +4561,7 @@
|
||||||
/** @returns {Promise<ReadableStreamReadResult<R>>} */
|
/** @returns {Promise<ReadableStreamReadResult<R>>} */
|
||||||
read() {
|
read() {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, ReadableStreamDefaultReader);
|
webidl.assertBranded(this, ReadableStreamDefaultReaderPrototype);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return PromiseReject(err);
|
return PromiseReject(err);
|
||||||
}
|
}
|
||||||
|
@ -4556,7 +4590,7 @@
|
||||||
|
|
||||||
/** @returns {void} */
|
/** @returns {void} */
|
||||||
releaseLock() {
|
releaseLock() {
|
||||||
webidl.assertBranded(this, ReadableStreamDefaultReader);
|
webidl.assertBranded(this, ReadableStreamDefaultReaderPrototype);
|
||||||
if (this[_stream] === undefined) {
|
if (this[_stream] === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4565,7 +4599,7 @@
|
||||||
|
|
||||||
get closed() {
|
get closed() {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, ReadableStreamDefaultReader);
|
webidl.assertBranded(this, ReadableStreamDefaultReaderPrototype);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return PromiseReject(err);
|
return PromiseReject(err);
|
||||||
}
|
}
|
||||||
|
@ -4578,7 +4612,7 @@
|
||||||
*/
|
*/
|
||||||
cancel(reason = undefined) {
|
cancel(reason = undefined) {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, ReadableStreamDefaultReader);
|
webidl.assertBranded(this, ReadableStreamDefaultReaderPrototype);
|
||||||
if (reason !== undefined) {
|
if (reason !== undefined) {
|
||||||
reason = webidl.converters.any(reason);
|
reason = webidl.converters.any(reason);
|
||||||
}
|
}
|
||||||
|
@ -4600,6 +4634,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(ReadableStreamDefaultReader);
|
webidl.configurePrototype(ReadableStreamDefaultReader);
|
||||||
|
const ReadableStreamDefaultReaderPrototype =
|
||||||
|
ReadableStreamDefaultReader.prototype;
|
||||||
|
|
||||||
/** @template R */
|
/** @template R */
|
||||||
class ReadableStreamBYOBReader {
|
class ReadableStreamBYOBReader {
|
||||||
|
@ -4628,7 +4664,7 @@
|
||||||
*/
|
*/
|
||||||
read(view) {
|
read(view) {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, ReadableStreamBYOBReader);
|
webidl.assertBranded(this, ReadableStreamBYOBReaderPrototype);
|
||||||
const prefix = "Failed to execute 'read' on 'ReadableStreamBYOBReader'";
|
const prefix = "Failed to execute 'read' on 'ReadableStreamBYOBReader'";
|
||||||
view = webidl.converters.ArrayBufferView(view, {
|
view = webidl.converters.ArrayBufferView(view, {
|
||||||
prefix,
|
prefix,
|
||||||
|
@ -4678,7 +4714,7 @@
|
||||||
|
|
||||||
/** @returns {void} */
|
/** @returns {void} */
|
||||||
releaseLock() {
|
releaseLock() {
|
||||||
webidl.assertBranded(this, ReadableStreamBYOBReader);
|
webidl.assertBranded(this, ReadableStreamBYOBReaderPrototype);
|
||||||
if (this[_stream] === undefined) {
|
if (this[_stream] === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4687,7 +4723,7 @@
|
||||||
|
|
||||||
get closed() {
|
get closed() {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, ReadableStreamBYOBReader);
|
webidl.assertBranded(this, ReadableStreamBYOBReaderPrototype);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return PromiseReject(err);
|
return PromiseReject(err);
|
||||||
}
|
}
|
||||||
|
@ -4700,7 +4736,7 @@
|
||||||
*/
|
*/
|
||||||
cancel(reason = undefined) {
|
cancel(reason = undefined) {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, ReadableStreamBYOBReader);
|
webidl.assertBranded(this, ReadableStreamBYOBReaderPrototype);
|
||||||
if (reason !== undefined) {
|
if (reason !== undefined) {
|
||||||
reason = webidl.converters.any(reason);
|
reason = webidl.converters.any(reason);
|
||||||
}
|
}
|
||||||
|
@ -4722,6 +4758,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(ReadableStreamBYOBReader);
|
webidl.configurePrototype(ReadableStreamBYOBReader);
|
||||||
|
const ReadableStreamBYOBReaderPrototype = ReadableStreamBYOBReader.prototype;
|
||||||
|
|
||||||
class ReadableStreamBYOBRequest {
|
class ReadableStreamBYOBRequest {
|
||||||
/** @type {ReadableByteStreamController} */
|
/** @type {ReadableByteStreamController} */
|
||||||
|
@ -4731,7 +4768,7 @@
|
||||||
|
|
||||||
/** @returns {ArrayBufferView | null} */
|
/** @returns {ArrayBufferView | null} */
|
||||||
get view() {
|
get view() {
|
||||||
webidl.assertBranded(this, ReadableStreamBYOBRequest);
|
webidl.assertBranded(this, ReadableStreamBYOBRequestPrototype);
|
||||||
return this[_view];
|
return this[_view];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4740,7 +4777,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
respond(bytesWritten) {
|
respond(bytesWritten) {
|
||||||
webidl.assertBranded(this, ReadableStreamBYOBRequest);
|
webidl.assertBranded(this, ReadableStreamBYOBRequestPrototype);
|
||||||
const prefix =
|
const prefix =
|
||||||
"Failed to execute 'respond' on 'ReadableStreamBYOBRequest'";
|
"Failed to execute 'respond' on 'ReadableStreamBYOBRequest'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
@ -4764,7 +4801,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
respondWithNewView(view) {
|
respondWithNewView(view) {
|
||||||
webidl.assertBranded(this, ReadableStreamBYOBRequest);
|
webidl.assertBranded(this, ReadableStreamBYOBRequestPrototype);
|
||||||
const prefix =
|
const prefix =
|
||||||
"Failed to execute 'respondWithNewView' on 'ReadableStreamBYOBRequest'";
|
"Failed to execute 'respondWithNewView' on 'ReadableStreamBYOBRequest'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
@ -4786,6 +4823,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(ReadableStreamBYOBRequest);
|
webidl.configurePrototype(ReadableStreamBYOBRequest);
|
||||||
|
const ReadableStreamBYOBRequestPrototype =
|
||||||
|
ReadableStreamBYOBRequest.prototype;
|
||||||
|
|
||||||
class ReadableByteStreamController {
|
class ReadableByteStreamController {
|
||||||
/** @type {number | undefined} */
|
/** @type {number | undefined} */
|
||||||
|
@ -4821,19 +4860,19 @@
|
||||||
|
|
||||||
/** @returns {ReadableStreamBYOBRequest | null} */
|
/** @returns {ReadableStreamBYOBRequest | null} */
|
||||||
get byobRequest() {
|
get byobRequest() {
|
||||||
webidl.assertBranded(this, ReadableByteStreamController);
|
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
|
||||||
return readableByteStreamControllerGetBYOBRequest(this);
|
return readableByteStreamControllerGetBYOBRequest(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {number | null} */
|
/** @returns {number | null} */
|
||||||
get desiredSize() {
|
get desiredSize() {
|
||||||
webidl.assertBranded(this, ReadableByteStreamController);
|
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
|
||||||
return readableByteStreamControllerGetDesiredSize(this);
|
return readableByteStreamControllerGetDesiredSize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {void} */
|
/** @returns {void} */
|
||||||
close() {
|
close() {
|
||||||
webidl.assertBranded(this, ReadableByteStreamController);
|
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
|
||||||
if (this[_closeRequested] === true) {
|
if (this[_closeRequested] === true) {
|
||||||
throw new TypeError("Closed already requested.");
|
throw new TypeError("Closed already requested.");
|
||||||
}
|
}
|
||||||
|
@ -4850,7 +4889,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
enqueue(chunk) {
|
enqueue(chunk) {
|
||||||
webidl.assertBranded(this, ReadableByteStreamController);
|
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
|
||||||
const prefix =
|
const prefix =
|
||||||
"Failed to execute 'enqueue' on 'ReadableByteStreamController'";
|
"Failed to execute 'enqueue' on 'ReadableByteStreamController'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
@ -4890,7 +4929,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
error(e = undefined) {
|
error(e = undefined) {
|
||||||
webidl.assertBranded(this, ReadableByteStreamController);
|
webidl.assertBranded(this, ReadableByteStreamControllerPrototype);
|
||||||
if (e !== undefined) {
|
if (e !== undefined) {
|
||||||
e = webidl.converters.any(e);
|
e = webidl.converters.any(e);
|
||||||
}
|
}
|
||||||
|
@ -4900,7 +4939,10 @@
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof ReadableByteStreamController,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableByteStreamControllerPrototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: ["desiredSize"],
|
keys: ["desiredSize"],
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -4967,6 +5009,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(ReadableByteStreamController);
|
webidl.configurePrototype(ReadableByteStreamController);
|
||||||
|
const ReadableByteStreamControllerPrototype =
|
||||||
|
ReadableByteStreamController.prototype;
|
||||||
|
|
||||||
/** @template R */
|
/** @template R */
|
||||||
class ReadableStreamDefaultController {
|
class ReadableStreamDefaultController {
|
||||||
|
@ -4999,13 +5043,13 @@
|
||||||
|
|
||||||
/** @returns {number | null} */
|
/** @returns {number | null} */
|
||||||
get desiredSize() {
|
get desiredSize() {
|
||||||
webidl.assertBranded(this, ReadableStreamDefaultController);
|
webidl.assertBranded(this, ReadableStreamDefaultControllerPrototype);
|
||||||
return readableStreamDefaultControllerGetDesiredSize(this);
|
return readableStreamDefaultControllerGetDesiredSize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {void} */
|
/** @returns {void} */
|
||||||
close() {
|
close() {
|
||||||
webidl.assertBranded(this, ReadableStreamDefaultController);
|
webidl.assertBranded(this, ReadableStreamDefaultControllerPrototype);
|
||||||
if (readableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
|
if (readableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
|
||||||
throw new TypeError("The stream controller cannot close or enqueue.");
|
throw new TypeError("The stream controller cannot close or enqueue.");
|
||||||
}
|
}
|
||||||
|
@ -5017,7 +5061,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
enqueue(chunk = undefined) {
|
enqueue(chunk = undefined) {
|
||||||
webidl.assertBranded(this, ReadableStreamDefaultController);
|
webidl.assertBranded(this, ReadableStreamDefaultControllerPrototype);
|
||||||
if (chunk !== undefined) {
|
if (chunk !== undefined) {
|
||||||
chunk = webidl.converters.any(chunk);
|
chunk = webidl.converters.any(chunk);
|
||||||
}
|
}
|
||||||
|
@ -5032,7 +5076,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
error(e = undefined) {
|
error(e = undefined) {
|
||||||
webidl.assertBranded(this, ReadableStreamDefaultController);
|
webidl.assertBranded(this, ReadableStreamDefaultControllerPrototype);
|
||||||
if (e !== undefined) {
|
if (e !== undefined) {
|
||||||
e = webidl.converters.any(e);
|
e = webidl.converters.any(e);
|
||||||
}
|
}
|
||||||
|
@ -5042,7 +5086,10 @@
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof ReadableStreamDefaultController,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
ReadableStreamDefaultController.prototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: ["desiredSize"],
|
keys: ["desiredSize"],
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -5085,6 +5132,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(ReadableStreamDefaultController);
|
webidl.configurePrototype(ReadableStreamDefaultController);
|
||||||
|
const ReadableStreamDefaultControllerPrototype =
|
||||||
|
ReadableStreamDefaultController.prototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template I
|
* @template I
|
||||||
|
@ -5186,13 +5235,13 @@
|
||||||
|
|
||||||
/** @returns {ReadableStream<O>} */
|
/** @returns {ReadableStream<O>} */
|
||||||
get readable() {
|
get readable() {
|
||||||
webidl.assertBranded(this, TransformStream);
|
webidl.assertBranded(this, TransformStreamPrototype);
|
||||||
return this[_readable];
|
return this[_readable];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {WritableStream<I>} */
|
/** @returns {WritableStream<I>} */
|
||||||
get writable() {
|
get writable() {
|
||||||
webidl.assertBranded(this, TransformStream);
|
webidl.assertBranded(this, TransformStreamPrototype);
|
||||||
return this[_writable];
|
return this[_writable];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5204,6 +5253,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(TransformStream);
|
webidl.configurePrototype(TransformStream);
|
||||||
|
const TransformStreamPrototype = TransformStream.prototype;
|
||||||
|
|
||||||
/** @template O */
|
/** @template O */
|
||||||
class TransformStreamDefaultController {
|
class TransformStreamDefaultController {
|
||||||
|
@ -5220,7 +5270,7 @@
|
||||||
|
|
||||||
/** @returns {number | null} */
|
/** @returns {number | null} */
|
||||||
get desiredSize() {
|
get desiredSize() {
|
||||||
webidl.assertBranded(this, TransformStreamDefaultController);
|
webidl.assertBranded(this, TransformStreamDefaultController.prototype);
|
||||||
const readableController = this[_stream][_readable][_controller];
|
const readableController = this[_stream][_readable][_controller];
|
||||||
return readableStreamDefaultControllerGetDesiredSize(
|
return readableStreamDefaultControllerGetDesiredSize(
|
||||||
/** @type {ReadableStreamDefaultController<O>} */ readableController,
|
/** @type {ReadableStreamDefaultController<O>} */ readableController,
|
||||||
|
@ -5232,7 +5282,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
enqueue(chunk = undefined) {
|
enqueue(chunk = undefined) {
|
||||||
webidl.assertBranded(this, TransformStreamDefaultController);
|
webidl.assertBranded(this, TransformStreamDefaultController.prototype);
|
||||||
if (chunk !== undefined) {
|
if (chunk !== undefined) {
|
||||||
chunk = webidl.converters.any(chunk);
|
chunk = webidl.converters.any(chunk);
|
||||||
}
|
}
|
||||||
|
@ -5244,7 +5294,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
error(reason = undefined) {
|
error(reason = undefined) {
|
||||||
webidl.assertBranded(this, TransformStreamDefaultController);
|
webidl.assertBranded(this, TransformStreamDefaultController.prototype);
|
||||||
if (reason !== undefined) {
|
if (reason !== undefined) {
|
||||||
reason = webidl.converters.any(reason);
|
reason = webidl.converters.any(reason);
|
||||||
}
|
}
|
||||||
|
@ -5253,20 +5303,25 @@
|
||||||
|
|
||||||
/** @returns {void} */
|
/** @returns {void} */
|
||||||
terminate() {
|
terminate() {
|
||||||
webidl.assertBranded(this, TransformStreamDefaultController);
|
webidl.assertBranded(this, TransformStreamDefaultControllerPrototype);
|
||||||
transformStreamDefaultControllerTerminate(this);
|
transformStreamDefaultControllerTerminate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof TransformStreamDefaultController,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
TransformStreamDefaultController.prototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: ["desiredSize"],
|
keys: ["desiredSize"],
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(TransformStreamDefaultController);
|
webidl.configurePrototype(TransformStreamDefaultController);
|
||||||
|
const TransformStreamDefaultControllerPrototype =
|
||||||
|
TransformStreamDefaultController.prototype;
|
||||||
|
|
||||||
/** @template W */
|
/** @template W */
|
||||||
class WritableStream {
|
class WritableStream {
|
||||||
|
@ -5336,7 +5391,7 @@
|
||||||
|
|
||||||
/** @returns {boolean} */
|
/** @returns {boolean} */
|
||||||
get locked() {
|
get locked() {
|
||||||
webidl.assertBranded(this, WritableStream);
|
webidl.assertBranded(this, WritableStreamPrototype);
|
||||||
return isWritableStreamLocked(this);
|
return isWritableStreamLocked(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5346,7 +5401,7 @@
|
||||||
*/
|
*/
|
||||||
abort(reason = undefined) {
|
abort(reason = undefined) {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, WritableStream);
|
webidl.assertBranded(this, WritableStreamPrototype);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return PromiseReject(err);
|
return PromiseReject(err);
|
||||||
}
|
}
|
||||||
|
@ -5366,7 +5421,7 @@
|
||||||
/** @returns {Promise<void>} */
|
/** @returns {Promise<void>} */
|
||||||
close() {
|
close() {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, WritableStream);
|
webidl.assertBranded(this, WritableStreamPrototype);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return PromiseReject(err);
|
return PromiseReject(err);
|
||||||
}
|
}
|
||||||
|
@ -5387,7 +5442,7 @@
|
||||||
|
|
||||||
/** @returns {WritableStreamDefaultWriter<W>} */
|
/** @returns {WritableStreamDefaultWriter<W>} */
|
||||||
getWriter() {
|
getWriter() {
|
||||||
webidl.assertBranded(this, WritableStream);
|
webidl.assertBranded(this, WritableStreamPrototype);
|
||||||
return acquireWritableStreamDefaultWriter(this);
|
return acquireWritableStreamDefaultWriter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5397,6 +5452,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(WritableStream);
|
webidl.configurePrototype(WritableStream);
|
||||||
|
const WritableStreamPrototype = WritableStream.prototype;
|
||||||
|
|
||||||
/** @template W */
|
/** @template W */
|
||||||
class WritableStreamDefaultWriter {
|
class WritableStreamDefaultWriter {
|
||||||
|
@ -5426,7 +5482,7 @@
|
||||||
/** @returns {Promise<void>} */
|
/** @returns {Promise<void>} */
|
||||||
get closed() {
|
get closed() {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, WritableStreamDefaultWriter);
|
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return PromiseReject(err);
|
return PromiseReject(err);
|
||||||
}
|
}
|
||||||
|
@ -5435,7 +5491,7 @@
|
||||||
|
|
||||||
/** @returns {number} */
|
/** @returns {number} */
|
||||||
get desiredSize() {
|
get desiredSize() {
|
||||||
webidl.assertBranded(this, WritableStreamDefaultWriter);
|
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
|
||||||
if (this[_stream] === undefined) {
|
if (this[_stream] === undefined) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
"A writable stream is not associated with the writer.",
|
"A writable stream is not associated with the writer.",
|
||||||
|
@ -5447,7 +5503,7 @@
|
||||||
/** @returns {Promise<void>} */
|
/** @returns {Promise<void>} */
|
||||||
get ready() {
|
get ready() {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, WritableStreamDefaultWriter);
|
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return PromiseReject(err);
|
return PromiseReject(err);
|
||||||
}
|
}
|
||||||
|
@ -5460,7 +5516,7 @@
|
||||||
*/
|
*/
|
||||||
abort(reason = undefined) {
|
abort(reason = undefined) {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, WritableStreamDefaultWriter);
|
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return PromiseReject(err);
|
return PromiseReject(err);
|
||||||
}
|
}
|
||||||
|
@ -5478,7 +5534,7 @@
|
||||||
/** @returns {Promise<void>} */
|
/** @returns {Promise<void>} */
|
||||||
close() {
|
close() {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, WritableStreamDefaultWriter);
|
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return PromiseReject(err);
|
return PromiseReject(err);
|
||||||
}
|
}
|
||||||
|
@ -5498,7 +5554,7 @@
|
||||||
|
|
||||||
/** @returns {void} */
|
/** @returns {void} */
|
||||||
releaseLock() {
|
releaseLock() {
|
||||||
webidl.assertBranded(this, WritableStreamDefaultWriter);
|
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
|
||||||
const stream = this[_stream];
|
const stream = this[_stream];
|
||||||
if (stream === undefined) {
|
if (stream === undefined) {
|
||||||
return;
|
return;
|
||||||
|
@ -5513,7 +5569,7 @@
|
||||||
*/
|
*/
|
||||||
write(chunk = undefined) {
|
write(chunk = undefined) {
|
||||||
try {
|
try {
|
||||||
webidl.assertBranded(this, WritableStreamDefaultWriter);
|
webidl.assertBranded(this, WritableStreamDefaultWriterPrototype);
|
||||||
if (chunk !== undefined) {
|
if (chunk !== undefined) {
|
||||||
chunk = webidl.converters.any(chunk);
|
chunk = webidl.converters.any(chunk);
|
||||||
}
|
}
|
||||||
|
@ -5531,7 +5587,10 @@
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof WritableStreamDefaultWriter,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
WritableStreamDefaultWriter.prototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: [
|
keys: [
|
||||||
"closed",
|
"closed",
|
||||||
"desiredSize",
|
"desiredSize",
|
||||||
|
@ -5542,6 +5601,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(WritableStreamDefaultWriter);
|
webidl.configurePrototype(WritableStreamDefaultWriter);
|
||||||
|
const WritableStreamDefaultWriterPrototype =
|
||||||
|
WritableStreamDefaultWriter.prototype;
|
||||||
|
|
||||||
/** @template W */
|
/** @template W */
|
||||||
class WritableStreamDefaultController {
|
class WritableStreamDefaultController {
|
||||||
|
@ -5567,7 +5628,7 @@
|
||||||
[_signal];
|
[_signal];
|
||||||
|
|
||||||
get signal() {
|
get signal() {
|
||||||
webidl.assertBranded(this, WritableStreamDefaultController);
|
webidl.assertBranded(this, WritableStreamDefaultControllerPrototype);
|
||||||
return this[_signal];
|
return this[_signal];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5580,7 +5641,7 @@
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
error(e = undefined) {
|
error(e = undefined) {
|
||||||
webidl.assertBranded(this, WritableStreamDefaultController);
|
webidl.assertBranded(this, WritableStreamDefaultControllerPrototype);
|
||||||
if (e !== undefined) {
|
if (e !== undefined) {
|
||||||
e = webidl.converters.any(e);
|
e = webidl.converters.any(e);
|
||||||
}
|
}
|
||||||
|
@ -5594,7 +5655,10 @@
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof WritableStreamDefaultController,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
WritableStreamDefaultController.prototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: [],
|
keys: [],
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -5615,6 +5679,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(WritableStreamDefaultController);
|
webidl.configurePrototype(WritableStreamDefaultController);
|
||||||
|
const WritableStreamDefaultControllerPrototype =
|
||||||
|
WritableStreamDefaultController.prototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ReadableStream} stream
|
* @param {ReadableStream} stream
|
||||||
|
@ -5624,9 +5690,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.converters.ReadableStream = webidl
|
webidl.converters.ReadableStream = webidl
|
||||||
.createInterfaceConverter("ReadableStream", ReadableStream);
|
.createInterfaceConverter("ReadableStream", ReadableStream.prototype);
|
||||||
webidl.converters.WritableStream = webidl
|
webidl.converters.WritableStream = webidl
|
||||||
.createInterfaceConverter("WritableStream", WritableStream);
|
.createInterfaceConverter("WritableStream", WritableStream.prototype);
|
||||||
|
|
||||||
webidl.converters.ReadableStreamType = webidl.createEnumConverter(
|
webidl.converters.ReadableStreamType = webidl.createEnumConverter(
|
||||||
"ReadableStreamType",
|
"ReadableStreamType",
|
||||||
|
@ -5787,6 +5853,7 @@
|
||||||
ByteLengthQueuingStrategy,
|
ByteLengthQueuingStrategy,
|
||||||
CountQueuingStrategy,
|
CountQueuingStrategy,
|
||||||
ReadableStream,
|
ReadableStream,
|
||||||
|
ReadableStreamPrototype,
|
||||||
ReadableStreamDefaultReader,
|
ReadableStreamDefaultReader,
|
||||||
TransformStream,
|
TransformStream,
|
||||||
WritableStream,
|
WritableStream,
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const {
|
const {
|
||||||
ArrayBufferIsView,
|
ArrayBufferIsView,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
PromiseReject,
|
PromiseReject,
|
||||||
PromiseResolve,
|
PromiseResolve,
|
||||||
StringPrototypeCharCodeAt,
|
StringPrototypeCharCodeAt,
|
||||||
|
@ -59,19 +60,19 @@
|
||||||
|
|
||||||
/** @returns {string} */
|
/** @returns {string} */
|
||||||
get encoding() {
|
get encoding() {
|
||||||
webidl.assertBranded(this, TextDecoder);
|
webidl.assertBranded(this, TextDecoderPrototype);
|
||||||
return this.#encoding;
|
return this.#encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {boolean} */
|
/** @returns {boolean} */
|
||||||
get fatal() {
|
get fatal() {
|
||||||
webidl.assertBranded(this, TextDecoder);
|
webidl.assertBranded(this, TextDecoderPrototype);
|
||||||
return this.#fatal;
|
return this.#fatal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {boolean} */
|
/** @returns {boolean} */
|
||||||
get ignoreBOM() {
|
get ignoreBOM() {
|
||||||
webidl.assertBranded(this, TextDecoder);
|
webidl.assertBranded(this, TextDecoderPrototype);
|
||||||
return this.#ignoreBOM;
|
return this.#ignoreBOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@
|
||||||
* @param {TextDecodeOptions} options
|
* @param {TextDecodeOptions} options
|
||||||
*/
|
*/
|
||||||
decode(input = new Uint8Array(), options = {}) {
|
decode(input = new Uint8Array(), options = {}) {
|
||||||
webidl.assertBranded(this, TextDecoder);
|
webidl.assertBranded(this, TextDecoderPrototype);
|
||||||
const prefix = "Failed to execute 'decode' on 'TextDecoder'";
|
const prefix = "Failed to execute 'decode' on 'TextDecoder'";
|
||||||
if (input !== undefined) {
|
if (input !== undefined) {
|
||||||
input = webidl.converters.BufferSource(input, {
|
input = webidl.converters.BufferSource(input, {
|
||||||
|
@ -119,7 +120,12 @@
|
||||||
// If the buffer is detached, just create a new empty Uint8Array.
|
// If the buffer is detached, just create a new empty Uint8Array.
|
||||||
input = new Uint8Array();
|
input = new Uint8Array();
|
||||||
}
|
}
|
||||||
if (input.buffer instanceof SharedArrayBuffer) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(
|
||||||
|
SharedArrayBuffer.prototype,
|
||||||
|
input.buffer,
|
||||||
|
)
|
||||||
|
) {
|
||||||
// We clone the data into a non-shared ArrayBuffer so we can pass it
|
// We clone the data into a non-shared ArrayBuffer so we can pass it
|
||||||
// to Rust.
|
// to Rust.
|
||||||
// `input` is now a Uint8Array, and calling the TypedArray constructor
|
// `input` is now a Uint8Array, and calling the TypedArray constructor
|
||||||
|
@ -140,6 +146,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(TextDecoder);
|
webidl.configurePrototype(TextDecoder);
|
||||||
|
const TextDecoderPrototype = TextDecoder.prototype;
|
||||||
|
|
||||||
class TextEncoder {
|
class TextEncoder {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -148,7 +155,7 @@
|
||||||
|
|
||||||
/** @returns {string} */
|
/** @returns {string} */
|
||||||
get encoding() {
|
get encoding() {
|
||||||
webidl.assertBranded(this, TextEncoder);
|
webidl.assertBranded(this, TextEncoderPrototype);
|
||||||
return "utf-8";
|
return "utf-8";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +164,7 @@
|
||||||
* @returns {Uint8Array}
|
* @returns {Uint8Array}
|
||||||
*/
|
*/
|
||||||
encode(input = "") {
|
encode(input = "") {
|
||||||
webidl.assertBranded(this, TextEncoder);
|
webidl.assertBranded(this, TextEncoderPrototype);
|
||||||
const prefix = "Failed to execute 'encode' on 'TextEncoder'";
|
const prefix = "Failed to execute 'encode' on 'TextEncoder'";
|
||||||
// The WebIDL type of `input` is `USVString`, but `core.encode` already
|
// The WebIDL type of `input` is `USVString`, but `core.encode` already
|
||||||
// converts lone surrogates to the replacement character.
|
// converts lone surrogates to the replacement character.
|
||||||
|
@ -174,7 +181,7 @@
|
||||||
* @returns {TextEncoderEncodeIntoResult}
|
* @returns {TextEncoderEncodeIntoResult}
|
||||||
*/
|
*/
|
||||||
encodeInto(source, destination) {
|
encodeInto(source, destination) {
|
||||||
webidl.assertBranded(this, TextEncoder);
|
webidl.assertBranded(this, TextEncoderPrototype);
|
||||||
const prefix = "Failed to execute 'encodeInto' on 'TextEncoder'";
|
const prefix = "Failed to execute 'encodeInto' on 'TextEncoder'";
|
||||||
// The WebIDL type of `source` is `USVString`, but the ops bindings
|
// The WebIDL type of `source` is `USVString`, but the ops bindings
|
||||||
// already convert lone surrogates to the replacement character.
|
// already convert lone surrogates to the replacement character.
|
||||||
|
@ -192,6 +199,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(TextEncoder);
|
webidl.configurePrototype(TextEncoder);
|
||||||
|
const TextEncoderPrototype = TextEncoder.prototype;
|
||||||
|
|
||||||
class TextDecoderStream {
|
class TextDecoderStream {
|
||||||
/** @type {TextDecoder} */
|
/** @type {TextDecoder} */
|
||||||
|
@ -248,36 +256,37 @@
|
||||||
|
|
||||||
/** @returns {string} */
|
/** @returns {string} */
|
||||||
get encoding() {
|
get encoding() {
|
||||||
webidl.assertBranded(this, TextDecoderStream);
|
webidl.assertBranded(this, TextDecoderStreamPrototype);
|
||||||
return this.#decoder.encoding;
|
return this.#decoder.encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {boolean} */
|
/** @returns {boolean} */
|
||||||
get fatal() {
|
get fatal() {
|
||||||
webidl.assertBranded(this, TextDecoderStream);
|
webidl.assertBranded(this, TextDecoderStreamPrototype);
|
||||||
return this.#decoder.fatal;
|
return this.#decoder.fatal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {boolean} */
|
/** @returns {boolean} */
|
||||||
get ignoreBOM() {
|
get ignoreBOM() {
|
||||||
webidl.assertBranded(this, TextDecoderStream);
|
webidl.assertBranded(this, TextDecoderStreamPrototype);
|
||||||
return this.#decoder.ignoreBOM;
|
return this.#decoder.ignoreBOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {ReadableStream<string>} */
|
/** @returns {ReadableStream<string>} */
|
||||||
get readable() {
|
get readable() {
|
||||||
webidl.assertBranded(this, TextDecoderStream);
|
webidl.assertBranded(this, TextDecoderStreamPrototype);
|
||||||
return this.#transform.readable;
|
return this.#transform.readable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {WritableStream<BufferSource>} */
|
/** @returns {WritableStream<BufferSource>} */
|
||||||
get writable() {
|
get writable() {
|
||||||
webidl.assertBranded(this, TextDecoderStream);
|
webidl.assertBranded(this, TextDecoderStreamPrototype);
|
||||||
return this.#transform.writable;
|
return this.#transform.writable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(TextDecoderStream);
|
webidl.configurePrototype(TextDecoderStream);
|
||||||
|
const TextDecoderStreamPrototype = TextDecoderStream.prototype;
|
||||||
|
|
||||||
class TextEncoderStream {
|
class TextEncoderStream {
|
||||||
/** @type {string | null} */
|
/** @type {string | null} */
|
||||||
|
@ -332,24 +341,25 @@
|
||||||
|
|
||||||
/** @returns {string} */
|
/** @returns {string} */
|
||||||
get encoding() {
|
get encoding() {
|
||||||
webidl.assertBranded(this, TextEncoderStream);
|
webidl.assertBranded(this, TextEncoderStreamPrototype);
|
||||||
return "utf-8";
|
return "utf-8";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {ReadableStream<Uint8Array>} */
|
/** @returns {ReadableStream<Uint8Array>} */
|
||||||
get readable() {
|
get readable() {
|
||||||
webidl.assertBranded(this, TextEncoderStream);
|
webidl.assertBranded(this, TextEncoderStreamPrototype);
|
||||||
return this.#transform.readable;
|
return this.#transform.readable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {WritableStream<string>} */
|
/** @returns {WritableStream<string>} */
|
||||||
get writable() {
|
get writable() {
|
||||||
webidl.assertBranded(this, TextEncoderStream);
|
webidl.assertBranded(this, TextEncoderStreamPrototype);
|
||||||
return this.#transform.writable;
|
return this.#transform.writable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(TextEncoderStream);
|
webidl.configurePrototype(TextEncoderStream);
|
||||||
|
const TextEncoderStreamPrototype = TextEncoderStream.prototype;
|
||||||
|
|
||||||
webidl.converters.TextDecoderOptions = webidl.createDictionaryConverter(
|
webidl.converters.TextDecoderOptions = webidl.createDictionaryConverter(
|
||||||
"TextDecoderOptions",
|
"TextDecoderOptions",
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const {
|
const {
|
||||||
ArrayBuffer,
|
ArrayBufferPrototype,
|
||||||
ArrayBufferPrototypeSlice,
|
ArrayBufferPrototypeSlice,
|
||||||
ArrayBufferIsView,
|
ArrayBufferIsView,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
DatePrototypeGetTime,
|
DatePrototypeGetTime,
|
||||||
MathMax,
|
MathMax,
|
||||||
MathMin,
|
MathMin,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
StringPrototypeCharAt,
|
StringPrototypeCharAt,
|
||||||
StringPrototypeToLowerCase,
|
StringPrototypeToLowerCase,
|
||||||
|
@ -109,7 +110,7 @@
|
||||||
const processedParts = [];
|
const processedParts = [];
|
||||||
let size = 0;
|
let size = 0;
|
||||||
for (const element of parts) {
|
for (const element of parts) {
|
||||||
if (element instanceof ArrayBuffer) {
|
if (ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, element)) {
|
||||||
const chunk = new Uint8Array(ArrayBufferPrototypeSlice(element, 0));
|
const chunk = new Uint8Array(ArrayBufferPrototypeSlice(element, 0));
|
||||||
ArrayPrototypePush(processedParts, BlobReference.fromUint8Array(chunk));
|
ArrayPrototypePush(processedParts, BlobReference.fromUint8Array(chunk));
|
||||||
size += element.byteLength;
|
size += element.byteLength;
|
||||||
|
@ -121,7 +122,7 @@
|
||||||
);
|
);
|
||||||
size += element.byteLength;
|
size += element.byteLength;
|
||||||
ArrayPrototypePush(processedParts, BlobReference.fromUint8Array(chunk));
|
ArrayPrototypePush(processedParts, BlobReference.fromUint8Array(chunk));
|
||||||
} else if (element instanceof Blob) {
|
} else if (ObjectPrototypeIsPrototypeOf(BlobPrototype, element)) {
|
||||||
ArrayPrototypePush(processedParts, element);
|
ArrayPrototypePush(processedParts, element);
|
||||||
size += element.size;
|
size += element.size;
|
||||||
} else if (typeof element === "string") {
|
} else if (typeof element === "string") {
|
||||||
|
@ -157,7 +158,7 @@
|
||||||
*/
|
*/
|
||||||
function getParts(blob, bag = []) {
|
function getParts(blob, bag = []) {
|
||||||
for (const part of blob[_parts]) {
|
for (const part of blob[_parts]) {
|
||||||
if (part instanceof Blob) {
|
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, part)) {
|
||||||
getParts(part, bag);
|
getParts(part, bag);
|
||||||
} else {
|
} else {
|
||||||
ArrayPrototypePush(bag, part._id);
|
ArrayPrototypePush(bag, part._id);
|
||||||
|
@ -204,13 +205,13 @@
|
||||||
|
|
||||||
/** @returns {number} */
|
/** @returns {number} */
|
||||||
get size() {
|
get size() {
|
||||||
webidl.assertBranded(this, Blob);
|
webidl.assertBranded(this, BlobPrototype);
|
||||||
return this[_size];
|
return this[_size];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {string} */
|
/** @returns {string} */
|
||||||
get type() {
|
get type() {
|
||||||
webidl.assertBranded(this, Blob);
|
webidl.assertBranded(this, BlobPrototype);
|
||||||
return this[_type];
|
return this[_type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +222,7 @@
|
||||||
* @returns {Blob}
|
* @returns {Blob}
|
||||||
*/
|
*/
|
||||||
slice(start = undefined, end = undefined, contentType = undefined) {
|
slice(start = undefined, end = undefined, contentType = undefined) {
|
||||||
webidl.assertBranded(this, Blob);
|
webidl.assertBranded(this, BlobPrototype);
|
||||||
const prefix = "Failed to execute 'slice' on 'Blob'";
|
const prefix = "Failed to execute 'slice' on 'Blob'";
|
||||||
if (start !== undefined) {
|
if (start !== undefined) {
|
||||||
start = webidl.converters["long long"](start, {
|
start = webidl.converters["long long"](start, {
|
||||||
|
@ -316,7 +317,7 @@
|
||||||
* @returns {ReadableStream<Uint8Array>}
|
* @returns {ReadableStream<Uint8Array>}
|
||||||
*/
|
*/
|
||||||
stream() {
|
stream() {
|
||||||
webidl.assertBranded(this, Blob);
|
webidl.assertBranded(this, BlobPrototype);
|
||||||
const partIterator = toIterator(this[_parts]);
|
const partIterator = toIterator(this[_parts]);
|
||||||
const stream = new ReadableStream({
|
const stream = new ReadableStream({
|
||||||
type: "bytes",
|
type: "bytes",
|
||||||
|
@ -338,7 +339,7 @@
|
||||||
* @returns {Promise<string>}
|
* @returns {Promise<string>}
|
||||||
*/
|
*/
|
||||||
async text() {
|
async text() {
|
||||||
webidl.assertBranded(this, Blob);
|
webidl.assertBranded(this, BlobPrototype);
|
||||||
const buffer = await this.arrayBuffer();
|
const buffer = await this.arrayBuffer();
|
||||||
return core.decode(new Uint8Array(buffer));
|
return core.decode(new Uint8Array(buffer));
|
||||||
}
|
}
|
||||||
|
@ -347,7 +348,7 @@
|
||||||
* @returns {Promise<ArrayBuffer>}
|
* @returns {Promise<ArrayBuffer>}
|
||||||
*/
|
*/
|
||||||
async arrayBuffer() {
|
async arrayBuffer() {
|
||||||
webidl.assertBranded(this, Blob);
|
webidl.assertBranded(this, BlobPrototype);
|
||||||
const stream = this.stream();
|
const stream = this.stream();
|
||||||
const bytes = new Uint8Array(this.size);
|
const bytes = new Uint8Array(this.size);
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
|
@ -361,7 +362,7 @@
|
||||||
[SymbolFor("Deno.customInspect")](inspect) {
|
[SymbolFor("Deno.customInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof Blob,
|
evaluate: ObjectPrototypeIsPrototypeOf(BlobPrototype, this),
|
||||||
keys: [
|
keys: [
|
||||||
"size",
|
"size",
|
||||||
"type",
|
"type",
|
||||||
|
@ -371,15 +372,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(Blob);
|
webidl.configurePrototype(Blob);
|
||||||
|
const BlobPrototype = Blob.prototype;
|
||||||
|
|
||||||
webidl.converters["Blob"] = webidl.createInterfaceConverter("Blob", Blob);
|
webidl.converters["Blob"] = webidl.createInterfaceConverter(
|
||||||
|
"Blob",
|
||||||
|
Blob.prototype,
|
||||||
|
);
|
||||||
webidl.converters["BlobPart"] = (V, opts) => {
|
webidl.converters["BlobPart"] = (V, opts) => {
|
||||||
// Union for ((ArrayBuffer or ArrayBufferView) or Blob or USVString)
|
// Union for ((ArrayBuffer or ArrayBufferView) or Blob or USVString)
|
||||||
if (typeof V == "object") {
|
if (typeof V == "object") {
|
||||||
if (V instanceof Blob) {
|
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, V)) {
|
||||||
return webidl.converters["Blob"](V, opts);
|
return webidl.converters["Blob"](V, opts);
|
||||||
}
|
}
|
||||||
if (V instanceof ArrayBuffer || V instanceof SharedArrayBuffer) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V)
|
||||||
|
) {
|
||||||
return webidl.converters["ArrayBuffer"](V, opts);
|
return webidl.converters["ArrayBuffer"](V, opts);
|
||||||
}
|
}
|
||||||
if (ArrayBufferIsView(V)) {
|
if (ArrayBufferIsView(V)) {
|
||||||
|
@ -458,18 +466,19 @@
|
||||||
|
|
||||||
/** @returns {string} */
|
/** @returns {string} */
|
||||||
get name() {
|
get name() {
|
||||||
webidl.assertBranded(this, File);
|
webidl.assertBranded(this, FilePrototype);
|
||||||
return this[_Name];
|
return this[_Name];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {number} */
|
/** @returns {number} */
|
||||||
get lastModified() {
|
get lastModified() {
|
||||||
webidl.assertBranded(this, File);
|
webidl.assertBranded(this, FilePrototype);
|
||||||
return this[_LastModified];
|
return this[_LastModified];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(File);
|
webidl.configurePrototype(File);
|
||||||
|
const FilePrototype = File.prototype;
|
||||||
|
|
||||||
webidl.converters["FilePropertyBag"] = webidl.createDictionaryConverter(
|
webidl.converters["FilePropertyBag"] = webidl.createDictionaryConverter(
|
||||||
"FilePropertyBag",
|
"FilePropertyBag",
|
||||||
|
@ -593,6 +602,8 @@
|
||||||
blobFromObjectUrl,
|
blobFromObjectUrl,
|
||||||
getParts,
|
getParts,
|
||||||
Blob,
|
Blob,
|
||||||
|
BlobPrototype,
|
||||||
File,
|
File,
|
||||||
|
FilePrototype,
|
||||||
};
|
};
|
||||||
})(this);
|
})(this);
|
||||||
|
|
|
@ -28,12 +28,14 @@
|
||||||
MapPrototypeGet,
|
MapPrototypeGet,
|
||||||
MapPrototypeSet,
|
MapPrototypeSet,
|
||||||
ObjectDefineProperty,
|
ObjectDefineProperty,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
queueMicrotask,
|
queueMicrotask,
|
||||||
StringFromCodePoint,
|
StringFromCodePoint,
|
||||||
Symbol,
|
Symbol,
|
||||||
TypedArrayPrototypeSet,
|
TypedArrayPrototypeSet,
|
||||||
TypeError,
|
TypeError,
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
|
Uint8ArrayPrototype,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
const state = Symbol("[[state]]");
|
const state = Symbol("[[state]]");
|
||||||
|
@ -116,7 +118,10 @@
|
||||||
|
|
||||||
// 4. If chunkPromise is fulfilled with an object whose done property is false
|
// 4. If chunkPromise is fulfilled with an object whose done property is false
|
||||||
// and whose value property is a Uint8Array object, run these steps:
|
// and whose value property is a Uint8Array object, run these steps:
|
||||||
if (!chunk.done && chunk.value instanceof Uint8Array) {
|
if (
|
||||||
|
!chunk.done &&
|
||||||
|
ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, chunk.value)
|
||||||
|
) {
|
||||||
ArrayPrototypePush(chunks, chunk.value);
|
ArrayPrototypePush(chunks, chunk.value);
|
||||||
|
|
||||||
// TODO(bartlomieju): (only) If roughly 50ms have passed since last progress
|
// TODO(bartlomieju): (only) If roughly 50ms have passed since last progress
|
||||||
|
@ -260,7 +265,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#getEventHandlerFor(name) {
|
#getEventHandlerFor(name) {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
|
|
||||||
const maybeMap = this[handlerSymbol];
|
const maybeMap = this[handlerSymbol];
|
||||||
if (!maybeMap) return null;
|
if (!maybeMap) return null;
|
||||||
|
@ -269,7 +274,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#setEventHandlerFor(name, value) {
|
#setEventHandlerFor(name, value) {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
|
|
||||||
if (!this[handlerSymbol]) {
|
if (!this[handlerSymbol]) {
|
||||||
this[handlerSymbol] = new Map();
|
this[handlerSymbol] = new Map();
|
||||||
|
@ -292,7 +297,7 @@
|
||||||
|
|
||||||
/** @returns {number} */
|
/** @returns {number} */
|
||||||
get readyState() {
|
get readyState() {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
switch (this[state]) {
|
switch (this[state]) {
|
||||||
case "empty":
|
case "empty":
|
||||||
return FileReader.EMPTY;
|
return FileReader.EMPTY;
|
||||||
|
@ -306,17 +311,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get result() {
|
get result() {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
return this[result];
|
return this[result];
|
||||||
}
|
}
|
||||||
|
|
||||||
get error() {
|
get error() {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
return this[error];
|
return this[error];
|
||||||
}
|
}
|
||||||
|
|
||||||
abort() {
|
abort() {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
// If context object's state is "empty" or if context object's state is "done" set context object's result to null and terminate this algorithm.
|
// If context object's state is "empty" or if context object's state is "done" set context object's result to null and terminate this algorithm.
|
||||||
if (
|
if (
|
||||||
this[state] === "empty" ||
|
this[state] === "empty" ||
|
||||||
|
@ -349,7 +354,7 @@
|
||||||
|
|
||||||
/** @param {Blob} blob */
|
/** @param {Blob} blob */
|
||||||
readAsArrayBuffer(blob) {
|
readAsArrayBuffer(blob) {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
const prefix = "Failed to execute 'readAsArrayBuffer' on 'FileReader'";
|
const prefix = "Failed to execute 'readAsArrayBuffer' on 'FileReader'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
this.#readOperation(blob, { kind: "ArrayBuffer" });
|
this.#readOperation(blob, { kind: "ArrayBuffer" });
|
||||||
|
@ -357,7 +362,7 @@
|
||||||
|
|
||||||
/** @param {Blob} blob */
|
/** @param {Blob} blob */
|
||||||
readAsBinaryString(blob) {
|
readAsBinaryString(blob) {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
const prefix = "Failed to execute 'readAsBinaryString' on 'FileReader'";
|
const prefix = "Failed to execute 'readAsBinaryString' on 'FileReader'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
// alias for readAsArrayBuffer
|
// alias for readAsArrayBuffer
|
||||||
|
@ -366,7 +371,7 @@
|
||||||
|
|
||||||
/** @param {Blob} blob */
|
/** @param {Blob} blob */
|
||||||
readAsDataURL(blob) {
|
readAsDataURL(blob) {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
const prefix = "Failed to execute 'readAsDataURL' on 'FileReader'";
|
const prefix = "Failed to execute 'readAsDataURL' on 'FileReader'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
// alias for readAsArrayBuffer
|
// alias for readAsArrayBuffer
|
||||||
|
@ -378,7 +383,7 @@
|
||||||
* @param {string} [encoding]
|
* @param {string} [encoding]
|
||||||
*/
|
*/
|
||||||
readAsText(blob, encoding = undefined) {
|
readAsText(blob, encoding = undefined) {
|
||||||
webidl.assertBranded(this, FileReader);
|
webidl.assertBranded(this, FileReaderPrototype);
|
||||||
const prefix = "Failed to execute 'readAsText' on 'FileReader'";
|
const prefix = "Failed to execute 'readAsText' on 'FileReader'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
if (encoding !== undefined) {
|
if (encoding !== undefined) {
|
||||||
|
@ -435,6 +440,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(FileReader);
|
webidl.configurePrototype(FileReader);
|
||||||
|
const FileReaderPrototype = FileReader.prototype;
|
||||||
|
|
||||||
ObjectDefineProperty(FileReader, "EMPTY", {
|
ObjectDefineProperty(FileReader, "EMPTY", {
|
||||||
writable: false,
|
writable: false,
|
||||||
|
|
|
@ -10,19 +10,21 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const { Interrupted } = core;
|
const { InterruptedPrototype } = core;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const { setEventTargetData } = window.__bootstrap.eventTarget;
|
const { setEventTargetData } = window.__bootstrap.eventTarget;
|
||||||
const { defineEventHandler } = window.__bootstrap.event;
|
const { defineEventHandler } = window.__bootstrap.event;
|
||||||
const { DOMException } = window.__bootstrap.domException;
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
const {
|
const {
|
||||||
ArrayBuffer,
|
ArrayBufferPrototype,
|
||||||
ArrayPrototypeFilter,
|
ArrayPrototypeFilter,
|
||||||
ArrayPrototypeIncludes,
|
ArrayPrototypeIncludes,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectSetPrototypeOf,
|
ObjectSetPrototypeOf,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
|
SymbolIterator,
|
||||||
TypeError,
|
TypeError,
|
||||||
WeakSet,
|
WeakSet,
|
||||||
WeakSetPrototypeAdd,
|
WeakSetPrototypeAdd,
|
||||||
|
@ -45,12 +47,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get port1() {
|
get port1() {
|
||||||
webidl.assertBranded(this, MessageChannel);
|
webidl.assertBranded(this, MessageChannelPrototype);
|
||||||
return this.#port1;
|
return this.#port1;
|
||||||
}
|
}
|
||||||
|
|
||||||
get port2() {
|
get port2() {
|
||||||
webidl.assertBranded(this, MessageChannel);
|
webidl.assertBranded(this, MessageChannelPrototype);
|
||||||
return this.#port2;
|
return this.#port2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +64,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(MessageChannel);
|
webidl.configurePrototype(MessageChannel);
|
||||||
|
const MessageChannelPrototype = MessageChannel.prototype;
|
||||||
|
|
||||||
const _id = Symbol("id");
|
const _id = Symbol("id");
|
||||||
const _enabled = Symbol("enabled");
|
const _enabled = Symbol("enabled");
|
||||||
|
@ -72,7 +75,7 @@
|
||||||
*/
|
*/
|
||||||
function createMessagePort(id) {
|
function createMessagePort(id) {
|
||||||
const port = core.createHostObject();
|
const port = core.createHostObject();
|
||||||
ObjectSetPrototypeOf(port, MessagePort.prototype);
|
ObjectSetPrototypeOf(port, MessagePortPrototype);
|
||||||
port[webidl.brand] = webidl.brand;
|
port[webidl.brand] = webidl.brand;
|
||||||
setEventTargetData(port);
|
setEventTargetData(port);
|
||||||
port[_id] = id;
|
port[_id] = id;
|
||||||
|
@ -95,7 +98,7 @@
|
||||||
* @param {object[] | StructuredSerializeOptions} transferOrOptions
|
* @param {object[] | StructuredSerializeOptions} transferOrOptions
|
||||||
*/
|
*/
|
||||||
postMessage(message, transferOrOptions = {}) {
|
postMessage(message, transferOrOptions = {}) {
|
||||||
webidl.assertBranded(this, MessagePort);
|
webidl.assertBranded(this, MessagePortPrototype);
|
||||||
const prefix = "Failed to execute 'postMessage' on 'MessagePort'";
|
const prefix = "Failed to execute 'postMessage' on 'MessagePort'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
message = webidl.converters.any(message);
|
message = webidl.converters.any(message);
|
||||||
|
@ -103,7 +106,7 @@
|
||||||
if (
|
if (
|
||||||
webidl.type(transferOrOptions) === "Object" &&
|
webidl.type(transferOrOptions) === "Object" &&
|
||||||
transferOrOptions !== undefined &&
|
transferOrOptions !== undefined &&
|
||||||
transferOrOptions[Symbol.iterator] !== undefined
|
transferOrOptions[SymbolIterator] !== undefined
|
||||||
) {
|
) {
|
||||||
const transfer = webidl.converters["sequence<object>"](
|
const transfer = webidl.converters["sequence<object>"](
|
||||||
transferOrOptions,
|
transferOrOptions,
|
||||||
|
@ -129,7 +132,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
webidl.assertBranded(this, MessagePort);
|
webidl.assertBranded(this, MessagePortPrototype);
|
||||||
if (this[_enabled]) return;
|
if (this[_enabled]) return;
|
||||||
(async () => {
|
(async () => {
|
||||||
this[_enabled] = true;
|
this[_enabled] = true;
|
||||||
|
@ -142,7 +145,7 @@
|
||||||
this[_id],
|
this[_id],
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof Interrupted) break;
|
if (ObjectPrototypeIsPrototypeOf(InterruptedPrototype, err)) break;
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
if (data === null) break;
|
if (data === null) break;
|
||||||
|
@ -160,7 +163,7 @@
|
||||||
data: message,
|
data: message,
|
||||||
ports: ArrayPrototypeFilter(
|
ports: ArrayPrototypeFilter(
|
||||||
transferables,
|
transferables,
|
||||||
(t) => t instanceof MessagePort,
|
(t) => ObjectPrototypeIsPrototypeOf(MessagePortPrototype, t),
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
this.dispatchEvent(event);
|
this.dispatchEvent(event);
|
||||||
|
@ -170,7 +173,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
webidl.assertBranded(this, MessagePort);
|
webidl.assertBranded(this, MessagePortPrototype);
|
||||||
if (this[_id] !== null) {
|
if (this[_id] !== null) {
|
||||||
core.close(this[_id]);
|
core.close(this[_id]);
|
||||||
this[_id] = null;
|
this[_id] = null;
|
||||||
|
@ -184,6 +187,7 @@
|
||||||
defineEventHandler(MessagePort.prototype, "messageerror");
|
defineEventHandler(MessagePort.prototype, "messageerror");
|
||||||
|
|
||||||
webidl.configurePrototype(MessagePort);
|
webidl.configurePrototype(MessagePort);
|
||||||
|
const MessagePortPrototype = MessagePort.prototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {[number, number]}
|
* @returns {[number, number]}
|
||||||
|
@ -245,7 +249,7 @@
|
||||||
function serializeJsMessageData(data, transferables) {
|
function serializeJsMessageData(data, transferables) {
|
||||||
const transferedArrayBuffers = ArrayPrototypeFilter(
|
const transferedArrayBuffers = ArrayPrototypeFilter(
|
||||||
transferables,
|
transferables,
|
||||||
(a) => a instanceof ArrayBuffer,
|
(a) => ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, a),
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const arrayBuffer of transferedArrayBuffers) {
|
for (const arrayBuffer of transferedArrayBuffers) {
|
||||||
|
@ -266,7 +270,7 @@
|
||||||
serializedData = core.serialize(data, {
|
serializedData = core.serialize(data, {
|
||||||
hostObjects: ArrayPrototypeFilter(
|
hostObjects: ArrayPrototypeFilter(
|
||||||
transferables,
|
transferables,
|
||||||
(a) => a instanceof MessagePort,
|
(a) => ObjectPrototypeIsPrototypeOf(MessagePortPrototype, a),
|
||||||
),
|
),
|
||||||
transferedArrayBuffers,
|
transferedArrayBuffers,
|
||||||
});
|
});
|
||||||
|
@ -279,8 +283,8 @@
|
||||||
|
|
||||||
let arrayBufferI = 0;
|
let arrayBufferI = 0;
|
||||||
for (const transferable of transferables) {
|
for (const transferable of transferables) {
|
||||||
if (transferable instanceof MessagePort) {
|
if (ObjectPrototypeIsPrototypeOf(MessagePortPrototype, transferable)) {
|
||||||
webidl.assertBranded(transferable, MessagePort);
|
webidl.assertBranded(transferable, MessagePortPrototype);
|
||||||
const id = transferable[_id];
|
const id = transferable[_id];
|
||||||
if (id === null) {
|
if (id === null) {
|
||||||
throw new DOMException(
|
throw new DOMException(
|
||||||
|
@ -293,7 +297,9 @@
|
||||||
kind: "messagePort",
|
kind: "messagePort",
|
||||||
data: id,
|
data: id,
|
||||||
});
|
});
|
||||||
} else if (transferable instanceof ArrayBuffer) {
|
} else if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, transferable)
|
||||||
|
) {
|
||||||
ArrayPrototypePush(serializedTransferables, {
|
ArrayPrototypePush(serializedTransferables, {
|
||||||
kind: "arrayBuffer",
|
kind: "arrayBuffer",
|
||||||
data: transferedArrayBuffers[arrayBufferI],
|
data: transferedArrayBuffers[arrayBufferI],
|
||||||
|
@ -339,6 +345,7 @@
|
||||||
window.__bootstrap.messagePort = {
|
window.__bootstrap.messagePort = {
|
||||||
MessageChannel,
|
MessageChannel,
|
||||||
MessagePort,
|
MessagePort,
|
||||||
|
MessagePortPrototype,
|
||||||
deserializeJsMessageData,
|
deserializeJsMessageData,
|
||||||
serializeJsMessageData,
|
serializeJsMessageData,
|
||||||
structuredClone,
|
structuredClone,
|
||||||
|
|
|
@ -53,17 +53,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get readable() {
|
get readable() {
|
||||||
webidl.assertBranded(this, CompressionStream);
|
webidl.assertBranded(this, CompressionStreamPrototype);
|
||||||
return this.#transform.readable;
|
return this.#transform.readable;
|
||||||
}
|
}
|
||||||
|
|
||||||
get writable() {
|
get writable() {
|
||||||
webidl.assertBranded(this, CompressionStream);
|
webidl.assertBranded(this, CompressionStreamPrototype);
|
||||||
return this.#transform.writable;
|
return this.#transform.writable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(CompressionStream);
|
webidl.configurePrototype(CompressionStream);
|
||||||
|
const CompressionStreamPrototype = CompressionStream.prototype;
|
||||||
|
|
||||||
class DecompressionStream {
|
class DecompressionStream {
|
||||||
#transform;
|
#transform;
|
||||||
|
@ -98,12 +99,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get readable() {
|
get readable() {
|
||||||
webidl.assertBranded(this, DecompressionStream);
|
webidl.assertBranded(this, DecompressionStreamPrototype);
|
||||||
return this.#transform.readable;
|
return this.#transform.readable;
|
||||||
}
|
}
|
||||||
|
|
||||||
get writable() {
|
get writable() {
|
||||||
webidl.assertBranded(this, DecompressionStream);
|
webidl.assertBranded(this, DecompressionStreamPrototype);
|
||||||
return this.#transform.writable;
|
return this.#transform.writable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,6 +116,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
webidl.configurePrototype(DecompressionStream);
|
webidl.configurePrototype(DecompressionStream);
|
||||||
|
const DecompressionStreamPrototype = DecompressionStream.prototype;
|
||||||
|
|
||||||
window.__bootstrap.compression = {
|
window.__bootstrap.compression = {
|
||||||
CompressionStream,
|
CompressionStream,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -56,13 +56,13 @@
|
||||||
// INTERFACE: GPUSupportedLimits
|
// INTERFACE: GPUSupportedLimits
|
||||||
webidl.converters.GPUSupportedLimits = webidl.createInterfaceConverter(
|
webidl.converters.GPUSupportedLimits = webidl.createInterfaceConverter(
|
||||||
"GPUSupportedLimits",
|
"GPUSupportedLimits",
|
||||||
GPUSupportedLimits,
|
GPUSupportedLimits.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPUSupportedFeatures
|
// INTERFACE: GPUSupportedFeatures
|
||||||
webidl.converters.GPUSupportedFeatures = webidl.createInterfaceConverter(
|
webidl.converters.GPUSupportedFeatures = webidl.createInterfaceConverter(
|
||||||
"GPUSupportedFeatures",
|
"GPUSupportedFeatures",
|
||||||
GPUSupportedFeatures,
|
GPUSupportedFeatures.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ENUM: GPUPredefinedColorSpace
|
// ENUM: GPUPredefinedColorSpace
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPU
|
// INTERFACE: GPU
|
||||||
webidl.converters.GPU = webidl.createInterfaceConverter("GPU", GPU);
|
webidl.converters.GPU = webidl.createInterfaceConverter("GPU", GPU.prototype);
|
||||||
|
|
||||||
// ENUM: GPUPowerPreference
|
// ENUM: GPUPowerPreference
|
||||||
webidl.converters["GPUPowerPreference"] = webidl.createEnumConverter(
|
webidl.converters["GPUPowerPreference"] = webidl.createEnumConverter(
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
// INTERFACE: GPUAdapter
|
// INTERFACE: GPUAdapter
|
||||||
webidl.converters.GPUAdapter = webidl.createInterfaceConverter(
|
webidl.converters.GPUAdapter = webidl.createInterfaceConverter(
|
||||||
"GPUAdapter",
|
"GPUAdapter",
|
||||||
GPUAdapter,
|
GPUAdapter.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ENUM: GPUFeatureName
|
// ENUM: GPUFeatureName
|
||||||
|
@ -178,13 +178,13 @@
|
||||||
// INTERFACE: GPUDevice
|
// INTERFACE: GPUDevice
|
||||||
webidl.converters.GPUDevice = webidl.createInterfaceConverter(
|
webidl.converters.GPUDevice = webidl.createInterfaceConverter(
|
||||||
"GPUDevice",
|
"GPUDevice",
|
||||||
GPUDevice,
|
GPUDevice.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPUBuffer
|
// INTERFACE: GPUBuffer
|
||||||
webidl.converters.GPUBuffer = webidl.createInterfaceConverter(
|
webidl.converters.GPUBuffer = webidl.createInterfaceConverter(
|
||||||
"GPUBuffer",
|
"GPUBuffer",
|
||||||
GPUBuffer,
|
GPUBuffer.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// TYPEDEF: GPUSize64
|
// TYPEDEF: GPUSize64
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
// INTERFACE: GPUBufferUsage
|
// INTERFACE: GPUBufferUsage
|
||||||
webidl.converters.GPUBufferUsage = webidl.createInterfaceConverter(
|
webidl.converters.GPUBufferUsage = webidl.createInterfaceConverter(
|
||||||
"GPUBufferUsage",
|
"GPUBufferUsage",
|
||||||
GPUBufferUsage,
|
GPUBufferUsage.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// TYPEDEF: GPUMapModeFlags
|
// TYPEDEF: GPUMapModeFlags
|
||||||
|
@ -228,13 +228,13 @@
|
||||||
// INTERFACE: GPUMapMode
|
// INTERFACE: GPUMapMode
|
||||||
webidl.converters.GPUMapMode = webidl.createInterfaceConverter(
|
webidl.converters.GPUMapMode = webidl.createInterfaceConverter(
|
||||||
"GPUMapMode",
|
"GPUMapMode",
|
||||||
GPUMapMode,
|
GPUMapMode.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPUTexture
|
// INTERFACE: GPUTexture
|
||||||
webidl.converters.GPUTexture = webidl.createInterfaceConverter(
|
webidl.converters.GPUTexture = webidl.createInterfaceConverter(
|
||||||
"GPUTexture",
|
"GPUTexture",
|
||||||
GPUTexture,
|
GPUTexture.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// TYPEDEF: GPUIntegerCoordinate
|
// TYPEDEF: GPUIntegerCoordinate
|
||||||
|
@ -444,13 +444,13 @@
|
||||||
// INTERFACE: GPUTextureUsage
|
// INTERFACE: GPUTextureUsage
|
||||||
webidl.converters.GPUTextureUsage = webidl.createInterfaceConverter(
|
webidl.converters.GPUTextureUsage = webidl.createInterfaceConverter(
|
||||||
"GPUTextureUsage",
|
"GPUTextureUsage",
|
||||||
GPUTextureUsage,
|
GPUTextureUsage.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPUTextureView
|
// INTERFACE: GPUTextureView
|
||||||
webidl.converters.GPUTextureView = webidl.createInterfaceConverter(
|
webidl.converters.GPUTextureView = webidl.createInterfaceConverter(
|
||||||
"GPUTextureView",
|
"GPUTextureView",
|
||||||
GPUTextureView,
|
GPUTextureView.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ENUM: GPUTextureViewDimension
|
// ENUM: GPUTextureViewDimension
|
||||||
|
@ -517,7 +517,7 @@
|
||||||
// INTERFACE: GPUSampler
|
// INTERFACE: GPUSampler
|
||||||
webidl.converters.GPUSampler = webidl.createInterfaceConverter(
|
webidl.converters.GPUSampler = webidl.createInterfaceConverter(
|
||||||
"GPUSampler",
|
"GPUSampler",
|
||||||
GPUSampler,
|
GPUSampler.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ENUM: GPUAddressMode
|
// ENUM: GPUAddressMode
|
||||||
|
@ -613,7 +613,7 @@
|
||||||
// INTERFACE: GPUBindGroupLayout
|
// INTERFACE: GPUBindGroupLayout
|
||||||
webidl.converters.GPUBindGroupLayout = webidl.createInterfaceConverter(
|
webidl.converters.GPUBindGroupLayout = webidl.createInterfaceConverter(
|
||||||
"GPUBindGroupLayout",
|
"GPUBindGroupLayout",
|
||||||
GPUBindGroupLayout,
|
GPUBindGroupLayout.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// TYPEDEF: GPUIndex32
|
// TYPEDEF: GPUIndex32
|
||||||
|
@ -796,13 +796,13 @@
|
||||||
// INTERFACE: GPUShaderStage
|
// INTERFACE: GPUShaderStage
|
||||||
webidl.converters.GPUShaderStage = webidl.createInterfaceConverter(
|
webidl.converters.GPUShaderStage = webidl.createInterfaceConverter(
|
||||||
"GPUShaderStage",
|
"GPUShaderStage",
|
||||||
GPUShaderStage,
|
GPUShaderStage.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPUBindGroup
|
// INTERFACE: GPUBindGroup
|
||||||
webidl.converters.GPUBindGroup = webidl.createInterfaceConverter(
|
webidl.converters.GPUBindGroup = webidl.createInterfaceConverter(
|
||||||
"GPUBindGroup",
|
"GPUBindGroup",
|
||||||
GPUBindGroup,
|
GPUBindGroup.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// DICTIONARY: GPUBufferBinding
|
// DICTIONARY: GPUBufferBinding
|
||||||
|
@ -871,7 +871,7 @@
|
||||||
// INTERFACE: GPUPipelineLayout
|
// INTERFACE: GPUPipelineLayout
|
||||||
webidl.converters.GPUPipelineLayout = webidl.createInterfaceConverter(
|
webidl.converters.GPUPipelineLayout = webidl.createInterfaceConverter(
|
||||||
"GPUPipelineLayout",
|
"GPUPipelineLayout",
|
||||||
GPUPipelineLayout,
|
GPUPipelineLayout.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// DICTIONARY: GPUPipelineLayoutDescriptor
|
// DICTIONARY: GPUPipelineLayoutDescriptor
|
||||||
|
@ -894,7 +894,7 @@
|
||||||
// INTERFACE: GPUShaderModule
|
// INTERFACE: GPUShaderModule
|
||||||
webidl.converters.GPUShaderModule = webidl.createInterfaceConverter(
|
webidl.converters.GPUShaderModule = webidl.createInterfaceConverter(
|
||||||
"GPUShaderModule",
|
"GPUShaderModule",
|
||||||
GPUShaderModule,
|
GPUShaderModule.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// DICTIONARY: GPUShaderModuleDescriptor
|
// DICTIONARY: GPUShaderModuleDescriptor
|
||||||
|
@ -926,13 +926,13 @@
|
||||||
// // INTERFACE: GPUCompilationMessage
|
// // INTERFACE: GPUCompilationMessage
|
||||||
// webidl.converters.GPUCompilationMessage = webidl.createInterfaceConverter(
|
// webidl.converters.GPUCompilationMessage = webidl.createInterfaceConverter(
|
||||||
// "GPUCompilationMessage",
|
// "GPUCompilationMessage",
|
||||||
// GPUCompilationMessage,
|
// GPUCompilationMessage.prototype,
|
||||||
// );
|
// );
|
||||||
|
|
||||||
// // INTERFACE: GPUCompilationInfo
|
// // INTERFACE: GPUCompilationInfo
|
||||||
// webidl.converters.GPUCompilationInfo = webidl.createInterfaceConverter(
|
// webidl.converters.GPUCompilationInfo = webidl.createInterfaceConverter(
|
||||||
// "GPUCompilationInfo",
|
// "GPUCompilationInfo",
|
||||||
// GPUCompilationInfo,
|
// GPUCompilationInfo.prototype,
|
||||||
// );
|
// );
|
||||||
|
|
||||||
// DICTIONARY: GPUPipelineDescriptorBase
|
// DICTIONARY: GPUPipelineDescriptorBase
|
||||||
|
@ -981,7 +981,7 @@
|
||||||
// INTERFACE: GPUComputePipeline
|
// INTERFACE: GPUComputePipeline
|
||||||
webidl.converters.GPUComputePipeline = webidl.createInterfaceConverter(
|
webidl.converters.GPUComputePipeline = webidl.createInterfaceConverter(
|
||||||
"GPUComputePipeline",
|
"GPUComputePipeline",
|
||||||
GPUComputePipeline,
|
GPUComputePipeline.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// DICTIONARY: GPUComputePipelineDescriptor
|
// DICTIONARY: GPUComputePipelineDescriptor
|
||||||
|
@ -1003,7 +1003,7 @@
|
||||||
// INTERFACE: GPURenderPipeline
|
// INTERFACE: GPURenderPipeline
|
||||||
webidl.converters.GPURenderPipeline = webidl.createInterfaceConverter(
|
webidl.converters.GPURenderPipeline = webidl.createInterfaceConverter(
|
||||||
"GPURenderPipeline",
|
"GPURenderPipeline",
|
||||||
GPURenderPipeline,
|
GPURenderPipeline.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ENUM: GPUVertexStepMode
|
// ENUM: GPUVertexStepMode
|
||||||
|
@ -1476,13 +1476,13 @@
|
||||||
// INTERFACE: GPUColorWrite
|
// INTERFACE: GPUColorWrite
|
||||||
webidl.converters.GPUColorWrite = webidl.createInterfaceConverter(
|
webidl.converters.GPUColorWrite = webidl.createInterfaceConverter(
|
||||||
"GPUColorWrite",
|
"GPUColorWrite",
|
||||||
GPUColorWrite,
|
GPUColorWrite.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPUCommandBuffer
|
// INTERFACE: GPUCommandBuffer
|
||||||
webidl.converters.GPUCommandBuffer = webidl.createInterfaceConverter(
|
webidl.converters.GPUCommandBuffer = webidl.createInterfaceConverter(
|
||||||
"GPUCommandBuffer",
|
"GPUCommandBuffer",
|
||||||
GPUCommandBuffer,
|
GPUCommandBuffer.prototype,
|
||||||
);
|
);
|
||||||
webidl.converters["sequence<GPUCommandBuffer>"] = webidl
|
webidl.converters["sequence<GPUCommandBuffer>"] = webidl
|
||||||
.createSequenceConverter(webidl.converters["GPUCommandBuffer"]);
|
.createSequenceConverter(webidl.converters["GPUCommandBuffer"]);
|
||||||
|
@ -1499,7 +1499,7 @@
|
||||||
// INTERFACE: GPUCommandEncoder
|
// INTERFACE: GPUCommandEncoder
|
||||||
webidl.converters.GPUCommandEncoder = webidl.createInterfaceConverter(
|
webidl.converters.GPUCommandEncoder = webidl.createInterfaceConverter(
|
||||||
"GPUCommandEncoder",
|
"GPUCommandEncoder",
|
||||||
GPUCommandEncoder,
|
GPUCommandEncoder.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// DICTIONARY: GPUCommandEncoderDescriptor
|
// DICTIONARY: GPUCommandEncoderDescriptor
|
||||||
|
@ -1654,7 +1654,7 @@
|
||||||
// INTERFACE: GPUComputePassEncoder
|
// INTERFACE: GPUComputePassEncoder
|
||||||
webidl.converters.GPUComputePassEncoder = webidl.createInterfaceConverter(
|
webidl.converters.GPUComputePassEncoder = webidl.createInterfaceConverter(
|
||||||
"GPUComputePassEncoder",
|
"GPUComputePassEncoder",
|
||||||
GPUComputePassEncoder,
|
GPUComputePassEncoder.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// DICTIONARY: GPUComputePassDescriptor
|
// DICTIONARY: GPUComputePassDescriptor
|
||||||
|
@ -1669,7 +1669,7 @@
|
||||||
// INTERFACE: GPURenderPassEncoder
|
// INTERFACE: GPURenderPassEncoder
|
||||||
webidl.converters.GPURenderPassEncoder = webidl.createInterfaceConverter(
|
webidl.converters.GPURenderPassEncoder = webidl.createInterfaceConverter(
|
||||||
"GPURenderPassEncoder",
|
"GPURenderPassEncoder",
|
||||||
GPURenderPassEncoder,
|
GPURenderPassEncoder.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ENUM: GPULoadOp
|
// ENUM: GPULoadOp
|
||||||
|
@ -1787,7 +1787,7 @@
|
||||||
// INTERFACE: GPUQuerySet
|
// INTERFACE: GPUQuerySet
|
||||||
webidl.converters.GPUQuerySet = webidl.createInterfaceConverter(
|
webidl.converters.GPUQuerySet = webidl.createInterfaceConverter(
|
||||||
"GPUQuerySet",
|
"GPUQuerySet",
|
||||||
GPUQuerySet,
|
GPUQuerySet.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// DICTIONARY: GPURenderPassDescriptor
|
// DICTIONARY: GPURenderPassDescriptor
|
||||||
|
@ -1815,7 +1815,7 @@
|
||||||
// INTERFACE: GPURenderBundle
|
// INTERFACE: GPURenderBundle
|
||||||
webidl.converters.GPURenderBundle = webidl.createInterfaceConverter(
|
webidl.converters.GPURenderBundle = webidl.createInterfaceConverter(
|
||||||
"GPURenderBundle",
|
"GPURenderBundle",
|
||||||
GPURenderBundle,
|
GPURenderBundle.prototype,
|
||||||
);
|
);
|
||||||
webidl.converters["sequence<GPURenderBundle>"] = webidl
|
webidl.converters["sequence<GPURenderBundle>"] = webidl
|
||||||
.createSequenceConverter(webidl.converters["GPURenderBundle"]);
|
.createSequenceConverter(webidl.converters["GPURenderBundle"]);
|
||||||
|
@ -1832,7 +1832,7 @@
|
||||||
// INTERFACE: GPURenderBundleEncoder
|
// INTERFACE: GPURenderBundleEncoder
|
||||||
webidl.converters.GPURenderBundleEncoder = webidl.createInterfaceConverter(
|
webidl.converters.GPURenderBundleEncoder = webidl.createInterfaceConverter(
|
||||||
"GPURenderBundleEncoder",
|
"GPURenderBundleEncoder",
|
||||||
GPURenderBundleEncoder,
|
GPURenderBundleEncoder.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// DICTIONARY: GPURenderPassLayout
|
// DICTIONARY: GPURenderPassLayout
|
||||||
|
@ -1885,7 +1885,7 @@
|
||||||
// INTERFACE: GPUQueue
|
// INTERFACE: GPUQueue
|
||||||
webidl.converters.GPUQueue = webidl.createInterfaceConverter(
|
webidl.converters.GPUQueue = webidl.createInterfaceConverter(
|
||||||
"GPUQueue",
|
"GPUQueue",
|
||||||
GPUQueue,
|
GPUQueue.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ENUM: GPUQueryType
|
// ENUM: GPUQueryType
|
||||||
|
@ -1945,7 +1945,7 @@
|
||||||
// // INTERFACE: GPUDeviceLostInfo
|
// // INTERFACE: GPUDeviceLostInfo
|
||||||
// webidl.converters.GPUDeviceLostInfo = webidl.createInterfaceConverter(
|
// webidl.converters.GPUDeviceLostInfo = webidl.createInterfaceConverter(
|
||||||
// "GPUDeviceLostInfo",
|
// "GPUDeviceLostInfo",
|
||||||
// GPUDeviceLostInfo,
|
// GPUDeviceLostInfo.prototype,
|
||||||
// );
|
// );
|
||||||
|
|
||||||
// ENUM: GPUErrorFilter
|
// ENUM: GPUErrorFilter
|
||||||
|
@ -1960,13 +1960,13 @@
|
||||||
// INTERFACE: GPUOutOfMemoryError
|
// INTERFACE: GPUOutOfMemoryError
|
||||||
webidl.converters.GPUOutOfMemoryError = webidl.createInterfaceConverter(
|
webidl.converters.GPUOutOfMemoryError = webidl.createInterfaceConverter(
|
||||||
"GPUOutOfMemoryError",
|
"GPUOutOfMemoryError",
|
||||||
GPUOutOfMemoryError,
|
GPUOutOfMemoryError.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// INTERFACE: GPUValidationError
|
// INTERFACE: GPUValidationError
|
||||||
webidl.converters.GPUValidationError = webidl.createInterfaceConverter(
|
webidl.converters.GPUValidationError = webidl.createInterfaceConverter(
|
||||||
"GPUValidationError",
|
"GPUValidationError",
|
||||||
GPUValidationError,
|
GPUValidationError.prototype,
|
||||||
);
|
);
|
||||||
|
|
||||||
// TYPEDEF: GPUError
|
// TYPEDEF: GPUError
|
||||||
|
@ -1975,7 +1975,7 @@
|
||||||
// // INTERFACE: GPUUncapturedErrorEvent
|
// // INTERFACE: GPUUncapturedErrorEvent
|
||||||
// webidl.converters.GPUUncapturedErrorEvent = webidl.createInterfaceConverter(
|
// webidl.converters.GPUUncapturedErrorEvent = webidl.createInterfaceConverter(
|
||||||
// "GPUUncapturedErrorEvent",
|
// "GPUUncapturedErrorEvent",
|
||||||
// GPUUncapturedErrorEvent,
|
// GPUUncapturedErrorEvent.prototype,
|
||||||
// );
|
// );
|
||||||
|
|
||||||
// DICTIONARY: GPUUncapturedErrorEventInit
|
// DICTIONARY: GPUUncapturedErrorEventInit
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
((window) => {
|
((window) => {
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const {
|
const {
|
||||||
ArrayBuffer,
|
ArrayBufferPrototype,
|
||||||
ArrayBufferIsView,
|
ArrayBufferIsView,
|
||||||
ArrayPrototypeForEach,
|
ArrayPrototypeForEach,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
BigInt,
|
BigInt,
|
||||||
BigIntAsIntN,
|
BigIntAsIntN,
|
||||||
BigIntAsUintN,
|
BigIntAsUintN,
|
||||||
DataView,
|
|
||||||
Float32Array,
|
Float32Array,
|
||||||
Float64Array,
|
Float64Array,
|
||||||
FunctionPrototypeBind,
|
FunctionPrototypeBind,
|
||||||
|
@ -50,6 +49,7 @@
|
||||||
ObjectGetOwnPropertyDescriptors,
|
ObjectGetOwnPropertyDescriptors,
|
||||||
ObjectGetPrototypeOf,
|
ObjectGetPrototypeOf,
|
||||||
ObjectPrototypeHasOwnProperty,
|
ObjectPrototypeHasOwnProperty,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectIs,
|
ObjectIs,
|
||||||
PromisePrototypeThen,
|
PromisePrototypeThen,
|
||||||
PromiseReject,
|
PromiseReject,
|
||||||
|
@ -434,11 +434,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNonSharedArrayBuffer(V) {
|
function isNonSharedArrayBuffer(V) {
|
||||||
return V instanceof ArrayBuffer;
|
return ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSharedArrayBuffer(V) {
|
function isSharedArrayBuffer(V) {
|
||||||
return V instanceof SharedArrayBuffer;
|
return ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V);
|
||||||
}
|
}
|
||||||
|
|
||||||
converters.ArrayBuffer = (V, opts = {}) => {
|
converters.ArrayBuffer = (V, opts = {}) => {
|
||||||
|
@ -457,7 +457,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
converters.DataView = (V, opts = {}) => {
|
converters.DataView = (V, opts = {}) => {
|
||||||
if (!(V instanceof DataView)) {
|
if (!(ObjectPrototypeIsPrototypeOf(DataViewPrototype, V))) {
|
||||||
throw makeException(TypeError, "is not a DataView", opts);
|
throw makeException(TypeError, "is not a DataView", opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,7 +862,7 @@
|
||||||
|
|
||||||
function createInterfaceConverter(name, prototype) {
|
function createInterfaceConverter(name, prototype) {
|
||||||
return (V, opts) => {
|
return (V, opts) => {
|
||||||
if (!(V instanceof prototype) || V[brand] !== brand) {
|
if (!ObjectPrototypeIsPrototypeOf(prototype, V) || V[brand] !== brand) {
|
||||||
throw makeException(TypeError, `is not of type ${name}.`, opts);
|
throw makeException(TypeError, `is not of type ${name}.`, opts);
|
||||||
}
|
}
|
||||||
return V;
|
return V;
|
||||||
|
@ -877,7 +877,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertBranded(self, prototype) {
|
function assertBranded(self, prototype) {
|
||||||
if (!(self instanceof prototype) || self[brand] !== brand) {
|
if (
|
||||||
|
!ObjectPrototypeIsPrototypeOf(prototype, self) || self[brand] !== brand
|
||||||
|
) {
|
||||||
throw new TypeError("Illegal invocation");
|
throw new TypeError("Illegal invocation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -944,7 +946,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function entries() {
|
function entries() {
|
||||||
assertBranded(this, prototype);
|
assertBranded(this, prototype.prototype);
|
||||||
return createDefaultIterator(this, "key+value");
|
return createDefaultIterator(this, "key+value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -963,7 +965,7 @@
|
||||||
},
|
},
|
||||||
keys: {
|
keys: {
|
||||||
value: function keys() {
|
value: function keys() {
|
||||||
assertBranded(this, prototype);
|
assertBranded(this, prototype.prototype);
|
||||||
return createDefaultIterator(this, "key");
|
return createDefaultIterator(this, "key");
|
||||||
},
|
},
|
||||||
writable: true,
|
writable: true,
|
||||||
|
@ -972,7 +974,7 @@
|
||||||
},
|
},
|
||||||
values: {
|
values: {
|
||||||
value: function values() {
|
value: function values() {
|
||||||
assertBranded(this, prototype);
|
assertBranded(this, prototype.prototype);
|
||||||
return createDefaultIterator(this, "value");
|
return createDefaultIterator(this, "value");
|
||||||
},
|
},
|
||||||
writable: true,
|
writable: true,
|
||||||
|
@ -981,7 +983,7 @@
|
||||||
},
|
},
|
||||||
forEach: {
|
forEach: {
|
||||||
value: function forEach(idlCallback, thisArg = undefined) {
|
value: function forEach(idlCallback, thisArg = undefined) {
|
||||||
assertBranded(this, prototype);
|
assertBranded(this, prototype.prototype);
|
||||||
const prefix = `Failed to execute 'forEach' on '${name}'`;
|
const prefix = `Failed to execute 'forEach' on '${name}'`;
|
||||||
requiredArguments(arguments.length, 1, { prefix });
|
requiredArguments(arguments.length, 1, { prefix });
|
||||||
idlCallback = converters["Function"](idlCallback, {
|
idlCallback = converters["Function"](idlCallback, {
|
||||||
|
|
|
@ -10,29 +10,31 @@
|
||||||
const { HTTP_TOKEN_CODE_POINT_RE } = window.__bootstrap.infra;
|
const { HTTP_TOKEN_CODE_POINT_RE } = window.__bootstrap.infra;
|
||||||
const { DOMException } = window.__bootstrap.domException;
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
const { defineEventHandler } = window.__bootstrap.event;
|
const { defineEventHandler } = window.__bootstrap.event;
|
||||||
const { Blob } = globalThis.__bootstrap.file;
|
const { Blob, BlobPrototype } = globalThis.__bootstrap.file;
|
||||||
const {
|
const {
|
||||||
ArrayBuffer,
|
ArrayBufferPrototype,
|
||||||
ArrayBufferIsView,
|
ArrayBufferIsView,
|
||||||
ArrayPrototypeJoin,
|
ArrayPrototypeJoin,
|
||||||
DataView,
|
|
||||||
ErrorPrototypeToString,
|
|
||||||
Set,
|
|
||||||
Symbol,
|
|
||||||
String,
|
|
||||||
StringPrototypeToLowerCase,
|
|
||||||
StringPrototypeEndsWith,
|
|
||||||
RegExpPrototypeTest,
|
|
||||||
ObjectDefineProperties,
|
|
||||||
ArrayPrototypeMap,
|
ArrayPrototypeMap,
|
||||||
ArrayPrototypeSome,
|
ArrayPrototypeSome,
|
||||||
|
DataView,
|
||||||
|
ErrorPrototypeToString,
|
||||||
|
ObjectDefineProperties,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
PromisePrototypeThen,
|
PromisePrototypeThen,
|
||||||
|
RegExpPrototypeTest,
|
||||||
|
Set,
|
||||||
|
String,
|
||||||
|
StringPrototypeEndsWith,
|
||||||
|
StringPrototypeToLowerCase,
|
||||||
|
Symbol,
|
||||||
|
SymbolIterator,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
webidl.converters["sequence<DOMString> or DOMString"] = (V, opts) => {
|
webidl.converters["sequence<DOMString> or DOMString"] = (V, opts) => {
|
||||||
// Union for (sequence<DOMString> or DOMString)
|
// Union for (sequence<DOMString> or DOMString)
|
||||||
if (webidl.type(V) === "Object" && V !== null) {
|
if (webidl.type(V) === "Object" && V !== null) {
|
||||||
if (V[Symbol.iterator] !== undefined) {
|
if (V[SymbolIterator] !== undefined) {
|
||||||
return webidl.converters["sequence<DOMString>"](V, opts);
|
return webidl.converters["sequence<DOMString>"](V, opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,12 +43,15 @@
|
||||||
|
|
||||||
webidl.converters["WebSocketSend"] = (V, opts) => {
|
webidl.converters["WebSocketSend"] = (V, opts) => {
|
||||||
// Union for (Blob or ArrayBufferView or ArrayBuffer or USVString)
|
// Union for (Blob or ArrayBufferView or ArrayBuffer or USVString)
|
||||||
if (V instanceof Blob) {
|
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, V)) {
|
||||||
return webidl.converters["Blob"](V, opts);
|
return webidl.converters["Blob"](V, opts);
|
||||||
}
|
}
|
||||||
if (typeof V === "object") {
|
if (typeof V === "object") {
|
||||||
// TODO(littledivy): use primordial for SharedArrayBuffer
|
// TODO(littledivy): use primordial for SharedArrayBuffer
|
||||||
if (V instanceof ArrayBuffer || V instanceof SharedArrayBuffer) {
|
if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V) ||
|
||||||
|
ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V)
|
||||||
|
) {
|
||||||
return webidl.converters["ArrayBuffer"](V, opts);
|
return webidl.converters["ArrayBuffer"](V, opts);
|
||||||
}
|
}
|
||||||
if (ArrayBufferIsView(V)) {
|
if (ArrayBufferIsView(V)) {
|
||||||
|
@ -79,52 +84,52 @@
|
||||||
|
|
||||||
[_readyState] = CONNECTING;
|
[_readyState] = CONNECTING;
|
||||||
get readyState() {
|
get readyState() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return this[_readyState];
|
return this[_readyState];
|
||||||
}
|
}
|
||||||
|
|
||||||
get CONNECTING() {
|
get CONNECTING() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return CONNECTING;
|
return CONNECTING;
|
||||||
}
|
}
|
||||||
get OPEN() {
|
get OPEN() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return OPEN;
|
return OPEN;
|
||||||
}
|
}
|
||||||
get CLOSING() {
|
get CLOSING() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return CLOSING;
|
return CLOSING;
|
||||||
}
|
}
|
||||||
get CLOSED() {
|
get CLOSED() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return CLOSED;
|
return CLOSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
[_extensions] = "";
|
[_extensions] = "";
|
||||||
get extensions() {
|
get extensions() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return this[_extensions];
|
return this[_extensions];
|
||||||
}
|
}
|
||||||
|
|
||||||
[_protocol] = "";
|
[_protocol] = "";
|
||||||
get protocol() {
|
get protocol() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return this[_protocol];
|
return this[_protocol];
|
||||||
}
|
}
|
||||||
|
|
||||||
[_url] = "";
|
[_url] = "";
|
||||||
get url() {
|
get url() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return this[_url];
|
return this[_url];
|
||||||
}
|
}
|
||||||
|
|
||||||
[_binaryType] = "blob";
|
[_binaryType] = "blob";
|
||||||
get binaryType() {
|
get binaryType() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return this[_binaryType];
|
return this[_binaryType];
|
||||||
}
|
}
|
||||||
set binaryType(value) {
|
set binaryType(value) {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
value = webidl.converters.DOMString(value, {
|
value = webidl.converters.DOMString(value, {
|
||||||
prefix: "Failed to set 'binaryType' on 'WebSocket'",
|
prefix: "Failed to set 'binaryType' on 'WebSocket'",
|
||||||
});
|
});
|
||||||
|
@ -135,7 +140,7 @@
|
||||||
|
|
||||||
[_bufferedAmount] = 0;
|
[_bufferedAmount] = 0;
|
||||||
get bufferedAmount() {
|
get bufferedAmount() {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
return this[_bufferedAmount];
|
return this[_bufferedAmount];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +272,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
send(data) {
|
send(data) {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
const prefix = "Failed to execute 'send' on 'WebSocket'";
|
const prefix = "Failed to execute 'send' on 'WebSocket'";
|
||||||
|
|
||||||
webidl.requiredArguments(arguments.length, 1, {
|
webidl.requiredArguments(arguments.length, 1, {
|
||||||
|
@ -295,14 +300,14 @@
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (data instanceof Blob) {
|
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, data)) {
|
||||||
PromisePrototypeThen(
|
PromisePrototypeThen(
|
||||||
data.slice().arrayBuffer(),
|
data.slice().arrayBuffer(),
|
||||||
(ab) => sendTypedArray(new DataView(ab)),
|
(ab) => sendTypedArray(new DataView(ab)),
|
||||||
);
|
);
|
||||||
} else if (ArrayBufferIsView(data)) {
|
} else if (ArrayBufferIsView(data)) {
|
||||||
sendTypedArray(data);
|
sendTypedArray(data);
|
||||||
} else if (data instanceof ArrayBuffer) {
|
} else if (ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, data)) {
|
||||||
sendTypedArray(new DataView(data));
|
sendTypedArray(new DataView(data));
|
||||||
} else {
|
} else {
|
||||||
const string = String(data);
|
const string = String(data);
|
||||||
|
@ -321,7 +326,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
close(code = undefined, reason = undefined) {
|
close(code = undefined, reason = undefined) {
|
||||||
webidl.assertBranded(this, WebSocket);
|
webidl.assertBranded(this, WebSocketPrototype);
|
||||||
const prefix = "Failed to execute 'close' on 'WebSocket'";
|
const prefix = "Failed to execute 'close' on 'WebSocket'";
|
||||||
|
|
||||||
if (code !== undefined) {
|
if (code !== undefined) {
|
||||||
|
@ -514,6 +519,7 @@
|
||||||
defineEventHandler(WebSocket.prototype, "open");
|
defineEventHandler(WebSocket.prototype, "open");
|
||||||
|
|
||||||
webidl.configurePrototype(WebSocket);
|
webidl.configurePrototype(WebSocket);
|
||||||
|
const WebSocketPrototype = WebSocket.prototype;
|
||||||
|
|
||||||
window.__bootstrap.webSocket = {
|
window.__bootstrap.webSocket = {
|
||||||
WebSocket,
|
WebSocket,
|
||||||
|
|
|
@ -11,18 +11,19 @@
|
||||||
const { add, remove } = window.__bootstrap.abortSignal;
|
const { add, remove } = window.__bootstrap.abortSignal;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
ArrayPrototypeJoin,
|
||||||
|
ArrayPrototypeMap,
|
||||||
|
Error,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
|
PromisePrototypeCatch,
|
||||||
|
PromisePrototypeThen,
|
||||||
|
Set,
|
||||||
StringPrototypeEndsWith,
|
StringPrototypeEndsWith,
|
||||||
StringPrototypeToLowerCase,
|
StringPrototypeToLowerCase,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
Set,
|
|
||||||
ArrayPrototypeMap,
|
|
||||||
ArrayPrototypeJoin,
|
|
||||||
PromisePrototypeThen,
|
|
||||||
PromisePrototypeCatch,
|
|
||||||
Uint8Array,
|
|
||||||
TypeError,
|
TypeError,
|
||||||
Error,
|
Uint8ArrayPrototype,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
webidl.converters.WebSocketStreamOptions = webidl.createDictionaryConverter(
|
webidl.converters.WebSocketStreamOptions = webidl.createDictionaryConverter(
|
||||||
|
@ -70,7 +71,7 @@
|
||||||
|
|
||||||
[_url];
|
[_url];
|
||||||
get url() {
|
get url() {
|
||||||
webidl.assertBranded(this, WebSocketStream);
|
webidl.assertBranded(this, WebSocketStreamPrototype);
|
||||||
return this[_url];
|
return this[_url];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +196,9 @@
|
||||||
kind: "text",
|
kind: "text",
|
||||||
value: chunk,
|
value: chunk,
|
||||||
});
|
});
|
||||||
} else if (chunk instanceof Uint8Array) {
|
} else if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, chunk)
|
||||||
|
) {
|
||||||
await core.opAsync("op_ws_send", this[_rid], {
|
await core.opAsync("op_ws_send", this[_rid], {
|
||||||
kind: "binary",
|
kind: "binary",
|
||||||
value: chunk,
|
value: chunk,
|
||||||
|
@ -296,7 +299,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err instanceof core.Interrupted) {
|
if (ObjectPrototypeIsPrototypeOf(core.InterruptedPrototype, err)) {
|
||||||
// The signal was aborted.
|
// The signal was aborted.
|
||||||
err = options.signal.reason;
|
err = options.signal.reason;
|
||||||
} else {
|
} else {
|
||||||
|
@ -311,19 +314,19 @@
|
||||||
|
|
||||||
[_connection] = new Deferred();
|
[_connection] = new Deferred();
|
||||||
get connection() {
|
get connection() {
|
||||||
webidl.assertBranded(this, WebSocketStream);
|
webidl.assertBranded(this, WebSocketStreamPrototype);
|
||||||
return this[_connection].promise;
|
return this[_connection].promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
[_earlyClose] = false;
|
[_earlyClose] = false;
|
||||||
[_closed] = new Deferred();
|
[_closed] = new Deferred();
|
||||||
get closed() {
|
get closed() {
|
||||||
webidl.assertBranded(this, WebSocketStream);
|
webidl.assertBranded(this, WebSocketStreamPrototype);
|
||||||
return this[_closed].promise;
|
return this[_closed].promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(closeInfo) {
|
close(closeInfo) {
|
||||||
webidl.assertBranded(this, WebSocketStream);
|
webidl.assertBranded(this, WebSocketStreamPrototype);
|
||||||
closeInfo = webidl.converters.WebSocketCloseInfo(closeInfo, {
|
closeInfo = webidl.converters.WebSocketCloseInfo(closeInfo, {
|
||||||
prefix: "Failed to execute 'close' on 'WebSocketStream'",
|
prefix: "Failed to execute 'close' on 'WebSocketStream'",
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
|
@ -381,5 +384,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const WebSocketStreamPrototype = WebSocketStream.prototype;
|
||||||
|
|
||||||
window.__bootstrap.webSocket.WebSocketStream = WebSocketStream;
|
window.__bootstrap.webSocket.WebSocketStream = WebSocketStream;
|
||||||
})(this);
|
})(this);
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
get length() {
|
get length() {
|
||||||
webidl.assertBranded(this, Storage);
|
webidl.assertBranded(this, StoragePrototype);
|
||||||
return core.opSync("op_webstorage_length", this[_persistent]);
|
return core.opSync("op_webstorage_length", this[_persistent]);
|
||||||
}
|
}
|
||||||
|
|
||||||
key(index) {
|
key(index) {
|
||||||
webidl.assertBranded(this, Storage);
|
webidl.assertBranded(this, StoragePrototype);
|
||||||
const prefix = "Failed to execute 'key' on 'Storage'";
|
const prefix = "Failed to execute 'key' on 'Storage'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
index = webidl.converters["unsigned long"](index, {
|
index = webidl.converters["unsigned long"](index, {
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
setItem(key, value) {
|
setItem(key, value) {
|
||||||
webidl.assertBranded(this, Storage);
|
webidl.assertBranded(this, StoragePrototype);
|
||||||
const prefix = "Failed to execute 'setItem' on 'Storage'";
|
const prefix = "Failed to execute 'setItem' on 'Storage'";
|
||||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||||
key = webidl.converters.DOMString(key, {
|
key = webidl.converters.DOMString(key, {
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
getItem(key) {
|
getItem(key) {
|
||||||
webidl.assertBranded(this, Storage);
|
webidl.assertBranded(this, StoragePrototype);
|
||||||
const prefix = "Failed to execute 'getItem' on 'Storage'";
|
const prefix = "Failed to execute 'getItem' on 'Storage'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
key = webidl.converters.DOMString(key, {
|
key = webidl.converters.DOMString(key, {
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
removeItem(key) {
|
removeItem(key) {
|
||||||
webidl.assertBranded(this, Storage);
|
webidl.assertBranded(this, StoragePrototype);
|
||||||
const prefix = "Failed to execute 'removeItem' on 'Storage'";
|
const prefix = "Failed to execute 'removeItem' on 'Storage'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
key = webidl.converters.DOMString(key, {
|
key = webidl.converters.DOMString(key, {
|
||||||
|
@ -85,11 +85,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
webidl.assertBranded(this, Storage);
|
webidl.assertBranded(this, StoragePrototype);
|
||||||
core.opSync("op_webstorage_clear", this[_persistent]);
|
core.opSync("op_webstorage_clear", this[_persistent]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const StoragePrototype = Storage.prototype;
|
||||||
|
|
||||||
function createStorage(persistent) {
|
function createStorage(persistent) {
|
||||||
const storage = webidl.createBranded(Storage);
|
const storage = webidl.createBranded(Storage);
|
||||||
storage[_persistent] = persistent;
|
storage[_persistent] = persistent;
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const {
|
const {
|
||||||
StringPrototypeReplace,
|
|
||||||
TypeError,
|
|
||||||
Promise,
|
|
||||||
decodeURIComponent,
|
decodeURIComponent,
|
||||||
Error,
|
Error,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
|
Promise,
|
||||||
|
StringPrototypeReplace,
|
||||||
|
TypeError,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
const { build } = window.__bootstrap.build;
|
const { build } = window.__bootstrap.build;
|
||||||
const { URL } = window.__bootstrap.url;
|
const { URLPrototype } = window.__bootstrap.url;
|
||||||
let logDebug = false;
|
let logDebug = false;
|
||||||
let logSource = "JS";
|
let logSource = "JS";
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function pathFromURL(pathOrUrl) {
|
function pathFromURL(pathOrUrl) {
|
||||||
if (pathOrUrl instanceof URL) {
|
if (ObjectPrototypeIsPrototypeOf(URLPrototype, pathOrUrl)) {
|
||||||
if (pathOrUrl.protocol != "file:") {
|
if (pathOrUrl.protocol != "file:") {
|
||||||
throw new TypeError("Must be a file URL.");
|
throw new TypeError("Must be a file URL.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const {
|
const {
|
||||||
Error,
|
Error,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
StringPrototypeStartsWith,
|
StringPrototypeStartsWith,
|
||||||
String,
|
String,
|
||||||
SymbolIterator,
|
SymbolIterator,
|
||||||
|
@ -16,8 +17,11 @@
|
||||||
const { serializePermissions } = window.__bootstrap.permissions;
|
const { serializePermissions } = window.__bootstrap.permissions;
|
||||||
const { log } = window.__bootstrap.util;
|
const { log } = window.__bootstrap.util;
|
||||||
const { defineEventHandler } = window.__bootstrap.event;
|
const { defineEventHandler } = window.__bootstrap.event;
|
||||||
const { deserializeJsMessageData, serializeJsMessageData } =
|
const {
|
||||||
window.__bootstrap.messagePort;
|
deserializeJsMessageData,
|
||||||
|
serializeJsMessageData,
|
||||||
|
MessagePortPrototype,
|
||||||
|
} = window.__bootstrap.messagePort;
|
||||||
|
|
||||||
function createWorker(
|
function createWorker(
|
||||||
specifier,
|
specifier,
|
||||||
|
@ -199,7 +203,9 @@
|
||||||
const event = new MessageEvent("message", {
|
const event = new MessageEvent("message", {
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
data: message,
|
data: message,
|
||||||
ports: transferables.filter((t) => t instanceof MessagePort),
|
ports: transferables.filter((t) =>
|
||||||
|
ObjectPrototypeIsPrototypeOf(MessagePortPrototype, t)
|
||||||
|
),
|
||||||
});
|
});
|
||||||
this.dispatchEvent(event);
|
this.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const {
|
const {
|
||||||
Date,
|
Date,
|
||||||
|
DatePrototype,
|
||||||
MathTrunc,
|
MathTrunc,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
SymbolAsyncIterator,
|
SymbolAsyncIterator,
|
||||||
SymbolIterator,
|
SymbolIterator,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -277,7 +279,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function toUnixTimeFromEpoch(value) {
|
function toUnixTimeFromEpoch(value) {
|
||||||
if (value instanceof Date) {
|
if (ObjectPrototypeIsPrototypeOf(DatePrototype, value)) {
|
||||||
const time = value.valueOf();
|
const time = value.valueOf();
|
||||||
const seconds = MathTrunc(time / 1e3);
|
const seconds = MathTrunc(time / 1e3);
|
||||||
const nanoseconds = MathTrunc(time - (seconds * 1e3)) * 1e6;
|
const nanoseconds = MathTrunc(time - (seconds * 1e3)) * 1e6;
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const { errors } = window.__bootstrap.errors;
|
const { BadResourcePrototype, InterruptedPrototype } = core;
|
||||||
const {
|
const {
|
||||||
ArrayIsArray,
|
ArrayIsArray,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
PromiseResolve,
|
PromiseResolve,
|
||||||
SymbolAsyncIterator,
|
SymbolAsyncIterator,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -28,9 +29,11 @@
|
||||||
? { value, done: false }
|
? { value, done: false }
|
||||||
: { value: undefined, done: true };
|
: { value: undefined, done: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof errors.BadResource) {
|
if (ObjectPrototypeIsPrototypeOf(BadResourcePrototype, error)) {
|
||||||
return { value: undefined, done: true };
|
return { value: undefined, done: true };
|
||||||
} else if (error instanceof errors.Interrupted) {
|
} else if (
|
||||||
|
ObjectPrototypeIsPrototypeOf(InterruptedPrototype, error)
|
||||||
|
) {
|
||||||
return { value: undefined, done: true };
|
return { value: undefined, done: true };
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
@ -9,14 +9,15 @@
|
||||||
const { serializePermissions } = window.__bootstrap.permissions;
|
const { serializePermissions } = window.__bootstrap.permissions;
|
||||||
const { assert } = window.__bootstrap.util;
|
const { assert } = window.__bootstrap.util;
|
||||||
const {
|
const {
|
||||||
AggregateError,
|
AggregateErrorPrototype,
|
||||||
ArrayPrototypeFilter,
|
ArrayPrototypeFilter,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
ArrayPrototypeShift,
|
ArrayPrototypeShift,
|
||||||
ArrayPrototypeSome,
|
ArrayPrototypeSome,
|
||||||
DateNow,
|
DateNow,
|
||||||
Error,
|
Error,
|
||||||
Function,
|
FunctionPrototype,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
Number,
|
Number,
|
||||||
ObjectKeys,
|
ObjectKeys,
|
||||||
Promise,
|
Promise,
|
||||||
|
@ -530,7 +531,7 @@ finishing test case.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatError(error) {
|
function formatError(error) {
|
||||||
if (error instanceof AggregateError) {
|
if (ObjectPrototypeIsPrototypeOf(AggregateErrorPrototype, error)) {
|
||||||
const message = error
|
const message = error
|
||||||
.errors
|
.errors
|
||||||
.map((error) =>
|
.map((error) =>
|
||||||
|
@ -984,7 +985,7 @@ finishing test case.`;
|
||||||
/** @returns {TestStepDefinition} */
|
/** @returns {TestStepDefinition} */
|
||||||
function getDefinition() {
|
function getDefinition() {
|
||||||
if (typeof nameOrTestDefinition === "string") {
|
if (typeof nameOrTestDefinition === "string") {
|
||||||
if (!(fn instanceof Function)) {
|
if (!(ObjectPrototypeIsPrototypeOf(FunctionPrototype, fn))) {
|
||||||
throw new TypeError("Expected function for second argument.");
|
throw new TypeError("Expected function for second argument.");
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -16,6 +16,7 @@ delete Object.prototype.__proto__;
|
||||||
ObjectDefineProperty,
|
ObjectDefineProperty,
|
||||||
ObjectDefineProperties,
|
ObjectDefineProperties,
|
||||||
ObjectFreeze,
|
ObjectFreeze,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectSetPrototypeOf,
|
ObjectSetPrototypeOf,
|
||||||
PromiseResolve,
|
PromiseResolve,
|
||||||
Symbol,
|
Symbol,
|
||||||
|
@ -142,7 +143,9 @@ delete Object.prototype.__proto__;
|
||||||
const msgEvent = new MessageEvent("message", {
|
const msgEvent = new MessageEvent("message", {
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
data: message,
|
data: message,
|
||||||
ports: transferables.filter((t) => t instanceof MessagePort),
|
ports: transferables.filter((t) =>
|
||||||
|
ObjectPrototypeIsPrototypeOf(messagePort.MessagePortPrototype, t)
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -311,7 +314,7 @@ delete Object.prototype.__proto__;
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get() {
|
get() {
|
||||||
webidl.assertBranded(this, Navigator);
|
webidl.assertBranded(this, NavigatorPrototype);
|
||||||
return webgpu.gpu;
|
return webgpu.gpu;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -319,11 +322,12 @@ delete Object.prototype.__proto__;
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get() {
|
get() {
|
||||||
webidl.assertBranded(this, Navigator);
|
webidl.assertBranded(this, NavigatorPrototype);
|
||||||
return numCpus;
|
return numCpus;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const NavigatorPrototype = Navigator.prototype;
|
||||||
|
|
||||||
class WorkerNavigator {
|
class WorkerNavigator {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -342,7 +346,7 @@ delete Object.prototype.__proto__;
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get() {
|
get() {
|
||||||
webidl.assertBranded(this, WorkerNavigator);
|
webidl.assertBranded(this, WorkerNavigatorPrototype);
|
||||||
return webgpu.gpu;
|
return webgpu.gpu;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -350,11 +354,12 @@ delete Object.prototype.__proto__;
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get() {
|
get() {
|
||||||
webidl.assertBranded(this, WorkerNavigator);
|
webidl.assertBranded(this, WorkerNavigatorPrototype);
|
||||||
return numCpus;
|
return numCpus;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const WorkerNavigatorPrototype = WorkerNavigator.prototype;
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope
|
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope
|
||||||
const windowOrWorkerGlobalScope = {
|
const windowOrWorkerGlobalScope = {
|
||||||
|
|
Loading…
Reference in a new issue