mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
refactor: introduce primordials for ext/web (#11228)
This commit is contained in:
parent
425b9a8228
commit
bf39b883d6
23 changed files with 145 additions and 48 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -772,6 +772,9 @@ version = "0.8.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deno_bench_util",
|
"deno_bench_util",
|
||||||
"deno_core",
|
"deno_core",
|
||||||
|
"deno_url",
|
||||||
|
"deno_web",
|
||||||
|
"deno_webidl",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const { setTarget } = window.__bootstrap.event;
|
const { setTarget } = window.__bootstrap.event;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
const {
|
const {
|
||||||
ArrayPrototypeIndexOf,
|
ArrayPrototypeIndexOf,
|
||||||
ArrayPrototypeSplice,
|
ArrayPrototypeSplice,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
((window) => {
|
((window) => {
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
const supportedAlgorithms = {
|
const supportedAlgorithms = {
|
||||||
"digest": {
|
"digest": {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
abortedNetworkError,
|
abortedNetworkError,
|
||||||
} = window.__bootstrap.fetch;
|
} = window.__bootstrap.fetch;
|
||||||
const abortSignal = window.__bootstrap.abortSignal;
|
const abortSignal = window.__bootstrap.abortSignal;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
const REQUEST_BODY_HEADER_NAMES = [
|
const REQUEST_BODY_HEADER_NAMES = [
|
||||||
"content-encoding",
|
"content-encoding",
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
((window) => {
|
((window) => {
|
||||||
const { webidl, structuredClone } = window.__bootstrap;
|
const { webidl, structuredClone } = window.__bootstrap;
|
||||||
const { opNow } = window.__bootstrap.timers;
|
const { opNow } = window.__bootstrap.timers;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
const illegalConstructorKey = Symbol("illegalConstructorKey");
|
const illegalConstructorKey = Symbol("illegalConstructorKey");
|
||||||
const customInspect = Symbol.for("Deno.customInspect");
|
const customInspect = Symbol.for("Deno.customInspect");
|
||||||
let performanceEntries = [];
|
let performanceEntries = [];
|
||||||
|
|
|
@ -19,6 +19,9 @@ tokio = { version = "1.7.1", features = ["full"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
deno_bench_util = { version = "0.4.0", path = "../../bench_util" }
|
deno_bench_util = { version = "0.4.0", path = "../../bench_util" }
|
||||||
|
deno_url = { version = "0.10.1", path = "../url" }
|
||||||
|
deno_web = { version = "0.41.1", path = "../web" }
|
||||||
|
deno_webidl = { version = "0.10.1", path = "../webidl" }
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "timers_ops"
|
name = "timers_ops"
|
||||||
|
|
|
@ -3,9 +3,13 @@ use deno_core::Extension;
|
||||||
use deno_bench_util::bench_or_profile;
|
use deno_bench_util::bench_or_profile;
|
||||||
use deno_bench_util::bencher::{benchmark_group, Bencher};
|
use deno_bench_util::bencher::{benchmark_group, Bencher};
|
||||||
use deno_bench_util::{bench_js_async, bench_js_sync};
|
use deno_bench_util::{bench_js_async, bench_js_sync};
|
||||||
|
use deno_web::BlobUrlStore;
|
||||||
|
|
||||||
fn setup() -> Vec<Extension> {
|
fn setup() -> Vec<Extension> {
|
||||||
vec![
|
vec![
|
||||||
|
deno_webidl::init(),
|
||||||
|
deno_url::init(),
|
||||||
|
deno_web::init(BlobUrlStore::default(), None),
|
||||||
deno_timers::init::<deno_timers::NoTimersPermission>(),
|
deno_timers::init::<deno_timers::NoTimersPermission>(),
|
||||||
Extension::builder()
|
Extension::builder()
|
||||||
.js(vec![
|
.js(vec![
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
/// <reference path="../../core/internal.d.ts" />
|
||||||
/// <reference path="../../core/lib.deno_core.d.ts" />
|
/// <reference path="../../core/lib.deno_core.d.ts" />
|
||||||
/// <reference path="../web/internal.d.ts" />
|
/// <reference path="../web/internal.d.ts" />
|
||||||
/// <reference path="../web/lib.deno_web.d.ts" />
|
/// <reference path="../web/lib.deno_web.d.ts" />
|
||||||
|
@ -9,6 +10,22 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const core = Deno.core;
|
const core = Deno.core;
|
||||||
|
const {
|
||||||
|
RegExp,
|
||||||
|
ArrayPrototypeMap,
|
||||||
|
StringPrototypeCharCodeAt,
|
||||||
|
NumberPrototypeToString,
|
||||||
|
StringPrototypePadStart,
|
||||||
|
TypeError,
|
||||||
|
ArrayPrototypeJoin,
|
||||||
|
StringPrototypeCharAt,
|
||||||
|
StringPrototypeSlice,
|
||||||
|
String,
|
||||||
|
StringPrototypeReplace,
|
||||||
|
StringPrototypeToUpperCase,
|
||||||
|
StringPrototypeToLowerCase,
|
||||||
|
StringPrototypeSubstring,
|
||||||
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
const ASCII_DIGIT = ["\u0030-\u0039"];
|
const ASCII_DIGIT = ["\u0030-\u0039"];
|
||||||
const ASCII_UPPER_ALPHA = ["\u0041-\u005A"];
|
const ASCII_UPPER_ALPHA = ["\u0041-\u005A"];
|
||||||
|
@ -73,18 +90,31 @@
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function regexMatcher(chars) {
|
function regexMatcher(chars) {
|
||||||
const matchers = chars.map((char) => {
|
const matchers = ArrayPrototypeMap(chars, (char) => {
|
||||||
if (char.length === 1) {
|
if (char.length === 1) {
|
||||||
return `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`;
|
const a = StringPrototypePadStart(
|
||||||
|
NumberPrototypeToString(StringPrototypeCharCodeAt(char, 0), 16),
|
||||||
|
4,
|
||||||
|
"0",
|
||||||
|
);
|
||||||
|
return `\\u${a}`;
|
||||||
} else if (char.length === 3 && char[1] === "-") {
|
} else if (char.length === 3 && char[1] === "-") {
|
||||||
return `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}-\\u${
|
const a = StringPrototypePadStart(
|
||||||
char.charCodeAt(2).toString(16).padStart(4, "0")
|
NumberPrototypeToString(StringPrototypeCharCodeAt(char, 0), 16),
|
||||||
}`;
|
4,
|
||||||
|
"0",
|
||||||
|
);
|
||||||
|
const b = StringPrototypePadStart(
|
||||||
|
NumberPrototypeToString(StringPrototypeCharCodeAt(char, 2), 16),
|
||||||
|
4,
|
||||||
|
"0",
|
||||||
|
);
|
||||||
|
return `\\u${a}-\\u${b}`;
|
||||||
} else {
|
} else {
|
||||||
throw TypeError("unreachable");
|
throw TypeError("unreachable");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return matchers.join("");
|
return ArrayPrototypeJoin(matchers, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,11 +127,11 @@
|
||||||
function collectSequenceOfCodepoints(input, position, condition) {
|
function collectSequenceOfCodepoints(input, position, condition) {
|
||||||
const start = position;
|
const start = position;
|
||||||
for (
|
for (
|
||||||
let c = input.charAt(position);
|
let c = StringPrototypeCharAt(input, position);
|
||||||
position < input.length && condition(c);
|
position < input.length && condition(c);
|
||||||
c = input.charAt(++position)
|
c = StringPrototypeCharAt(input, ++position)
|
||||||
);
|
);
|
||||||
return { result: input.slice(start, position), position };
|
return { result: StringPrototypeSlice(input, start, position), position };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,9 +139,13 @@
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function byteUpperCase(s) {
|
function byteUpperCase(s) {
|
||||||
return String(s).replace(/[a-z]/g, function byteUpperCaseReplace(c) {
|
return StringPrototypeReplace(
|
||||||
return c.toUpperCase();
|
String(s),
|
||||||
});
|
/[a-z]/g,
|
||||||
|
function byteUpperCaseReplace(c) {
|
||||||
|
return StringPrototypeToUpperCase(c);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,9 +153,13 @@
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function byteLowerCase(s) {
|
function byteLowerCase(s) {
|
||||||
return String(s).replace(/[A-Z]/g, function byteUpperCaseReplace(c) {
|
return StringPrototypeReplace(
|
||||||
return c.toLowerCase();
|
String(s),
|
||||||
});
|
/[A-Z]/g,
|
||||||
|
function byteUpperCaseReplace(c) {
|
||||||
|
return StringPrototypeToLowerCase(c);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +175,7 @@
|
||||||
// 2.
|
// 2.
|
||||||
let value = "";
|
let value = "";
|
||||||
// 3.
|
// 3.
|
||||||
if (input[position] !== "\u0022") throw new Error('must be "');
|
if (input[position] !== "\u0022") throw new TypeError('must be "');
|
||||||
// 4.
|
// 4.
|
||||||
position++;
|
position++;
|
||||||
// 5.
|
// 5.
|
||||||
|
@ -169,7 +207,7 @@
|
||||||
position++;
|
position++;
|
||||||
} else { // 5.6.
|
} else { // 5.6.
|
||||||
// 5.6.1
|
// 5.6.1
|
||||||
if (quoteOrBackslash !== "\u0022") throw new Error('must be "');
|
if (quoteOrBackslash !== "\u0022") throw new TypeError('must be "');
|
||||||
// 5.6.2
|
// 5.6.2
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +215,10 @@
|
||||||
// 6.
|
// 6.
|
||||||
if (extractValue) return { result: value, position };
|
if (extractValue) return { result: value, position };
|
||||||
// 7.
|
// 7.
|
||||||
return { result: input.substring(positionStart, position + 1), position };
|
return {
|
||||||
|
result: StringPrototypeSubstring(input, positionStart, position + 1),
|
||||||
|
position,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
/// <reference path="../../core/internal.d.ts" />
|
||||||
/// <reference path="../../core/lib.deno_core.d.ts" />
|
/// <reference path="../../core/lib.deno_core.d.ts" />
|
||||||
/// <reference path="../webidl/internal.d.ts" />
|
/// <reference path="../webidl/internal.d.ts" />
|
||||||
/// <reference path="../web/internal.d.ts" />
|
/// <reference path="../web/internal.d.ts" />
|
||||||
|
@ -9,9 +10,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
|
const { ObjectDefineProperty, ObjectEntries } =
|
||||||
|
window.__bootstrap.primordials;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
|
|
||||||
const { defineProperty } = Object;
|
|
||||||
// Defined in WebIDL 4.3.
|
// Defined in WebIDL 4.3.
|
||||||
// https://heycam.github.io/webidl/#idl-DOMException
|
// https://heycam.github.io/webidl/#idl-DOMException
|
||||||
const INDEX_SIZE_ERR = 1;
|
const INDEX_SIZE_ERR = 1;
|
||||||
|
@ -108,7 +110,7 @@
|
||||||
webidl.configurePrototype(DOMException);
|
webidl.configurePrototype(DOMException);
|
||||||
|
|
||||||
for (
|
for (
|
||||||
const [key, value] of Object.entries({
|
const [key, value] of ObjectEntries({
|
||||||
INDEX_SIZE_ERR,
|
INDEX_SIZE_ERR,
|
||||||
DOMSTRING_SIZE_ERR,
|
DOMSTRING_SIZE_ERR,
|
||||||
HIERARCHY_REQUEST_ERR,
|
HIERARCHY_REQUEST_ERR,
|
||||||
|
@ -137,10 +139,9 @@
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
const desc = { value, enumerable: true };
|
const desc = { value, enumerable: true };
|
||||||
defineProperty(DOMException, key, desc);
|
ObjectDefineProperty(DOMException, key, desc);
|
||||||
defineProperty(DOMException.prototype, key, desc);
|
ObjectDefineProperty(DOMException.prototype, key, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.DOMException = DOMException;
|
window.__bootstrap.domException = { DOMException };
|
||||||
defineProperty(window, "DOMException", { enumerable: false });
|
|
||||||
})(this);
|
})(this);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
/// <reference path="../../core/internal.d.ts" />
|
||||||
/// <reference path="../../core/lib.deno_core.d.ts" />
|
/// <reference path="../../core/lib.deno_core.d.ts" />
|
||||||
/// <reference path="../web/internal.d.ts" />
|
/// <reference path="../web/internal.d.ts" />
|
||||||
/// <reference path="../web/lib.deno_web.d.ts" />
|
/// <reference path="../web/lib.deno_web.d.ts" />
|
||||||
|
@ -8,6 +9,15 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
|
const {
|
||||||
|
ArrayPrototypeIncludes,
|
||||||
|
Map,
|
||||||
|
MapPrototypeHas,
|
||||||
|
MapPrototypeSet,
|
||||||
|
RegExpPrototypeTest,
|
||||||
|
StringPrototypeReplaceAll,
|
||||||
|
StringPrototypeToLowerCase,
|
||||||
|
} = window.__bootstrap.primordials;
|
||||||
const {
|
const {
|
||||||
collectSequenceOfCodepoints,
|
collectSequenceOfCodepoints,
|
||||||
HTTP_WHITESPACE,
|
HTTP_WHITESPACE,
|
||||||
|
@ -31,8 +41,8 @@
|
||||||
*/
|
*/
|
||||||
function parseMimeType(input) {
|
function parseMimeType(input) {
|
||||||
// 1.
|
// 1.
|
||||||
input = input.replaceAll(HTTP_WHITESPACE_PREFIX_RE, "");
|
input = StringPrototypeReplaceAll(input, HTTP_WHITESPACE_PREFIX_RE, "");
|
||||||
input = input.replaceAll(HTTP_WHITESPACE_SUFFIX_RE, "");
|
input = StringPrototypeReplaceAll(input, HTTP_WHITESPACE_SUFFIX_RE, "");
|
||||||
|
|
||||||
// 2.
|
// 2.
|
||||||
let position = 0;
|
let position = 0;
|
||||||
|
@ -48,7 +58,9 @@
|
||||||
position = res1.position;
|
position = res1.position;
|
||||||
|
|
||||||
// 4.
|
// 4.
|
||||||
if (type === "" || !HTTP_TOKEN_CODE_POINT_RE.test(type)) return null;
|
if (type === "" || !RegExpPrototypeTest(HTTP_TOKEN_CODE_POINT_RE, type)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 5.
|
// 5.
|
||||||
if (position >= endOfInput) return null;
|
if (position >= endOfInput) return null;
|
||||||
|
@ -66,15 +78,19 @@
|
||||||
position = res2.position;
|
position = res2.position;
|
||||||
|
|
||||||
// 8.
|
// 8.
|
||||||
subtype = subtype.replaceAll(HTTP_WHITESPACE_SUFFIX_RE, "");
|
subtype = StringPrototypeReplaceAll(subtype, HTTP_WHITESPACE_SUFFIX_RE, "");
|
||||||
|
|
||||||
// 9.
|
// 9.
|
||||||
if (subtype === "" || !HTTP_TOKEN_CODE_POINT_RE.test(subtype)) return null;
|
if (
|
||||||
|
subtype === "" || !RegExpPrototypeTest(HTTP_TOKEN_CODE_POINT_RE, subtype)
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 10.
|
// 10.
|
||||||
const mimeType = {
|
const mimeType = {
|
||||||
type: type.toLowerCase(),
|
type: StringPrototypeToLowerCase(type),
|
||||||
subtype: subtype.toLowerCase(),
|
subtype: StringPrototypeToLowerCase(subtype),
|
||||||
/** @type {Map<string, string>} */
|
/** @type {Map<string, string>} */
|
||||||
parameters: new Map(),
|
parameters: new Map(),
|
||||||
};
|
};
|
||||||
|
@ -88,7 +104,7 @@
|
||||||
const res1 = collectSequenceOfCodepoints(
|
const res1 = collectSequenceOfCodepoints(
|
||||||
input,
|
input,
|
||||||
position,
|
position,
|
||||||
(c) => HTTP_WHITESPACE.includes(c),
|
(c) => ArrayPrototypeIncludes(HTTP_WHITESPACE, c),
|
||||||
);
|
);
|
||||||
position = res1.position;
|
position = res1.position;
|
||||||
|
|
||||||
|
@ -102,7 +118,7 @@
|
||||||
position = res2.position;
|
position = res2.position;
|
||||||
|
|
||||||
// 11.4.
|
// 11.4.
|
||||||
parameterName = parameterName.toLowerCase();
|
parameterName = StringPrototypeToLowerCase(parameterName);
|
||||||
|
|
||||||
// 11.5.
|
// 11.5.
|
||||||
if (position < endOfInput) {
|
if (position < endOfInput) {
|
||||||
|
@ -136,7 +152,8 @@
|
||||||
position = res.position;
|
position = res.position;
|
||||||
|
|
||||||
// 11.9.2.
|
// 11.9.2.
|
||||||
parameterValue = parameterValue.replaceAll(
|
parameterValue = StringPrototypeReplaceAll(
|
||||||
|
parameterValue,
|
||||||
HTTP_WHITESPACE_SUFFIX_RE,
|
HTTP_WHITESPACE_SUFFIX_RE,
|
||||||
"",
|
"",
|
||||||
);
|
);
|
||||||
|
@ -147,11 +164,15 @@
|
||||||
|
|
||||||
// 11.10.
|
// 11.10.
|
||||||
if (
|
if (
|
||||||
parameterName !== "" && HTTP_TOKEN_CODE_POINT_RE.test(parameterName) &&
|
parameterName !== "" &&
|
||||||
HTTP_QUOTED_STRING_TOKEN_POINT_RE.test(parameterValue) &&
|
RegExpPrototypeTest(HTTP_TOKEN_CODE_POINT_RE, parameterName) &&
|
||||||
!mimeType.parameters.has(parameterName)
|
RegExpPrototypeTest(
|
||||||
|
HTTP_QUOTED_STRING_TOKEN_POINT_RE,
|
||||||
|
parameterValue,
|
||||||
|
) &&
|
||||||
|
!MapPrototypeHas(mimeType.parameters, parameterName)
|
||||||
) {
|
) {
|
||||||
mimeType.parameters.set(parameterName, parameterValue);
|
MapPrototypeSet(mimeType.parameters, parameterName, parameterValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,9 +197,9 @@
|
||||||
for (const param of mimeType.parameters) {
|
for (const param of mimeType.parameters) {
|
||||||
serialization += `;${param[0]}=`;
|
serialization += `;${param[0]}=`;
|
||||||
let value = param[1];
|
let value = param[1];
|
||||||
if (!HTTP_TOKEN_CODE_POINT_RE.test(value)) {
|
if (!RegExpPrototypeTest(HTTP_TOKEN_CODE_POINT_RE, value)) {
|
||||||
value = value.replaceAll("\\", "\\\\");
|
value = StringPrototypeReplaceAll(value, "\\", "\\\\");
|
||||||
value = value.replaceAll('"', '\\"');
|
value = StringPrototypeReplaceAll(value, '"', '\\"');
|
||||||
value = `"${value}"`;
|
value = `"${value}"`;
|
||||||
}
|
}
|
||||||
serialization += value;
|
serialization += value;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
// accessors for non runtime visible data
|
// accessors for non runtime visible data
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
const objectCloneMemo = new WeakMap();
|
const objectCloneMemo = new WeakMap();
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
forgivingBase64Encode,
|
forgivingBase64Encode,
|
||||||
forgivingBase64Decode,
|
forgivingBase64Decode,
|
||||||
} = window.__bootstrap.infra;
|
} = window.__bootstrap.infra;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} data
|
* @param {string} data
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
class AssertionError extends Error {
|
class AssertionError extends Error {
|
||||||
constructor(msg) {
|
constructor(msg) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
const { forgivingBase64Encode } = window.__bootstrap.infra;
|
const { forgivingBase64Encode } = window.__bootstrap.infra;
|
||||||
const { decode, TextDecoder } = window.__bootstrap.encoding;
|
const { decode, TextDecoder } = window.__bootstrap.encoding;
|
||||||
const { parseMimeType } = window.__bootstrap.mimesniff;
|
const { parseMimeType } = window.__bootstrap.mimesniff;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
const state = Symbol("[[state]]");
|
const state = Symbol("[[state]]");
|
||||||
const result = Symbol("[[result]]");
|
const result = Symbol("[[result]]");
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const { URL } = window.__bootstrap.url;
|
const { URL } = window.__bootstrap.url;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
const locationConstructorKey = Symbol("locationConstuctorKey");
|
const locationConstructorKey = Symbol("locationConstuctorKey");
|
||||||
|
|
||||||
// The differences between the definitions of `Location` and `WorkerLocation`
|
// The differences between the definitions of `Location` and `WorkerLocation`
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
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;
|
||||||
|
|
||||||
class MessageChannel {
|
class MessageChannel {
|
||||||
/** @type {MessagePort} */
|
/** @type {MessagePort} */
|
||||||
|
|
4
extensions/web/internal.d.ts
vendored
4
extensions/web/internal.d.ts
vendored
|
@ -44,6 +44,10 @@ declare namespace globalThis {
|
||||||
forgivingBase64Decode(data: string): Uint8Array;
|
forgivingBase64Decode(data: string): Uint8Array;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare var domException: {
|
||||||
|
DOMException: typeof DOMException;
|
||||||
|
};
|
||||||
|
|
||||||
declare namespace mimesniff {
|
declare namespace mimesniff {
|
||||||
declare interface MimeType {
|
declare interface MimeType {
|
||||||
type: string;
|
type: string;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const eventTarget = window.__bootstrap.eventTarget;
|
const eventTarget = window.__bootstrap.eventTarget;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {any} self
|
* @param {any} self
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
const { URL } = window.__bootstrap.url;
|
const { URL } = window.__bootstrap.url;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
const { HTTP_TOKEN_CODE_POINT_RE } = window.__bootstrap.infra;
|
const { HTTP_TOKEN_CODE_POINT_RE } = window.__bootstrap.infra;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const core = window.Deno.core;
|
const core = window.Deno.core;
|
||||||
|
const { DOMException } = window.__bootstrap.domException;
|
||||||
const {
|
const {
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
ArrayPrototypePush,
|
ArrayPrototypePush,
|
||||||
TypedArrayPrototypeSubarray,
|
TypedArrayPrototypeSubarray,
|
||||||
TypedArrayPrototypeSet,
|
TypedArrayPrototypeSet,
|
||||||
} = window.__bootstrap.primordials;
|
} = window.__bootstrap.primordials;
|
||||||
|
|
||||||
const DEFAULT_BUFFER_SIZE = 32 * 1024;
|
const DEFAULT_BUFFER_SIZE = 32 * 1024;
|
||||||
// Seek whence values.
|
// Seek whence values.
|
||||||
// https://golang.org/pkg/io/#pkg-constants
|
// https://golang.org/pkg/io/#pkg-constants
|
||||||
|
|
|
@ -41,6 +41,7 @@ delete Object.prototype.__proto__;
|
||||||
const denoNsUnstable = window.__bootstrap.denoNsUnstable;
|
const denoNsUnstable = window.__bootstrap.denoNsUnstable;
|
||||||
const errors = window.__bootstrap.errors.errors;
|
const errors = window.__bootstrap.errors.errors;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
|
const domException = window.__bootstrap.domException;
|
||||||
const { defineEventHandler } = window.__bootstrap.webUtil;
|
const { defineEventHandler } = window.__bootstrap.webUtil;
|
||||||
const { deserializeJsMessageData, serializeJsMessageData } =
|
const { deserializeJsMessageData, serializeJsMessageData } =
|
||||||
window.__bootstrap.messagePort;
|
window.__bootstrap.messagePort;
|
||||||
|
@ -219,25 +220,25 @@ delete Object.prototype.__proto__;
|
||||||
core.registerErrorBuilder(
|
core.registerErrorBuilder(
|
||||||
"DOMExceptionOperationError",
|
"DOMExceptionOperationError",
|
||||||
function DOMExceptionOperationError(msg) {
|
function DOMExceptionOperationError(msg) {
|
||||||
return new DOMException(msg, "OperationError");
|
return new domException.DOMException(msg, "OperationError");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
core.registerErrorBuilder(
|
core.registerErrorBuilder(
|
||||||
"DOMExceptionQuotaExceededError",
|
"DOMExceptionQuotaExceededError",
|
||||||
function DOMExceptionQuotaExceededError(msg) {
|
function DOMExceptionQuotaExceededError(msg) {
|
||||||
return new DOMException(msg, "QuotaExceededError");
|
return new domException.DOMException(msg, "QuotaExceededError");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
core.registerErrorBuilder(
|
core.registerErrorBuilder(
|
||||||
"DOMExceptionNotSupportedError",
|
"DOMExceptionNotSupportedError",
|
||||||
function DOMExceptionNotSupportedError(msg) {
|
function DOMExceptionNotSupportedError(msg) {
|
||||||
return new DOMException(msg, "NotSupported");
|
return new domException.DOMException(msg, "NotSupported");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
core.registerErrorBuilder(
|
core.registerErrorBuilder(
|
||||||
"DOMExceptionInvalidCharacterError",
|
"DOMExceptionInvalidCharacterError",
|
||||||
function DOMExceptionInvalidCharacterError(msg) {
|
function DOMExceptionInvalidCharacterError(msg) {
|
||||||
return new DOMException(msg, "InvalidCharacterError");
|
return new domException.DOMException(msg, "InvalidCharacterError");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -299,7 +300,7 @@ delete Object.prototype.__proto__;
|
||||||
streams.CountQueuingStrategy,
|
streams.CountQueuingStrategy,
|
||||||
),
|
),
|
||||||
CustomEvent: util.nonEnumerable(CustomEvent),
|
CustomEvent: util.nonEnumerable(CustomEvent),
|
||||||
DOMException: util.nonEnumerable(DOMException),
|
DOMException: util.nonEnumerable(domException.DOMException),
|
||||||
ErrorEvent: util.nonEnumerable(ErrorEvent),
|
ErrorEvent: util.nonEnumerable(ErrorEvent),
|
||||||
Event: util.nonEnumerable(Event),
|
Event: util.nonEnumerable(Event),
|
||||||
EventTarget: util.nonEnumerable(EventTarget),
|
EventTarget: util.nonEnumerable(EventTarget),
|
||||||
|
|
|
@ -42,10 +42,12 @@ between the crates, it must be done in specific order:
|
||||||
first
|
first
|
||||||
- `bench_util`
|
- `bench_util`
|
||||||
- crates in `extensions/` directory
|
- crates in `extensions/` directory
|
||||||
- `deno_fetch`, `deno_crypto` and `deno_webstorage` depend on `deno_web`, so
|
- `deno_fetch`, `deno_crypto`, `deno_timers` and `deno_webstorage` depend on
|
||||||
the latter must be bumped and released first
|
`deno_web`, so the latter must be bumped and released first
|
||||||
- `deno_url` depends on `deno_webidl`, so the latter must be bumped and
|
- `deno_url` depends on `deno_webidl`, so the latter must be bumped and
|
||||||
released first
|
released first
|
||||||
|
- `deno_timers` depends on `deno_url`, so the latter must be bumped and
|
||||||
|
released first
|
||||||
- `runtime` - this crate depends on `deno_core` and all crates in `extensions/`
|
- `runtime` - this crate depends on `deno_core` and all crates in `extensions/`
|
||||||
directory
|
directory
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue