mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
chore: Update dlint (#17031)
Introduces `SafeSetIterator` and `SafeMapIterator` to primordials
This commit is contained in:
parent
2ac575abfb
commit
948f85216a
31 changed files with 222 additions and 141 deletions
|
@ -248,31 +248,6 @@
|
||||||
copyPrototype(original.prototype, primordials, `${name}Prototype`);
|
copyPrototype(original.prototype, primordials, `${name}Prototype`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create copies of abstract intrinsic objects that are not directly exposed
|
|
||||||
// on the global object.
|
|
||||||
// Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object
|
|
||||||
[
|
|
||||||
{ name: "TypedArray", original: Reflect.getPrototypeOf(Uint8Array) },
|
|
||||||
{
|
|
||||||
name: "ArrayIterator",
|
|
||||||
original: {
|
|
||||||
prototype: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "StringIterator",
|
|
||||||
original: {
|
|
||||||
prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
].forEach(({ name, original }) => {
|
|
||||||
primordials[name] = original;
|
|
||||||
// The static %TypedArray% methods require a valid `this`, but can't be bound,
|
|
||||||
// as they need a subclass constructor as the receiver:
|
|
||||||
copyPrototype(original, primordials, name);
|
|
||||||
copyPrototype(original.prototype, primordials, `${name}Prototype`);
|
|
||||||
});
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
ArrayPrototypeForEach,
|
ArrayPrototypeForEach,
|
||||||
ArrayPrototypeMap,
|
ArrayPrototypeMap,
|
||||||
|
@ -291,6 +266,43 @@
|
||||||
WeakSet,
|
WeakSet,
|
||||||
} = primordials;
|
} = primordials;
|
||||||
|
|
||||||
|
// Create copies of abstract intrinsic objects that are not directly exposed
|
||||||
|
// on the global object.
|
||||||
|
// Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object
|
||||||
|
[
|
||||||
|
{ name: "TypedArray", original: Reflect.getPrototypeOf(Uint8Array) },
|
||||||
|
{
|
||||||
|
name: "ArrayIterator",
|
||||||
|
original: {
|
||||||
|
prototype: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "SetIterator",
|
||||||
|
original: {
|
||||||
|
prototype: Reflect.getPrototypeOf(new Set()[Symbol.iterator]()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "MapIterator",
|
||||||
|
original: {
|
||||||
|
prototype: Reflect.getPrototypeOf(new Map()[Symbol.iterator]()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "StringIterator",
|
||||||
|
original: {
|
||||||
|
prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
].forEach(({ name, original }) => {
|
||||||
|
primordials[name] = original;
|
||||||
|
// The static %TypedArray% methods require a valid `this`, but can't be bound,
|
||||||
|
// as they need a subclass constructor as the receiver:
|
||||||
|
copyPrototype(original, primordials, name);
|
||||||
|
copyPrototype(original.prototype, primordials, `${name}Prototype`);
|
||||||
|
});
|
||||||
|
|
||||||
// Because these functions are used by `makeSafe`, which is exposed
|
// Because these functions are used by `makeSafe`, which is exposed
|
||||||
// on the `primordials` object, it's important to use const references
|
// on the `primordials` object, it's important to use const references
|
||||||
// to the primordials that they use:
|
// to the primordials that they use:
|
||||||
|
@ -316,6 +328,14 @@
|
||||||
primordials.ArrayPrototypeSymbolIterator,
|
primordials.ArrayPrototypeSymbolIterator,
|
||||||
primordials.ArrayIteratorPrototypeNext,
|
primordials.ArrayIteratorPrototypeNext,
|
||||||
);
|
);
|
||||||
|
primordials.SafeSetIterator = createSafeIterator(
|
||||||
|
primordials.SetPrototypeSymbolIterator,
|
||||||
|
primordials.SetIteratorPrototypeNext,
|
||||||
|
);
|
||||||
|
primordials.SafeMapIterator = createSafeIterator(
|
||||||
|
primordials.MapPrototypeSymbolIterator,
|
||||||
|
primordials.MapIteratorPrototypeNext,
|
||||||
|
);
|
||||||
primordials.SafeStringIterator = createSafeIterator(
|
primordials.SafeStringIterator = createSafeIterator(
|
||||||
primordials.StringPrototypeSymbolIterator,
|
primordials.StringPrototypeSymbolIterator,
|
||||||
primordials.StringIteratorPrototypeNext,
|
primordials.StringIteratorPrototypeNext,
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
ArrayPrototypeIndexOf,
|
ArrayPrototypeIndexOf,
|
||||||
ArrayPrototypeSplice,
|
ArrayPrototypeSplice,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
|
SafeArrayIterator,
|
||||||
Symbol,
|
Symbol,
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -43,7 +44,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function dispatch(source, name, data) {
|
function dispatch(source, name, data) {
|
||||||
for (const channel of channels) {
|
for (const channel of new SafeArrayIterator(channels)) {
|
||||||
if (channel === source) continue; // Don't self-send.
|
if (channel === source) continue; // Don't self-send.
|
||||||
if (channel[_name] !== name) continue;
|
if (channel[_name] !== name) continue;
|
||||||
if (channel[_closed]) continue;
|
if (channel[_closed]) continue;
|
||||||
|
|
3
ext/cache/01_cache.js
vendored
3
ext/cache/01_cache.js
vendored
|
@ -6,6 +6,7 @@
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const {
|
const {
|
||||||
Symbol,
|
Symbol,
|
||||||
|
SafeArrayIterator,
|
||||||
TypeError,
|
TypeError,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -114,7 +115,7 @@
|
||||||
const varyHeader = getHeader(innerResponse.headerList, "vary");
|
const varyHeader = getHeader(innerResponse.headerList, "vary");
|
||||||
if (varyHeader) {
|
if (varyHeader) {
|
||||||
const fieldValues = varyHeader.split(",");
|
const fieldValues = varyHeader.split(",");
|
||||||
for (const field of fieldValues) {
|
for (const field of new SafeArrayIterator(fieldValues)) {
|
||||||
if (field.trim() === "*") {
|
if (field.trim() === "*") {
|
||||||
throw new TypeError("Vary header must not contain '*'");
|
throw new TypeError("Vary header must not contain '*'");
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
RegExpPrototypeToString,
|
RegExpPrototypeToString,
|
||||||
SafeArrayIterator,
|
SafeArrayIterator,
|
||||||
|
SafeStringIterator,
|
||||||
SafeSet,
|
SafeSet,
|
||||||
SetPrototype,
|
SetPrototype,
|
||||||
SetPrototypeEntries,
|
SetPrototypeEntries,
|
||||||
|
@ -206,7 +207,7 @@
|
||||||
str = StringPrototypeNormalize(colors.stripColor(str), "NFC");
|
str = StringPrototypeNormalize(colors.stripColor(str), "NFC");
|
||||||
let width = 0;
|
let width = 0;
|
||||||
|
|
||||||
for (const ch of str) {
|
for (const ch of new SafeStringIterator(str)) {
|
||||||
width += isFullWidthCodePoint(StringPrototypeCodePointAt(ch, 0)) ? 2 : 1;
|
width += isFullWidthCodePoint(StringPrototypeCodePointAt(ch, 0)) ? 2 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +277,7 @@
|
||||||
}` +
|
}` +
|
||||||
`${tableChars.rightMiddle}\n`;
|
`${tableChars.rightMiddle}\n`;
|
||||||
|
|
||||||
for (const row of rows) {
|
for (const row of new SafeArrayIterator(rows)) {
|
||||||
result += `${renderRow(row, columnWidths, columnRightAlign)}\n`;
|
result += `${renderRow(row, columnWidths, columnRightAlign)}\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -994,7 +995,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const refMap = new Map();
|
const refMap = new Map();
|
||||||
for (const cause of causes) {
|
for (const cause of new SafeArrayIterator(causes)) {
|
||||||
if (circular !== undefined) {
|
if (circular !== undefined) {
|
||||||
const index = MapPrototypeGet(circular, cause);
|
const index = MapPrototypeGet(circular, cause);
|
||||||
if (index !== undefined) {
|
if (index !== undefined) {
|
||||||
|
@ -1171,7 +1172,7 @@
|
||||||
|
|
||||||
inspectOptions.indentLevel++;
|
inspectOptions.indentLevel++;
|
||||||
|
|
||||||
for (const key of stringKeys) {
|
for (const key of new SafeArrayIterator(stringKeys)) {
|
||||||
if (inspectOptions.getters) {
|
if (inspectOptions.getters) {
|
||||||
let propertyValue;
|
let propertyValue;
|
||||||
let error = null;
|
let error = null;
|
||||||
|
@ -1207,7 +1208,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of symbolKeys) {
|
for (const key of new SafeArrayIterator(symbolKeys)) {
|
||||||
if (
|
if (
|
||||||
!inspectOptions.showHidden &&
|
!inspectOptions.showHidden &&
|
||||||
!propertyIsEnumerable(value, key)
|
!propertyIsEnumerable(value, key)
|
||||||
|
@ -1639,7 +1640,7 @@
|
||||||
currentPart = "";
|
currentPart = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const [key, value] of rawEntries) {
|
for (const [key, value] of new SafeArrayIterator(rawEntries)) {
|
||||||
if (key == "background-color") {
|
if (key == "background-color") {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
css.backgroundColor = value;
|
css.backgroundColor = value;
|
||||||
|
@ -1660,7 +1661,11 @@
|
||||||
}
|
}
|
||||||
} else if (key == "text-decoration-line") {
|
} else if (key == "text-decoration-line") {
|
||||||
css.textDecorationLine = [];
|
css.textDecorationLine = [];
|
||||||
for (const lineType of StringPrototypeSplit(value, /\s+/g)) {
|
for (
|
||||||
|
const lineType of new SafeArrayIterator(
|
||||||
|
StringPrototypeSplit(value, /\s+/g),
|
||||||
|
)
|
||||||
|
) {
|
||||||
if (
|
if (
|
||||||
ArrayPrototypeIncludes(
|
ArrayPrototypeIncludes(
|
||||||
["line-through", "overline", "underline"],
|
["line-through", "overline", "underline"],
|
||||||
|
@ -1678,7 +1683,11 @@
|
||||||
} else if (key == "text-decoration") {
|
} else if (key == "text-decoration") {
|
||||||
css.textDecorationColor = null;
|
css.textDecorationColor = null;
|
||||||
css.textDecorationLine = [];
|
css.textDecorationLine = [];
|
||||||
for (const arg of StringPrototypeSplit(value, /\s+/g)) {
|
for (
|
||||||
|
const arg of new SafeArrayIterator(
|
||||||
|
StringPrototypeSplit(value, /\s+/g),
|
||||||
|
)
|
||||||
|
) {
|
||||||
const maybeColor = parseCssColor(arg);
|
const maybeColor = parseCssColor(arg);
|
||||||
if (maybeColor != null) {
|
if (maybeColor != null) {
|
||||||
css.textDecorationColor = maybeColor;
|
css.textDecorationColor = maybeColor;
|
||||||
|
@ -2135,7 +2144,7 @@
|
||||||
} else {
|
} else {
|
||||||
const valueObj = value || {};
|
const valueObj = value || {};
|
||||||
const keys = properties || ObjectKeys(valueObj);
|
const keys = properties || ObjectKeys(valueObj);
|
||||||
for (const k of keys) {
|
for (const k of new SafeArrayIterator(keys)) {
|
||||||
if (!primitive && ReflectHas(valueObj, k)) {
|
if (!primitive && ReflectHas(valueObj, k)) {
|
||||||
if (!(ReflectHas(objectValues, k))) {
|
if (!(ReflectHas(objectValues, k))) {
|
||||||
objectValues[k] = ArrayPrototypeFill(new Array(numRows), "");
|
objectValues[k] = ArrayPrototypeFill(new Array(numRows), "");
|
||||||
|
@ -2330,7 +2339,7 @@
|
||||||
function wrapConsole(consoleFromDeno, consoleFromV8) {
|
function wrapConsole(consoleFromDeno, consoleFromV8) {
|
||||||
const callConsole = core.callConsole;
|
const callConsole = core.callConsole;
|
||||||
|
|
||||||
for (const key of ObjectKeys(consoleFromV8)) {
|
for (const key of new SafeArrayIterator(ObjectKeys(consoleFromV8))) {
|
||||||
if (ObjectPrototypeHasOwnProperty(consoleFromDeno, key)) {
|
if (ObjectPrototypeHasOwnProperty(consoleFromDeno, key)) {
|
||||||
consoleFromDeno[key] = FunctionPrototypeBind(
|
consoleFromDeno[key] = FunctionPrototypeBind(
|
||||||
callConsole,
|
callConsole,
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
StringPrototypeToUpperCase,
|
StringPrototypeToUpperCase,
|
||||||
StringPrototypeCharCodeAt,
|
StringPrototypeCharCodeAt,
|
||||||
StringFromCharCode,
|
StringFromCharCode,
|
||||||
|
SafeArrayIterator,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
SyntaxError,
|
SyntaxError,
|
||||||
|
@ -4052,7 +4053,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const pkcs8Der = ops.op_export_pkcs8_ed25519(
|
const pkcs8Der = ops.op_export_pkcs8_ed25519(
|
||||||
new Uint8Array([0x04, 0x22, ...innerKey]),
|
new Uint8Array([0x04, 0x22, ...new SafeArrayIterator(innerKey)]),
|
||||||
);
|
);
|
||||||
pkcs8Der[15] = 0x20;
|
pkcs8Der[15] = 0x20;
|
||||||
return pkcs8Der.buffer;
|
return pkcs8Der.buffer;
|
||||||
|
@ -4115,7 +4116,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const pkcs8Der = ops.op_export_pkcs8_x25519(
|
const pkcs8Der = ops.op_export_pkcs8_x25519(
|
||||||
new Uint8Array([0x04, 0x22, ...innerKey]),
|
new Uint8Array([0x04, 0x22, ...new SafeArrayIterator(innerKey)]),
|
||||||
);
|
);
|
||||||
pkcs8Der[15] = 0x20;
|
pkcs8Der[15] = 0x20;
|
||||||
return pkcs8Der.buffer;
|
return pkcs8Der.buffer;
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
*/
|
*/
|
||||||
function fillHeaders(headers, object) {
|
function fillHeaders(headers, object) {
|
||||||
if (ArrayIsArray(object)) {
|
if (ArrayIsArray(object)) {
|
||||||
for (const header of object) {
|
for (const header of new SafeArrayIterator(object)) {
|
||||||
if (header.length !== 2) {
|
if (header.length !== 2) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
`Invalid header. Length must be 2, but is ${header.length}`,
|
`Invalid header. Length must be 2, but is ${header.length}`,
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
// spec but produce the same result.
|
// spec but produce the same result.
|
||||||
const headers = {};
|
const headers = {};
|
||||||
const cookies = [];
|
const cookies = [];
|
||||||
for (const entry of list) {
|
for (const entry of new SafeArrayIterator(list)) {
|
||||||
const name = byteLowerCase(entry[0]);
|
const name = byteLowerCase(entry[0]);
|
||||||
const value = entry[1];
|
const value = entry[1];
|
||||||
if (value === null) throw new TypeError("Unreachable");
|
if (value === null) throw new TypeError("Unreachable");
|
||||||
|
@ -405,6 +405,7 @@
|
||||||
|
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
const headers = {};
|
const headers = {};
|
||||||
|
// deno-lint-ignore prefer-primordials
|
||||||
for (const header of this) {
|
for (const header of this) {
|
||||||
headers[header[0]] = header[1];
|
headers[header[0]] = header[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
MathRandom,
|
MathRandom,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
Symbol,
|
Symbol,
|
||||||
|
SafeArrayIterator,
|
||||||
StringFromCharCode,
|
StringFromCharCode,
|
||||||
StringPrototypeTrim,
|
StringPrototypeTrim,
|
||||||
StringPrototypeSlice,
|
StringPrototypeSlice,
|
||||||
|
@ -162,7 +163,7 @@
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const entry of this[entryList]) {
|
for (const entry of new SafeArrayIterator(this[entryList])) {
|
||||||
if (entry.name === name) return entry.value;
|
if (entry.name === name) return entry.value;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -183,7 +184,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
const returnList = [];
|
const returnList = [];
|
||||||
for (const entry of this[entryList]) {
|
for (const entry of new SafeArrayIterator(this[entryList])) {
|
||||||
if (entry.name === name) ArrayPrototypePush(returnList, entry.value);
|
if (entry.name === name) ArrayPrototypePush(returnList, entry.value);
|
||||||
}
|
}
|
||||||
return returnList;
|
return returnList;
|
||||||
|
@ -203,7 +204,7 @@
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const entry of this[entryList]) {
|
for (const entry of new SafeArrayIterator(this[entryList])) {
|
||||||
if (entry.name === name) return true;
|
if (entry.name === name) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -298,6 +299,7 @@
|
||||||
const chunks = [];
|
const chunks = [];
|
||||||
const prefix = `--${boundary}\r\nContent-Disposition: form-data; name="`;
|
const prefix = `--${boundary}\r\nContent-Disposition: form-data; name="`;
|
||||||
|
|
||||||
|
// deno-lint-ignore prefer-primordials
|
||||||
for (const [name, value] of formData) {
|
for (const [name, value] of formData) {
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
ArrayPrototypePush(
|
ArrayPrototypePush(
|
||||||
|
@ -372,7 +374,7 @@
|
||||||
#parseHeaders(headersText) {
|
#parseHeaders(headersText) {
|
||||||
const headers = new Headers();
|
const headers = new Headers();
|
||||||
const rawHeaders = StringPrototypeSplit(headersText, "\r\n");
|
const rawHeaders = StringPrototypeSplit(headersText, "\r\n");
|
||||||
for (const rawHeader of rawHeaders) {
|
for (const rawHeader of new SafeArrayIterator(rawHeaders)) {
|
||||||
const sepIndex = StringPrototypeIndexOf(rawHeader, ":");
|
const sepIndex = StringPrototypeIndexOf(rawHeader, ":");
|
||||||
if (sepIndex < 0) {
|
if (sepIndex < 0) {
|
||||||
continue; // Skip this header
|
continue; // Skip this header
|
||||||
|
|
|
@ -6,18 +6,20 @@
|
||||||
const ops = core.ops;
|
const ops = core.ops;
|
||||||
const __bootstrap = window.__bootstrap;
|
const __bootstrap = window.__bootstrap;
|
||||||
const {
|
const {
|
||||||
ObjectDefineProperty,
|
|
||||||
ArrayPrototypeMap,
|
ArrayPrototypeMap,
|
||||||
|
ArrayPrototypeJoin,
|
||||||
|
ObjectDefineProperty,
|
||||||
|
ObjectPrototypeHasOwnProperty,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
Number,
|
Number,
|
||||||
NumberIsSafeInteger,
|
NumberIsSafeInteger,
|
||||||
ArrayPrototypeJoin,
|
|
||||||
ObjectPrototypeIsPrototypeOf,
|
|
||||||
TypeError,
|
TypeError,
|
||||||
Int32Array,
|
Int32Array,
|
||||||
Uint32Array,
|
Uint32Array,
|
||||||
BigInt64Array,
|
BigInt64Array,
|
||||||
BigUint64Array,
|
BigUint64Array,
|
||||||
Function,
|
Function,
|
||||||
|
ReflectHas,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
const U32_BUFFER = new Uint32Array(2);
|
const U32_BUFFER = new Uint32Array(2);
|
||||||
|
@ -273,7 +275,11 @@
|
||||||
constructor(path, symbols) {
|
constructor(path, symbols) {
|
||||||
[this.#rid, this.symbols] = ops.op_ffi_load({ path, symbols });
|
[this.#rid, this.symbols] = ops.op_ffi_load({ path, symbols });
|
||||||
for (const symbol in symbols) {
|
for (const symbol in symbols) {
|
||||||
if ("type" in symbols[symbol]) {
|
if (!ObjectPrototypeHasOwnProperty(symbols, symbol)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ReflectHas(symbols[symbol], "type")) {
|
||||||
const type = symbols[symbol].type;
|
const type = symbols[symbol].type;
|
||||||
if (type === "void") {
|
if (type === "void") {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
} = window.__bootstrap.webSocket;
|
} = window.__bootstrap.webSocket;
|
||||||
const { _ws } = window.__bootstrap.http;
|
const { _ws } = window.__bootstrap.http;
|
||||||
const {
|
const {
|
||||||
Function,
|
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
Promise,
|
PromisePrototype,
|
||||||
PromisePrototypeCatch,
|
PromisePrototypeCatch,
|
||||||
PromisePrototypeThen,
|
PromisePrototypeThen,
|
||||||
|
SafeArrayIterator,
|
||||||
SafePromiseAll,
|
SafePromiseAll,
|
||||||
TypedArrayPrototypeSubarray,
|
TypedArrayPrototypeSubarray,
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
// status-line = HTTP-version SP status-code SP reason-phrase CRLF
|
// status-line = HTTP-version SP status-code SP reason-phrase CRLF
|
||||||
// Date header: https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.1.2
|
// Date header: https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.1.2
|
||||||
let str = `HTTP/1.1 ${status} ${statusCodes[status]}\r\nDate: ${date}\r\n`;
|
let str = `HTTP/1.1 ${status} ${statusCodes[status]}\r\nDate: ${date}\r\n`;
|
||||||
for (const [name, value] of headerList) {
|
for (const [name, value] of new SafeArrayIterator(headerList)) {
|
||||||
// header-field = field-name ":" OWS field-value OWS
|
// header-field = field-name ":" OWS field-value OWS
|
||||||
str += `${name}: ${value}\r\n`;
|
str += `${name}: ${value}\r\n`;
|
||||||
}
|
}
|
||||||
|
@ -439,10 +439,10 @@
|
||||||
return async function serve(arg1, arg2) {
|
return async function serve(arg1, arg2) {
|
||||||
let options = undefined;
|
let options = undefined;
|
||||||
let handler = undefined;
|
let handler = undefined;
|
||||||
if (arg1 instanceof Function) {
|
if (typeof arg1 === "function") {
|
||||||
handler = arg1;
|
handler = arg1;
|
||||||
options = arg2;
|
options = arg2;
|
||||||
} else if (arg2 instanceof Function) {
|
} else if (typeof arg2 === "function") {
|
||||||
handler = arg2;
|
handler = arg2;
|
||||||
options = arg1;
|
options = arg1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -456,7 +456,7 @@
|
||||||
}
|
}
|
||||||
handler = options.handler;
|
handler = options.handler;
|
||||||
}
|
}
|
||||||
if (!(handler instanceof Function)) {
|
if (typeof handler !== "function") {
|
||||||
throw new TypeError("A handler function must be provided.");
|
throw new TypeError("A handler function must be provided.");
|
||||||
}
|
}
|
||||||
if (options === undefined) {
|
if (options === undefined) {
|
||||||
|
@ -570,7 +570,7 @@
|
||||||
let resp;
|
let resp;
|
||||||
try {
|
try {
|
||||||
resp = handler(req);
|
resp = handler(req);
|
||||||
if (resp instanceof Promise) {
|
if (ObjectPrototypeIsPrototypeOf(PromisePrototype, resp)) {
|
||||||
PromisePrototypeCatch(
|
PromisePrototypeCatch(
|
||||||
PromisePrototypeThen(
|
PromisePrototypeThen(
|
||||||
resp,
|
resp,
|
||||||
|
|
|
@ -45,10 +45,10 @@
|
||||||
ArrayPrototypeSome,
|
ArrayPrototypeSome,
|
||||||
Error,
|
Error,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
|
SafeSetIterator,
|
||||||
Set,
|
Set,
|
||||||
SetPrototypeAdd,
|
SetPrototypeAdd,
|
||||||
SetPrototypeDelete,
|
SetPrototypeDelete,
|
||||||
SetPrototypeValues,
|
|
||||||
StringPrototypeIncludes,
|
StringPrototypeIncludes,
|
||||||
StringPrototypeToLowerCase,
|
StringPrototypeToLowerCase,
|
||||||
StringPrototypeSplit,
|
StringPrototypeSplit,
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
if (!this.#closed) {
|
if (!this.#closed) {
|
||||||
this.#closed = true;
|
this.#closed = true;
|
||||||
core.close(this.#rid);
|
core.close(this.#rid);
|
||||||
for (const rid of SetPrototypeValues(this.managedResources)) {
|
for (const rid of new SafeSetIterator(this.managedResources)) {
|
||||||
SetPrototypeDelete(this.managedResources, rid);
|
SetPrototypeDelete(this.managedResources, rid);
|
||||||
core.close(rid);
|
core.close(rid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
});
|
});
|
||||||
const values = [];
|
const values = [];
|
||||||
for (const entry of this[_list]) {
|
for (const entry of new SafeArrayIterator(this[_list])) {
|
||||||
if (entry[0] === name) {
|
if (entry[0] === name) {
|
||||||
ArrayPrototypePush(values, entry[1]);
|
ArrayPrototypePush(values, entry[1]);
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@
|
||||||
prefix,
|
prefix,
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
});
|
});
|
||||||
for (const entry of this[_list]) {
|
for (const entry of new SafeArrayIterator(this[_list])) {
|
||||||
if (entry[0] === name) {
|
if (entry[0] === name) {
|
||||||
return entry[1];
|
return entry[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
RegExp,
|
RegExp,
|
||||||
RegExpPrototypeExec,
|
RegExpPrototypeExec,
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
|
SafeArrayIterator,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -71,7 +72,7 @@
|
||||||
|
|
||||||
const components = ops.op_urlpattern_parse(input, baseURL);
|
const components = ops.op_urlpattern_parse(input, baseURL);
|
||||||
|
|
||||||
for (const key of ObjectKeys(components)) {
|
for (const key of new SafeArrayIterator(ObjectKeys(components))) {
|
||||||
try {
|
try {
|
||||||
components[key].regexp = new RegExp(
|
components[key].regexp = new RegExp(
|
||||||
components[key].regexpString,
|
components[key].regexpString,
|
||||||
|
@ -155,7 +156,7 @@
|
||||||
|
|
||||||
const [values] = res;
|
const [values] = res;
|
||||||
|
|
||||||
for (const key of ObjectKeys(values)) {
|
for (const key of new SafeArrayIterator(ObjectKeys(values))) {
|
||||||
if (!RegExpPrototypeTest(this[_components][key].regexp, values[key])) {
|
if (!RegExpPrototypeTest(this[_components][key].regexp, values[key])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +202,7 @@
|
||||||
const result = { inputs };
|
const result = { inputs };
|
||||||
|
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
for (const key of ObjectKeys(values)) {
|
for (const key of new SafeArrayIterator(ObjectKeys(values))) {
|
||||||
/** @type {Component} */
|
/** @type {Component} */
|
||||||
const component = this[_components][key];
|
const component = this[_components][key];
|
||||||
const input = values[key];
|
const input = values[key];
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
ObjectEntries,
|
ObjectEntries,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectSetPrototypeOf,
|
ObjectSetPrototypeOf,
|
||||||
|
SafeArrayIterator,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -166,33 +167,35 @@
|
||||||
const DOMExceptionPrototype = DOMException.prototype;
|
const DOMExceptionPrototype = DOMException.prototype;
|
||||||
|
|
||||||
for (
|
for (
|
||||||
const [key, value] of ObjectEntries({
|
const [key, value] of new SafeArrayIterator(
|
||||||
INDEX_SIZE_ERR,
|
ObjectEntries({
|
||||||
DOMSTRING_SIZE_ERR,
|
INDEX_SIZE_ERR,
|
||||||
HIERARCHY_REQUEST_ERR,
|
DOMSTRING_SIZE_ERR,
|
||||||
WRONG_DOCUMENT_ERR,
|
HIERARCHY_REQUEST_ERR,
|
||||||
INVALID_CHARACTER_ERR,
|
WRONG_DOCUMENT_ERR,
|
||||||
NO_DATA_ALLOWED_ERR,
|
INVALID_CHARACTER_ERR,
|
||||||
NO_MODIFICATION_ALLOWED_ERR,
|
NO_DATA_ALLOWED_ERR,
|
||||||
NOT_FOUND_ERR,
|
NO_MODIFICATION_ALLOWED_ERR,
|
||||||
NOT_SUPPORTED_ERR,
|
NOT_FOUND_ERR,
|
||||||
INUSE_ATTRIBUTE_ERR,
|
NOT_SUPPORTED_ERR,
|
||||||
INVALID_STATE_ERR,
|
INUSE_ATTRIBUTE_ERR,
|
||||||
SYNTAX_ERR,
|
INVALID_STATE_ERR,
|
||||||
INVALID_MODIFICATION_ERR,
|
SYNTAX_ERR,
|
||||||
NAMESPACE_ERR,
|
INVALID_MODIFICATION_ERR,
|
||||||
INVALID_ACCESS_ERR,
|
NAMESPACE_ERR,
|
||||||
VALIDATION_ERR,
|
INVALID_ACCESS_ERR,
|
||||||
TYPE_MISMATCH_ERR,
|
VALIDATION_ERR,
|
||||||
SECURITY_ERR,
|
TYPE_MISMATCH_ERR,
|
||||||
NETWORK_ERR,
|
SECURITY_ERR,
|
||||||
ABORT_ERR,
|
NETWORK_ERR,
|
||||||
URL_MISMATCH_ERR,
|
ABORT_ERR,
|
||||||
QUOTA_EXCEEDED_ERR,
|
URL_MISMATCH_ERR,
|
||||||
TIMEOUT_ERR,
|
QUOTA_EXCEEDED_ERR,
|
||||||
INVALID_NODE_TYPE_ERR,
|
TIMEOUT_ERR,
|
||||||
DATA_CLONE_ERR,
|
INVALID_NODE_TYPE_ERR,
|
||||||
})
|
DATA_CLONE_ERR,
|
||||||
|
}),
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
const desc = { value, enumerable: true };
|
const desc = { value, enumerable: true };
|
||||||
ObjectDefineProperty(DOMException, key, desc);
|
ObjectDefineProperty(DOMException, key, desc);
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
MapPrototypeHas,
|
MapPrototypeHas,
|
||||||
MapPrototypeSet,
|
MapPrototypeSet,
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
|
SafeArrayIterator,
|
||||||
|
SafeMapIterator,
|
||||||
StringPrototypeReplaceAll,
|
StringPrototypeReplaceAll,
|
||||||
StringPrototypeToLowerCase,
|
StringPrototypeToLowerCase,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -195,7 +197,7 @@
|
||||||
*/
|
*/
|
||||||
function serializeMimeType(mimeType) {
|
function serializeMimeType(mimeType) {
|
||||||
let serialization = essence(mimeType);
|
let serialization = essence(mimeType);
|
||||||
for (const param of mimeType.parameters) {
|
for (const param of new SafeMapIterator(mimeType.parameters)) {
|
||||||
serialization += `;${param[0]}=`;
|
serialization += `;${param[0]}=`;
|
||||||
let value = param[1];
|
let value = param[1];
|
||||||
if (!RegExpPrototypeTest(HTTP_TOKEN_CODE_POINT_RE, value)) {
|
if (!RegExpPrototypeTest(HTTP_TOKEN_CODE_POINT_RE, value)) {
|
||||||
|
@ -221,7 +223,7 @@
|
||||||
let charset = null;
|
let charset = null;
|
||||||
let essence_ = null;
|
let essence_ = null;
|
||||||
let mimeType = null;
|
let mimeType = null;
|
||||||
for (const value of headerValues) {
|
for (const value of new SafeArrayIterator(headerValues)) {
|
||||||
const temporaryMimeType = parseMimeType(value);
|
const temporaryMimeType = parseMimeType(value);
|
||||||
if (
|
if (
|
||||||
temporaryMimeType === null ||
|
temporaryMimeType === null ||
|
||||||
|
|
|
@ -428,7 +428,7 @@
|
||||||
Ctor,
|
Ctor,
|
||||||
props,
|
props,
|
||||||
) {
|
) {
|
||||||
for (const prop of props) {
|
for (const prop of new SafeArrayIterator(props)) {
|
||||||
ReflectDefineProperty(Ctor.prototype, prop, { enumerable: true });
|
ReflectDefineProperty(Ctor.prototype, prop, { enumerable: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -969,7 +969,7 @@
|
||||||
listeners[type] = [];
|
listeners[type] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const listener of listeners[type]) {
|
for (const listener of new SafeArrayIterator(listeners[type])) {
|
||||||
if (
|
if (
|
||||||
((typeof listener.options === "boolean" &&
|
((typeof listener.options === "boolean" &&
|
||||||
listener.options === options.capture) ||
|
listener.options === options.capture) ||
|
||||||
|
@ -1334,9 +1334,12 @@
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
return inspect(consoleInternal.createFilteredInspectProxy({
|
return inspect(consoleInternal.createFilteredInspectProxy({
|
||||||
object: this,
|
object: this,
|
||||||
evaluate: this instanceof PromiseRejectionEvent,
|
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||||
|
PromiseRejectionEvent.prototype,
|
||||||
|
this,
|
||||||
|
),
|
||||||
keys: [
|
keys: [
|
||||||
...EVENT_PROPS,
|
...new SafeArrayIterator(EVENT_PROPS),
|
||||||
"promise",
|
"promise",
|
||||||
"reason",
|
"reason",
|
||||||
],
|
],
|
||||||
|
@ -1451,7 +1454,7 @@
|
||||||
colno = jsError.frames[0].columnNumber;
|
colno = jsError.frames[0].columnNumber;
|
||||||
} else {
|
} else {
|
||||||
const jsError = core.destructureError(new Error());
|
const jsError = core.destructureError(new Error());
|
||||||
for (const frame of jsError.frames) {
|
for (const frame of new SafeArrayIterator(jsError.frames)) {
|
||||||
if (
|
if (
|
||||||
typeof frame.fileName == "string" &&
|
typeof frame.fileName == "string" &&
|
||||||
!StringPrototypeStartsWith(frame.fileName, "deno:")
|
!StringPrototypeStartsWith(frame.fileName, "deno:")
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
const { Event, setIsTrusted, defineEventHandler } = window.__bootstrap.event;
|
const { Event, setIsTrusted, defineEventHandler } = window.__bootstrap.event;
|
||||||
const { EventTarget, listenerCount } = window.__bootstrap.eventTarget;
|
const { EventTarget, listenerCount } = window.__bootstrap.eventTarget;
|
||||||
const {
|
const {
|
||||||
|
SafeArrayIterator,
|
||||||
|
SafeSetIterator,
|
||||||
Set,
|
Set,
|
||||||
SetPrototypeAdd,
|
SetPrototypeAdd,
|
||||||
SetPrototypeDelete,
|
SetPrototypeDelete,
|
||||||
|
@ -76,7 +78,7 @@
|
||||||
}
|
}
|
||||||
this[abortReason] = reason;
|
this[abortReason] = reason;
|
||||||
if (this[abortAlgos] !== null) {
|
if (this[abortAlgos] !== null) {
|
||||||
for (const algorithm of this[abortAlgos]) {
|
for (const algorithm of new SafeSetIterator(this[abortAlgos])) {
|
||||||
algorithm();
|
algorithm();
|
||||||
}
|
}
|
||||||
this[abortAlgos] = null;
|
this[abortAlgos] = null;
|
||||||
|
@ -124,14 +126,14 @@
|
||||||
// only be used by Deno internals, which use it to essentially cancel async
|
// only be used by Deno internals, which use it to essentially cancel async
|
||||||
// ops which would block the event loop.
|
// ops which would block the event loop.
|
||||||
addEventListener(...args) {
|
addEventListener(...args) {
|
||||||
super.addEventListener(...args);
|
super.addEventListener(...new SafeArrayIterator(args));
|
||||||
if (this[timerId] !== null && listenerCount(this, "abort") > 0) {
|
if (this[timerId] !== null && listenerCount(this, "abort") > 0) {
|
||||||
refTimer(this[timerId]);
|
refTimer(this[timerId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeEventListener(...args) {
|
removeEventListener(...args) {
|
||||||
super.removeEventListener(...args);
|
super.removeEventListener(...new SafeArrayIterator(args));
|
||||||
if (this[timerId] !== null && listenerCount(this, "abort") === 0) {
|
if (this[timerId] !== null && listenerCount(this, "abort") === 0) {
|
||||||
unrefTimer(this[timerId]);
|
unrefTimer(this[timerId]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,10 @@
|
||||||
const ops = core.ops;
|
const ops = core.ops;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const { DOMException } = window.__bootstrap.domException;
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
const { TypeError } = window.__bootstrap.primordials;
|
const {
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
|
TypeErrorPrototype,
|
||||||
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} data
|
* @param {string} data
|
||||||
|
@ -29,7 +32,7 @@
|
||||||
try {
|
try {
|
||||||
return ops.op_base64_atob(data);
|
return ops.op_base64_atob(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof TypeError) {
|
if (ObjectPrototypeIsPrototypeOf(TypeErrorPrototype, e)) {
|
||||||
throw new DOMException(
|
throw new DOMException(
|
||||||
"Failed to decode base64: invalid character",
|
"Failed to decode base64: invalid character",
|
||||||
"InvalidCharacterError",
|
"InvalidCharacterError",
|
||||||
|
@ -53,7 +56,7 @@
|
||||||
try {
|
try {
|
||||||
return ops.op_base64_btoa(data);
|
return ops.op_base64_btoa(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof TypeError) {
|
if (ObjectPrototypeIsPrototypeOf(TypeErrorPrototype, e)) {
|
||||||
throw new DOMException(
|
throw new DOMException(
|
||||||
"The string to be encoded contains characters outside of the Latin1 range.",
|
"The string to be encoded contains characters outside of the Latin1 range.",
|
||||||
"InvalidCharacterError",
|
"InvalidCharacterError",
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
queueMicrotask,
|
queueMicrotask,
|
||||||
RangeError,
|
RangeError,
|
||||||
ReflectHas,
|
ReflectHas,
|
||||||
|
SafeArrayIterator,
|
||||||
SafePromiseAll,
|
SafePromiseAll,
|
||||||
SharedArrayBuffer,
|
SharedArrayBuffer,
|
||||||
Symbol,
|
Symbol,
|
||||||
|
@ -769,7 +770,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function readableStreamIsUnrefable(stream) {
|
function readableStreamIsUnrefable(stream) {
|
||||||
return _isUnref in stream;
|
return ReflectHas(stream, _isUnref);
|
||||||
}
|
}
|
||||||
|
|
||||||
function readableStreamForRidUnrefableRef(stream) {
|
function readableStreamForRidUnrefableRef(stream) {
|
||||||
|
@ -858,7 +859,7 @@
|
||||||
|
|
||||||
const finalBuffer = new Uint8Array(totalLength);
|
const finalBuffer = new Uint8Array(totalLength);
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (const chunk of chunks) {
|
for (const chunk of new SafeArrayIterator(chunks)) {
|
||||||
TypedArrayPrototypeSet(finalBuffer, chunk, i);
|
TypedArrayPrototypeSet(finalBuffer, chunk, i);
|
||||||
i += chunk.byteLength;
|
i += chunk.byteLength;
|
||||||
}
|
}
|
||||||
|
@ -1345,7 +1346,7 @@
|
||||||
if (reader !== undefined && isReadableStreamBYOBReader(reader)) {
|
if (reader !== undefined && isReadableStreamBYOBReader(reader)) {
|
||||||
const readIntoRequests = reader[_readIntoRequests];
|
const readIntoRequests = reader[_readIntoRequests];
|
||||||
reader[_readIntoRequests] = [];
|
reader[_readIntoRequests] = [];
|
||||||
for (const readIntoRequest of readIntoRequests) {
|
for (const readIntoRequest of new SafeArrayIterator(readIntoRequests)) {
|
||||||
readIntoRequest.closeSteps(undefined);
|
readIntoRequest.closeSteps(undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1371,7 +1372,7 @@
|
||||||
/** @type {Array<ReadRequest<R>>} */
|
/** @type {Array<ReadRequest<R>>} */
|
||||||
const readRequests = reader[_readRequests];
|
const readRequests = reader[_readRequests];
|
||||||
reader[_readRequests] = [];
|
reader[_readRequests] = [];
|
||||||
for (const readRequest of readRequests) {
|
for (const readRequest of new SafeArrayIterator(readRequests)) {
|
||||||
readRequest.closeSteps();
|
readRequest.closeSteps();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1593,7 +1594,7 @@
|
||||||
function readableStreamDefaultReaderErrorReadRequests(reader, e) {
|
function readableStreamDefaultReaderErrorReadRequests(reader, e) {
|
||||||
const readRequests = reader[_readRequests];
|
const readRequests = reader[_readRequests];
|
||||||
reader[_readRequests] = [];
|
reader[_readRequests] = [];
|
||||||
for (const readRequest of readRequests) {
|
for (const readRequest of new SafeArrayIterator(readRequests)) {
|
||||||
readRequest.errorSteps(e);
|
readRequest.errorSteps(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2613,7 +2614,7 @@
|
||||||
function readableStreamBYOBReaderErrorReadIntoRequests(reader, e) {
|
function readableStreamBYOBReaderErrorReadIntoRequests(reader, e) {
|
||||||
const readIntoRequests = reader[_readIntoRequests];
|
const readIntoRequests = reader[_readIntoRequests];
|
||||||
reader[_readIntoRequests] = [];
|
reader[_readIntoRequests] = [];
|
||||||
for (const readIntoRequest of readIntoRequests) {
|
for (const readIntoRequest of new SafeArrayIterator(readIntoRequests)) {
|
||||||
readIntoRequest.errorSteps(e);
|
readIntoRequest.errorSteps(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4237,7 +4238,7 @@
|
||||||
stream[_state] = "errored";
|
stream[_state] = "errored";
|
||||||
stream[_controller][_errorSteps]();
|
stream[_controller][_errorSteps]();
|
||||||
const storedError = stream[_storedError];
|
const storedError = stream[_storedError];
|
||||||
for (const writeRequest of stream[_writeRequests]) {
|
for (const writeRequest of new SafeArrayIterator(stream[_writeRequests])) {
|
||||||
writeRequest.reject(storedError);
|
writeRequest.reject(storedError);
|
||||||
}
|
}
|
||||||
stream[_writeRequests] = [];
|
stream[_writeRequests] = [];
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
MathMin,
|
MathMin,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
|
SafeArrayIterator,
|
||||||
StringPrototypeCharAt,
|
StringPrototypeCharAt,
|
||||||
StringPrototypeToLowerCase,
|
StringPrototypeToLowerCase,
|
||||||
StringPrototypeSlice,
|
StringPrototypeSlice,
|
||||||
|
@ -94,7 +95,7 @@
|
||||||
|
|
||||||
/** @param {(BlobReference | Blob)[]} parts */
|
/** @param {(BlobReference | Blob)[]} parts */
|
||||||
async function* toIterator(parts) {
|
async function* toIterator(parts) {
|
||||||
for (const part of parts) {
|
for (const part of new SafeArrayIterator(parts)) {
|
||||||
yield* part.stream();
|
yield* part.stream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +111,7 @@
|
||||||
/** @type {(BlobReference|Blob)[]} */
|
/** @type {(BlobReference|Blob)[]} */
|
||||||
const processedParts = [];
|
const processedParts = [];
|
||||||
let size = 0;
|
let size = 0;
|
||||||
for (const element of parts) {
|
for (const element of new SafeArrayIterator(parts)) {
|
||||||
if (ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, element)) {
|
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));
|
||||||
|
@ -158,7 +159,7 @@
|
||||||
* @returns {string[]}
|
* @returns {string[]}
|
||||||
*/
|
*/
|
||||||
function getParts(blob, bag = []) {
|
function getParts(blob, bag = []) {
|
||||||
for (const part of blob[_parts]) {
|
for (const part of new SafeArrayIterator(blob[_parts])) {
|
||||||
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, part)) {
|
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, part)) {
|
||||||
getParts(part, bag);
|
getParts(part, bag);
|
||||||
} else {
|
} else {
|
||||||
|
@ -275,7 +276,7 @@
|
||||||
const blobParts = [];
|
const blobParts = [];
|
||||||
let added = 0;
|
let added = 0;
|
||||||
|
|
||||||
for (const part of this[_parts]) {
|
for (const part of new SafeArrayIterator(this[_parts])) {
|
||||||
// don't add the overflow to new blobParts
|
// don't add the overflow to new blobParts
|
||||||
if (added >= span) {
|
if (added >= span) {
|
||||||
// Could maybe be possible to remove variable `added`
|
// Could maybe be possible to remove variable `added`
|
||||||
|
@ -349,6 +350,7 @@
|
||||||
const bytes = new Uint8Array(size);
|
const bytes = new Uint8Array(size);
|
||||||
const partIterator = toIterator(this[_parts]);
|
const partIterator = toIterator(this[_parts]);
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
|
// deno-lint-ignore prefer-primordials
|
||||||
for await (const chunk of partIterator) {
|
for await (const chunk of partIterator) {
|
||||||
const byteLength = chunk.byteLength;
|
const byteLength = chunk.byteLength;
|
||||||
if (byteLength > 0) {
|
if (byteLength > 0) {
|
||||||
|
@ -598,7 +600,7 @@
|
||||||
const parts = [];
|
const parts = [];
|
||||||
let totalSize = 0;
|
let totalSize = 0;
|
||||||
|
|
||||||
for (const { uuid, size } of blobData.parts) {
|
for (const { uuid, size } of new SafeArrayIterator(blobData.parts)) {
|
||||||
ArrayPrototypePush(parts, new BlobReference(uuid, size));
|
ArrayPrototypePush(parts, new BlobReference(uuid, size));
|
||||||
totalSize += size;
|
totalSize += size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@
|
||||||
);
|
);
|
||||||
const bytes = new Uint8Array(size);
|
const bytes = new Uint8Array(size);
|
||||||
let offs = 0;
|
let offs = 0;
|
||||||
for (const chunk of chunks) {
|
for (const chunk of new SafeArrayIterator(chunks)) {
|
||||||
TypedArrayPrototypeSet(bytes, chunk, offs);
|
TypedArrayPrototypeSet(bytes, chunk, offs);
|
||||||
offs += chunk.byteLength;
|
offs += chunk.byteLength;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectSetPrototypeOf,
|
ObjectSetPrototypeOf,
|
||||||
|
SafeArrayIterator,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
SymbolIterator,
|
SymbolIterator,
|
||||||
|
@ -204,7 +205,9 @@
|
||||||
const arrayBufferIdsInTransferables = [];
|
const arrayBufferIdsInTransferables = [];
|
||||||
const transferredArrayBuffers = [];
|
const transferredArrayBuffers = [];
|
||||||
|
|
||||||
for (const transferable of messageData.transferables) {
|
for (
|
||||||
|
const transferable of new SafeArrayIterator(messageData.transferables)
|
||||||
|
) {
|
||||||
switch (transferable.kind) {
|
switch (transferable.kind) {
|
||||||
case "messagePort": {
|
case "messagePort": {
|
||||||
const port = createMessagePort(transferable.data);
|
const port = createMessagePort(transferable.data);
|
||||||
|
@ -271,7 +274,7 @@
|
||||||
const serializedTransferables = [];
|
const serializedTransferables = [];
|
||||||
|
|
||||||
let arrayBufferI = 0;
|
let arrayBufferI = 0;
|
||||||
for (const transferable of transferables) {
|
for (const transferable of new SafeArrayIterator(transferables)) {
|
||||||
if (ObjectPrototypeIsPrototypeOf(MessagePortPrototype, transferable)) {
|
if (ObjectPrototypeIsPrototypeOf(MessagePortPrototype, transferable)) {
|
||||||
webidl.assertBranded(transferable, MessagePortPrototype);
|
webidl.assertBranded(transferable, MessagePortPrototype);
|
||||||
const id = transferable[_id];
|
const id = transferable[_id];
|
||||||
|
|
|
@ -316,7 +316,7 @@
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
});
|
});
|
||||||
const requiredFeatures = descriptor.requiredFeatures ?? [];
|
const requiredFeatures = descriptor.requiredFeatures ?? [];
|
||||||
for (const feature of requiredFeatures) {
|
for (const feature of new SafeArrayIterator(requiredFeatures)) {
|
||||||
if (!SetPrototypeHas(this[_adapter].features[_features], feature)) {
|
if (!SetPrototypeHas(this[_adapter].features[_features], feature)) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
`${prefix}: nonGuaranteedFeatures must be a subset of the adapter features.`,
|
`${prefix}: nonGuaranteedFeatures must be a subset of the adapter features.`,
|
||||||
|
@ -1046,7 +1046,7 @@
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
});
|
});
|
||||||
const device = assertDevice(this, { prefix, context: "this" });
|
const device = assertDevice(this, { prefix, context: "this" });
|
||||||
for (const entry of descriptor.entries) {
|
for (const entry of new SafeArrayIterator(descriptor.entries)) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
if (entry.buffer) i++;
|
if (entry.buffer) i++;
|
||||||
if (entry.sampler) i++;
|
if (entry.sampler) i++;
|
||||||
|
@ -1591,7 +1591,7 @@
|
||||||
device.rid,
|
device.rid,
|
||||||
commandBufferRids,
|
commandBufferRids,
|
||||||
);
|
);
|
||||||
for (const commandBuffer of commandBuffers) {
|
for (const commandBuffer of new SafeArrayIterator(commandBuffers)) {
|
||||||
commandBuffer[_rid] = undefined;
|
commandBuffer[_rid] = undefined;
|
||||||
}
|
}
|
||||||
device.pushError(err);
|
device.pushError(err);
|
||||||
|
@ -1934,7 +1934,7 @@
|
||||||
if (!mappedRanges) {
|
if (!mappedRanges) {
|
||||||
throw new DOMException(`${prefix}: invalid state.`, "OperationError");
|
throw new DOMException(`${prefix}: invalid state.`, "OperationError");
|
||||||
}
|
}
|
||||||
for (const [buffer, _rid, start] of mappedRanges) {
|
for (const [buffer, _rid, start] of new SafeArrayIterator(mappedRanges)) {
|
||||||
// TODO(lucacasonato): is this logic correct?
|
// TODO(lucacasonato): is this logic correct?
|
||||||
const end = start + buffer.byteLength;
|
const end = start + buffer.byteLength;
|
||||||
if (
|
if (
|
||||||
|
@ -2002,7 +2002,7 @@
|
||||||
if (!mappedRanges) {
|
if (!mappedRanges) {
|
||||||
throw new DOMException(`${prefix}: invalid state.`, "OperationError");
|
throw new DOMException(`${prefix}: invalid state.`, "OperationError");
|
||||||
}
|
}
|
||||||
for (const [buffer, mappedRid] of mappedRanges) {
|
for (const [buffer, mappedRid] of new SafeArrayIterator(mappedRanges)) {
|
||||||
const { err } = ops.op_webgpu_buffer_unmap(
|
const { err } = ops.op_webgpu_buffer_unmap(
|
||||||
bufferRid,
|
bufferRid,
|
||||||
mappedRid,
|
mappedRid,
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
ReflectHas,
|
ReflectHas,
|
||||||
ReflectOwnKeys,
|
ReflectOwnKeys,
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
|
SafeArrayIterator,
|
||||||
Set,
|
Set,
|
||||||
// TODO(lucacasonato): add SharedArrayBuffer to primordials
|
// TODO(lucacasonato): add SharedArrayBuffer to primordials
|
||||||
// SharedArrayBuffer,
|
// SharedArrayBuffer,
|
||||||
|
@ -632,8 +633,8 @@
|
||||||
function createDictionaryConverter(name, ...dictionaries) {
|
function createDictionaryConverter(name, ...dictionaries) {
|
||||||
let hasRequiredKey = false;
|
let hasRequiredKey = false;
|
||||||
const allMembers = [];
|
const allMembers = [];
|
||||||
for (const members of dictionaries) {
|
for (const members of new SafeArrayIterator(dictionaries)) {
|
||||||
for (const member of members) {
|
for (const member of new SafeArrayIterator(members)) {
|
||||||
if (member.required) {
|
if (member.required) {
|
||||||
hasRequiredKey = true;
|
hasRequiredKey = true;
|
||||||
}
|
}
|
||||||
|
@ -648,7 +649,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
const defaultValues = {};
|
const defaultValues = {};
|
||||||
for (const member of allMembers) {
|
for (const member of new SafeArrayIterator(allMembers)) {
|
||||||
if (ReflectHas(member, "defaultValue")) {
|
if (ReflectHas(member, "defaultValue")) {
|
||||||
const idlMemberValue = member.defaultValue;
|
const idlMemberValue = member.defaultValue;
|
||||||
const imvType = typeof idlMemberValue;
|
const imvType = typeof idlMemberValue;
|
||||||
|
@ -694,7 +695,7 @@
|
||||||
return idlDict;
|
return idlDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const member of allMembers) {
|
for (const member of new SafeArrayIterator(allMembers)) {
|
||||||
const key = member.key;
|
const key = member.key;
|
||||||
|
|
||||||
let esMemberValue;
|
let esMemberValue;
|
||||||
|
@ -820,7 +821,7 @@
|
||||||
}
|
}
|
||||||
// Slow path if Proxy (e.g: in WPT tests)
|
// Slow path if Proxy (e.g: in WPT tests)
|
||||||
const keys = ReflectOwnKeys(V);
|
const keys = ReflectOwnKeys(V);
|
||||||
for (const key of keys) {
|
for (const key of new SafeArrayIterator(keys)) {
|
||||||
const desc = ObjectGetOwnPropertyDescriptor(V, key);
|
const desc = ObjectGetOwnPropertyDescriptor(V, key);
|
||||||
if (desc !== undefined && desc.enumerable === true) {
|
if (desc !== undefined && desc.enumerable === true) {
|
||||||
const typedKey = keyConverter(key, opts);
|
const typedKey = keyConverter(key, opts);
|
||||||
|
@ -890,7 +891,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function define(target, source) {
|
function define(target, source) {
|
||||||
for (const key of ReflectOwnKeys(source)) {
|
for (const key of new SafeArrayIterator(ReflectOwnKeys(source))) {
|
||||||
const descriptor = ReflectGetOwnPropertyDescriptor(source, key);
|
const descriptor = ReflectGetOwnPropertyDescriptor(source, key);
|
||||||
if (descriptor && !ReflectDefineProperty(target, key, descriptor)) {
|
if (descriptor && !ReflectDefineProperty(target, key, descriptor)) {
|
||||||
throw new TypeError(`Cannot redefine property: ${String(key)}`);
|
throw new TypeError(`Cannot redefine property: ${String(key)}`);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
PromiseResolve,
|
PromiseResolve,
|
||||||
PromiseReject,
|
PromiseReject,
|
||||||
ReflectHas,
|
ReflectHas,
|
||||||
|
SafeArrayIterator,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
TypeError,
|
TypeError,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -233,7 +234,9 @@
|
||||||
function serializePermissions(permissions) {
|
function serializePermissions(permissions) {
|
||||||
if (typeof permissions == "object" && permissions != null) {
|
if (typeof permissions == "object" && permissions != null) {
|
||||||
const serializedPermissions = {};
|
const serializedPermissions = {};
|
||||||
for (const key of ["read", "write", "run", "ffi"]) {
|
for (
|
||||||
|
const key of new SafeArrayIterator(["read", "write", "run", "ffi"])
|
||||||
|
) {
|
||||||
if (ArrayIsArray(permissions[key])) {
|
if (ArrayIsArray(permissions[key])) {
|
||||||
serializedPermissions[key] = ArrayPrototypeMap(
|
serializedPermissions[key] = ArrayPrototypeMap(
|
||||||
permissions[key],
|
permissions[key],
|
||||||
|
@ -243,7 +246,9 @@
|
||||||
serializedPermissions[key] = permissions[key];
|
serializedPermissions[key] = permissions[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const key of ["env", "hrtime", "net", "sys"]) {
|
for (
|
||||||
|
const key of new SafeArrayIterator(["env", "hrtime", "net", "sys"])
|
||||||
|
) {
|
||||||
if (ArrayIsArray(permissions[key])) {
|
if (ArrayIsArray(permissions[key])) {
|
||||||
serializedPermissions[key] = ArrayPrototypeSlice(permissions[key]);
|
serializedPermissions[key] = ArrayPrototypeSlice(permissions[key]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
MathMin,
|
MathMin,
|
||||||
|
SafeArrayIterator,
|
||||||
TypedArrayPrototypeSubarray,
|
TypedArrayPrototypeSubarray,
|
||||||
TypedArrayPrototypeSet,
|
TypedArrayPrototypeSet,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -156,14 +157,14 @@
|
||||||
|
|
||||||
function concatBuffers(buffers) {
|
function concatBuffers(buffers) {
|
||||||
let totalLen = 0;
|
let totalLen = 0;
|
||||||
for (const buf of buffers) {
|
for (const buf of new SafeArrayIterator(buffers)) {
|
||||||
totalLen += buf.byteLength;
|
totalLen += buf.byteLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
const contents = new Uint8Array(totalLen);
|
const contents = new Uint8Array(totalLen);
|
||||||
|
|
||||||
let n = 0;
|
let n = 0;
|
||||||
for (const buf of buffers) {
|
for (const buf of new SafeArrayIterator(buffers)) {
|
||||||
TypedArrayPrototypeSet(contents, buf, n);
|
TypedArrayPrototypeSet(contents, buf, n);
|
||||||
n += buf.byteLength;
|
n += buf.byteLength;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
DatePrototype,
|
DatePrototype,
|
||||||
MathTrunc,
|
MathTrunc,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
|
SafeArrayIterator,
|
||||||
SymbolAsyncIterator,
|
SymbolAsyncIterator,
|
||||||
SymbolIterator,
|
SymbolIterator,
|
||||||
Function,
|
Function,
|
||||||
|
@ -211,7 +212,7 @@
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
let str =
|
let str =
|
||||||
'const unix = Deno.build.os === "darwin" || Deno.build.os === "linux"; return {';
|
'const unix = Deno.build.os === "darwin" || Deno.build.os === "linux"; return {';
|
||||||
for (let [name, type] of ObjectEntries(types)) {
|
for (let [name, type] of new SafeArrayIterator(ObjectEntries(types))) {
|
||||||
const optional = type.startsWith("?");
|
const optional = type.startsWith("?");
|
||||||
if (optional) type = type.slice(1);
|
if (optional) type = type.slice(1);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
ArrayPrototypeSlice,
|
ArrayPrototypeSlice,
|
||||||
TypeError,
|
TypeError,
|
||||||
ObjectEntries,
|
ObjectEntries,
|
||||||
|
SafeArrayIterator,
|
||||||
String,
|
String,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
|
@ -111,7 +112,10 @@
|
||||||
stdin = "inherit",
|
stdin = "inherit",
|
||||||
}) {
|
}) {
|
||||||
if (cmd[0] != null) {
|
if (cmd[0] != null) {
|
||||||
cmd = [pathFromURL(cmd[0]), ...ArrayPrototypeSlice(cmd, 1)];
|
cmd = [
|
||||||
|
pathFromURL(cmd[0]),
|
||||||
|
...new SafeArrayIterator(ArrayPrototypeSlice(cmd, 1)),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
const res = opRun({
|
const res = opRun({
|
||||||
cmd: ArrayPrototypeMap(cmd, String),
|
cmd: ArrayPrototypeMap(cmd, String),
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const ops = core.ops;
|
const ops = core.ops;
|
||||||
const {
|
const {
|
||||||
|
SafeSetIterator,
|
||||||
Set,
|
Set,
|
||||||
|
SetPrototypeDelete,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
TypeError,
|
TypeError,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
@ -60,7 +62,7 @@
|
||||||
checkSignalListenerType(listener);
|
checkSignalListenerType(listener);
|
||||||
|
|
||||||
const sigData = getSignalData(signo);
|
const sigData = getSignalData(signo);
|
||||||
sigData.listeners.delete(listener);
|
SetPrototypeDelete(sigData.listeners, listener);
|
||||||
|
|
||||||
if (sigData.listeners.size === 0 && sigData.rid) {
|
if (sigData.listeners.size === 0 && sigData.rid) {
|
||||||
unbindSignal(sigData.rid);
|
unbindSignal(sigData.rid);
|
||||||
|
@ -73,7 +75,7 @@
|
||||||
if (await pollSignal(sigData.rid)) {
|
if (await pollSignal(sigData.rid)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const listener of sigData.listeners) {
|
for (const listener of new SafeSetIterator(sigData.listeners)) {
|
||||||
listener();
|
listener();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
const {
|
const {
|
||||||
ArrayPrototypeMap,
|
ArrayPrototypeMap,
|
||||||
ObjectEntries,
|
ObjectEntries,
|
||||||
|
ObjectPrototypeIsPrototypeOf,
|
||||||
String,
|
String,
|
||||||
TypeError,
|
TypeError,
|
||||||
PromisePrototypeThen,
|
PromisePrototypeThen,
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
readableStreamForRidUnrefable,
|
readableStreamForRidUnrefable,
|
||||||
readableStreamForRidUnrefableRef,
|
readableStreamForRidUnrefableRef,
|
||||||
readableStreamForRidUnrefableUnref,
|
readableStreamForRidUnrefableUnref,
|
||||||
|
ReadableStreamPrototype,
|
||||||
writableStreamForRid,
|
writableStreamForRid,
|
||||||
} = window.__bootstrap.streams;
|
} = window.__bootstrap.streams;
|
||||||
|
|
||||||
|
@ -65,7 +67,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function collectOutput(readableStream) {
|
function collectOutput(readableStream) {
|
||||||
if (!(readableStream instanceof ReadableStream)) {
|
if (
|
||||||
|
!(ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, readableStream))
|
||||||
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ delete Intl.v8BreakIterator;
|
||||||
ArrayPrototypeMap,
|
ArrayPrototypeMap,
|
||||||
DateNow,
|
DateNow,
|
||||||
Error,
|
Error,
|
||||||
|
ErrorPrototype,
|
||||||
FunctionPrototypeCall,
|
FunctionPrototypeCall,
|
||||||
FunctionPrototypeBind,
|
FunctionPrototypeBind,
|
||||||
ObjectAssign,
|
ObjectAssign,
|
||||||
|
@ -32,6 +33,7 @@ delete Intl.v8BreakIterator;
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
SymbolIterator,
|
SymbolIterator,
|
||||||
PromisePrototypeThen,
|
PromisePrototypeThen,
|
||||||
|
SafeArrayIterator,
|
||||||
SafeWeakMap,
|
SafeWeakMap,
|
||||||
TypeError,
|
TypeError,
|
||||||
WeakMapPrototypeDelete,
|
WeakMapPrototypeDelete,
|
||||||
|
@ -204,7 +206,7 @@ delete Intl.v8BreakIterator;
|
||||||
);
|
);
|
||||||
loadedMainWorkerScript = true;
|
loadedMainWorkerScript = true;
|
||||||
|
|
||||||
for (const { url, script } of scripts) {
|
for (const { url, script } of new SafeArrayIterator(scripts)) {
|
||||||
const err = core.evalContext(script, url)[1];
|
const err = core.evalContext(script, url)[1];
|
||||||
if (err !== null) {
|
if (err !== null) {
|
||||||
throw err.thrown;
|
throw err.thrown;
|
||||||
|
@ -217,7 +219,7 @@ delete Intl.v8BreakIterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatException(error) {
|
function formatException(error) {
|
||||||
if (error instanceof Error) {
|
if (ObjectPrototypeIsPrototypeOf(ErrorPrototype, error)) {
|
||||||
return null;
|
return null;
|
||||||
} else if (typeof error == "string") {
|
} else if (typeof error == "string") {
|
||||||
return `Uncaught ${
|
return `Uncaught ${
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 17fd391b8f305d1e74ce7508c824176f09ab63d0
|
Subproject commit 3e5b0cea163cc0f2b3b0c7cedffc112cc49d6a78
|
Loading…
Reference in a new issue