From dbde48ead7ff8067b0ab79b0808749a3b6b46f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 4 Jul 2021 19:04:28 +0200 Subject: [PATCH 1/9] refactor: use primordials in extensions/web --- extensions/web/02_structured_clone.js | 17 +++++++-- extensions/web/03_abort_signal.js | 23 +++++++++--- extensions/web/04_global_interfaces.js | 15 ++++++-- extensions/web/05_base64.js | 19 +++++++--- extensions/web/08_text_encoding.js | 43 ++++++++++++++-------- extensions/web/12_location.js | 50 ++++++++++++++++---------- 6 files changed, 118 insertions(+), 49 deletions(-) diff --git a/extensions/web/02_structured_clone.js b/extensions/web/02_structured_clone.js index 265d89247d8923..4845c6508dd303 100644 --- a/extensions/web/02_structured_clone.js +++ b/extensions/web/02_structured_clone.js @@ -2,6 +2,7 @@ // @ts-check /// +/// /// /// @@ -10,6 +11,15 @@ ((window) => { const core = window.Deno.core; const { DOMException } = window.__bootstrap.domException; + const { + ArrayBuffer, + ArrayBufferIsView, + DataView, + TypedArrayPrototypeSlice, + TypeError, + WeakMap, + WeakMapPrototypeSet, + } = window.__bootstrap.primordials; const objectCloneMemo = new WeakMap(); @@ -20,7 +30,8 @@ _cloneConstructor, ) { // this function fudges the return type but SharedArrayBuffer is disabled for a while anyway - return srcBuffer.slice( + return TypedArrayPrototypeSlice( + srcBuffer, srcByteOffset, srcByteOffset + srcLength, ); @@ -38,10 +49,10 @@ value.byteLength, ArrayBuffer, ); - objectCloneMemo.set(value, cloned); + WeakMapPrototypeSet(objectCloneMemo, value, cloned); return cloned; } - if (ArrayBuffer.isView(value)) { + if (ArrayBufferIsView(value)) { const clonedBuffer = structuredClone(value.buffer); // Use DataViewConstructor type purely for type-checking, can be a // DataView or TypedArray. They use the same constructor signature, diff --git a/extensions/web/03_abort_signal.js b/extensions/web/03_abort_signal.js index 54a485dab1fb83..d67bfef26835c5 100644 --- a/extensions/web/03_abort_signal.js +++ b/extensions/web/03_abort_signal.js @@ -1,9 +1,22 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. "use strict"; +// @ts-check +/// + ((window) => { const webidl = window.__bootstrap.webidl; const { setIsTrusted, defineEventHandler } = window.__bootstrap.event; + const { + Boolean, + Set, + SetPrototypeAdd, + SetPrototypeClear, + SetPrototypeDelete, + Symbol, + SymbolToStringTag, + TypeError, + } = window.__bootstrap.primordials; const add = Symbol("add"); const signalAbort = Symbol("signalAbort"); @@ -22,7 +35,7 @@ } [add](algorithm) { - this.#abortAlgorithms.add(algorithm); + SetPrototypeAdd(this.#abortAlgorithms, algorithm); } [signalAbort]() { @@ -33,14 +46,14 @@ for (const algorithm of this.#abortAlgorithms) { algorithm(); } - this.#abortAlgorithms.clear(); + SetPrototypeClear(this.#abortAlgorithms); const event = new Event("abort"); setIsTrusted(event, true); this.dispatchEvent(event); } [remove](algorithm) { - this.#abortAlgorithms.delete(algorithm); + SetPrototypeDelete(this.#abortAlgorithms, algorithm); } constructor(key = null) { @@ -55,7 +68,7 @@ return Boolean(this.#aborted); } - get [Symbol.toStringTag]() { + get [SymbolToStringTag]() { return "AbortSignal"; } } @@ -74,7 +87,7 @@ this.#signal[signalAbort](); } - get [Symbol.toStringTag]() { + get [SymbolToStringTag]() { return "AbortController"; } } diff --git a/extensions/web/04_global_interfaces.js b/extensions/web/04_global_interfaces.js index c3181fb666601a..8117bface27285 100644 --- a/extensions/web/04_global_interfaces.js +++ b/extensions/web/04_global_interfaces.js @@ -1,7 +1,16 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. "use strict"; + +// @ts-check +/// + ((window) => { const { EventTarget } = window; + const { + Symbol, + SymbolToStringTag, + TypeError, + } = window.__bootstrap.primordials; const illegalConstructorKey = Symbol("illegalConstructorKey"); @@ -13,7 +22,7 @@ super(); } - get [Symbol.toStringTag]() { + get [SymbolToStringTag]() { return "Window"; } } @@ -26,7 +35,7 @@ super(); } - get [Symbol.toStringTag]() { + get [SymbolToStringTag]() { return "WorkerGlobalScope"; } } @@ -39,7 +48,7 @@ super(); } - get [Symbol.toStringTag]() { + get [SymbolToStringTag]() { return "DedicatedWorkerGlobalScope"; } } diff --git a/extensions/web/05_base64.js b/extensions/web/05_base64.js index f0490f240b9164..6f13722668f877 100644 --- a/extensions/web/05_base64.js +++ b/extensions/web/05_base64.js @@ -1,6 +1,7 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // @ts-check +/// /// /// /// @@ -14,6 +15,13 @@ forgivingBase64Decode, } = window.__bootstrap.infra; const { DOMException } = window.__bootstrap.domException; + const { + ArrayPrototypeMap, + StringPrototypeCharCodeAt, + ArrayPrototypeJoin, + StringFromCharCode, + Uint8Array, + } = window.__bootstrap.primordials; /** * @param {string} data @@ -26,10 +34,11 @@ }); const uint8Array = forgivingBase64Decode(data); - const result = [...uint8Array] - .map((byte) => String.fromCharCode(byte)) - .join(""); - return result; + const result = ArrayPrototypeMap( + [...uint8Array], + (byte) => StringFromCharCode(byte), + ); + return ArrayPrototypeJoin(result, ""); } /** @@ -44,7 +53,7 @@ context: "Argument 1", }); const byteArray = [...data].map((char) => { - const charCode = char.charCodeAt(0); + const charCode = StringPrototypeCharCodeAt(char, 0); if (charCode > 0xff) { throw new DOMException( "The string to be encoded contains characters outside of the Latin1 range.", diff --git a/extensions/web/08_text_encoding.js b/extensions/web/08_text_encoding.js index 0ba1bb582e7618..89723de6d8d268 100644 --- a/extensions/web/08_text_encoding.js +++ b/extensions/web/08_text_encoding.js @@ -2,6 +2,7 @@ // @ts-check /// +/// /// /// /// @@ -13,6 +14,15 @@ ((window) => { const core = Deno.core; const webidl = window.__bootstrap.webidl; + const { + ArrayBufferIsView, + PromiseReject, + PromiseResolve, + StringPrototypeCharCodeAt, + SymbolToStringTag, + TypedArrayPrototypeSubarray, + Uint8Array, + } = window.__bootstrap.primordials; class TextDecoder { /** @type {string} */ @@ -95,7 +105,7 @@ } try { - if (ArrayBuffer.isView(input)) { + if (ArrayBufferIsView(input)) { input = new Uint8Array( input.buffer, input.byteOffset, @@ -116,7 +126,7 @@ } } - get [Symbol.toStringTag]() { + get [SymbolToStringTag]() { return "TextDecoder"; } } @@ -168,7 +178,7 @@ return core.opSync("op_encoding_encode_into", source, destination); } - get [Symbol.toStringTag]() { + get [SymbolToStringTag]() { return "TextEncoder"; } } @@ -209,9 +219,9 @@ if (decoded) { controller.enqueue(decoded); } - return Promise.resolve(); + return PromiseResolve(); } catch (err) { - return Promise.reject(err); + return PromiseReject(err); } }, flush: (controller) => { @@ -220,9 +230,9 @@ if (final) { controller.enqueue(final); } - return Promise.resolve(); + return PromiseResolve(); } catch (err) { - return Promise.reject(err); + return PromiseReject(err); } }, }); @@ -259,7 +269,7 @@ return this.#transform.writable; } - get [Symbol.toStringTag]() { + get [SymbolToStringTag]() { return "TextDecoderStream"; } } @@ -282,7 +292,10 @@ if (this.#pendingHighSurrogate !== null) { chunk = this.#pendingHighSurrogate + chunk; } - const lastCodeUnit = chunk.charCodeAt(chunk.length - 1); + const lastCodeUnit = StringPrototypeCharCodeAt( + chunk.charCodeAt, + chunk.length - 1, + ); if (0xD800 <= lastCodeUnit && lastCodeUnit <= 0xDBFF) { this.#pendingHighSurrogate = chunk.slice(-1); chunk = chunk.slice(0, -1); @@ -292,9 +305,9 @@ if (chunk) { controller.enqueue(core.encode(chunk)); } - return Promise.resolve(); + return PromiseResolve(); } catch (err) { - return Promise.reject(err); + return PromiseReject(err); } }, flush: (controller) => { @@ -302,9 +315,9 @@ if (this.#pendingHighSurrogate !== null) { controller.enqueue(new Uint8Array([0xEF, 0xBF, 0xBD])); } - return Promise.resolve(); + return PromiseResolve(); } catch (err) { - return Promise.reject(err); + return PromiseReject(err); } }, }); @@ -329,7 +342,7 @@ return this.#transform.writable; } - get [Symbol.toStringTag]() { + get [SymbolToStringTag]() { return "TextEncoderStream"; } } @@ -380,7 +393,7 @@ * @param {Uint8Array} bytes */ function BOMSniff(bytes) { - const BOM = bytes.subarray(0, 3); + const BOM = TypedArrayPrototypeSubarray(bytes, 0, 3); if (BOM[0] === 0xEF && BOM[1] === 0xBB && BOM[2] === 0xBF) { return "UTF-8"; } diff --git a/extensions/web/12_location.js b/extensions/web/12_location.js index dd56fb47b7cd8a..40dd545fe16db6 100644 --- a/extensions/web/12_location.js +++ b/extensions/web/12_location.js @@ -1,9 +1,23 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. "use strict"; +/// + ((window) => { const { URL } = window.__bootstrap.url; const { DOMException } = window.__bootstrap.domException; + const { + Error, + ObjectDefineProperties, + ReferenceError, + Symbol, + SymbolFor, + SymbolToStringTag, + TypeError, + WeakMap, + WeakMapPrototypeGet, + WeakMapPrototypeSet, + } = window.__bootstrap.primordials; const locationConstructorKey = Symbol("locationConstuctorKey"); @@ -20,7 +34,7 @@ const url = new URL(href); url.username = ""; url.password = ""; - Object.defineProperties(this, { + ObjectDefineProperties(this, { hash: { get() { return url.hash; @@ -167,7 +181,7 @@ }, enumerable: true, }, - [Symbol.for("Deno.privateCustomInspect")]: { + [SymbolFor("Deno.privateCustomInspect")]: { value: function (inspect) { const object = { hash: this.hash, @@ -187,8 +201,8 @@ } } - Object.defineProperties(Location.prototype, { - [Symbol.toStringTag]: { + ObjectDefineProperties(Location.prototype, { + [SymbolToStringTag]: { value: "Location", configurable: true, }, @@ -204,14 +218,14 @@ const url = new URL(href); url.username = ""; url.password = ""; - workerLocationUrls.set(this, url); + WeakMapPrototypeSet(workerLocationUrls, this, url); } } - Object.defineProperties(WorkerLocation.prototype, { + ObjectDefineProperties(WorkerLocation.prototype, { hash: { get() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -222,7 +236,7 @@ }, host: { get() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -233,7 +247,7 @@ }, hostname: { get() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -244,7 +258,7 @@ }, href: { get() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -255,7 +269,7 @@ }, origin: { get() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -266,7 +280,7 @@ }, pathname: { get() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -277,7 +291,7 @@ }, port: { get() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -288,7 +302,7 @@ }, protocol: { get() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -299,7 +313,7 @@ }, search: { get() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -310,7 +324,7 @@ }, toString: { value: function toString() { - const url = workerLocationUrls.get(this); + const url = WeakMapPrototypeGet(workerLocationUrls, this); if (url == null) { throw new TypeError("Illegal invocation."); } @@ -320,11 +334,11 @@ enumerable: true, writable: true, }, - [Symbol.toStringTag]: { + [SymbolToStringTag]: { value: "WorkerLocation", configurable: true, }, - [Symbol.for("Deno.privateCustomInspect")]: { + [SymbolFor("Deno.privateCustomInspect")]: { value: function (inspect) { const object = { hash: this.hash, From a7ec3f2cbbb162cdafacbad2236aad0df6e33aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 4 Jul 2021 19:12:58 +0200 Subject: [PATCH 2/9] Update extensions/web/08_text_encoding.js Co-authored-by: Divy Srivastava --- extensions/web/08_text_encoding.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/web/08_text_encoding.js b/extensions/web/08_text_encoding.js index 89723de6d8d268..284a6b6e570fb9 100644 --- a/extensions/web/08_text_encoding.js +++ b/extensions/web/08_text_encoding.js @@ -293,7 +293,7 @@ chunk = this.#pendingHighSurrogate + chunk; } const lastCodeUnit = StringPrototypeCharCodeAt( - chunk.charCodeAt, + chunk, chunk.length - 1, ); if (0xD800 <= lastCodeUnit && lastCodeUnit <= 0xDBFF) { From f78dffcb8e0f511e803130fb7c0d407fe98e482a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 4 Jul 2021 20:08:31 +0200 Subject: [PATCH 3/9] Update extensions/web/08_text_encoding.js Co-authored-by: Divy Srivastava --- extensions/web/08_text_encoding.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/web/08_text_encoding.js b/extensions/web/08_text_encoding.js index 284a6b6e570fb9..d38e9ba9c2e73f 100644 --- a/extensions/web/08_text_encoding.js +++ b/extensions/web/08_text_encoding.js @@ -297,8 +297,8 @@ chunk.length - 1, ); if (0xD800 <= lastCodeUnit && lastCodeUnit <= 0xDBFF) { - this.#pendingHighSurrogate = chunk.slice(-1); - chunk = chunk.slice(0, -1); + this.#pendingHighSurrogate = StringPrototypeSlice(chunk, -1); + chunk = StringPrototypeSlice(chunk, 0, -1); } else { this.#pendingHighSurrogate = null; } From 2c01923f4675ca6802e88ad0215f9e8a4109d4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 4 Jul 2021 20:32:04 +0200 Subject: [PATCH 4/9] fix --- extensions/web/05_base64.js | 2 +- extensions/web/08_text_encoding.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/web/05_base64.js b/extensions/web/05_base64.js index 6f13722668f877..9d3f0be39bd295 100644 --- a/extensions/web/05_base64.js +++ b/extensions/web/05_base64.js @@ -52,7 +52,7 @@ prefix, context: "Argument 1", }); - const byteArray = [...data].map((char) => { + const byteArray = ArrayPrototypeMap([...data], (char) => { const charCode = StringPrototypeCharCodeAt(char, 0); if (charCode > 0xff) { throw new DOMException( diff --git a/extensions/web/08_text_encoding.js b/extensions/web/08_text_encoding.js index d38e9ba9c2e73f..7d4b8214a477ed 100644 --- a/extensions/web/08_text_encoding.js +++ b/extensions/web/08_text_encoding.js @@ -19,6 +19,7 @@ PromiseReject, PromiseResolve, StringPrototypeCharCodeAt, + StringPrototypeSlice, SymbolToStringTag, TypedArrayPrototypeSubarray, Uint8Array, From 7a4ffd7031028309e6b15bb55f80dfc44c69dc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 4 Jul 2021 20:51:15 +0200 Subject: [PATCH 5/9] fix --- extensions/web/08_text_encoding.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/web/08_text_encoding.js b/extensions/web/08_text_encoding.js index 7d4b8214a477ed..923791d37ce336 100644 --- a/extensions/web/08_text_encoding.js +++ b/extensions/web/08_text_encoding.js @@ -22,6 +22,7 @@ StringPrototypeSlice, SymbolToStringTag, TypedArrayPrototypeSubarray, + TypedArrayPrototypeSlice, Uint8Array, } = window.__bootstrap.primordials; @@ -387,7 +388,9 @@ if (BOMEncoding === "UTF-8") start = 3; else start = 2; } - return new TextDecoder(encoding).decode(bytes.slice(start)); + return new TextDecoder(encoding).decode( + TypedArrayPrototypeSlice(bytes, start), + ); } /** From 5fd25e4ce74258b24e1b0018b8eef241d2077de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 5 Jul 2021 18:27:43 +0200 Subject: [PATCH 6/9] fix --- core/internal.d.ts | 1 + extensions/web/05_base64.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/internal.d.ts b/core/internal.d.ts index 8e52f4bf1eccee..90edd62888c15c 100644 --- a/core/internal.d.ts +++ b/core/internal.d.ts @@ -918,6 +918,7 @@ declare namespace __bootstrap { export const Uint8Array: typeof globalThis.Uint8Array; export const Uint8ArrayLength: typeof Uint8Array.length; export const Uint8ArrayName: typeof Uint8Array.name; + export const Uint8ArrayFrom: typeof Uint8Array.from; export const Uint8ArrayPrototype: typeof Uint8Array.prototype; export const Uint8ArrayBYTES_PER_ELEMENT: typeof Uint8Array.BYTES_PER_ELEMENT; diff --git a/extensions/web/05_base64.js b/extensions/web/05_base64.js index 9d3f0be39bd295..04e2f11fa27f0c 100644 --- a/extensions/web/05_base64.js +++ b/extensions/web/05_base64.js @@ -21,6 +21,7 @@ ArrayPrototypeJoin, StringFromCharCode, Uint8Array, + Uint8ArrayFrom, } = window.__bootstrap.primordials; /** @@ -62,7 +63,7 @@ } return charCode; }); - return forgivingBase64Encode(Uint8Array.from(byteArray)); + return forgivingBase64Encode(Uint8ArrayFrom(byteArray)); } window.__bootstrap.base64 = { From 8bab7d42e2f5ec657b18f37621ae83b65ab0741c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 5 Jul 2021 18:30:19 +0200 Subject: [PATCH 7/9] remove unused --- extensions/web/05_base64.js | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/web/05_base64.js b/extensions/web/05_base64.js index 04e2f11fa27f0c..ba11cd9872339f 100644 --- a/extensions/web/05_base64.js +++ b/extensions/web/05_base64.js @@ -20,7 +20,6 @@ StringPrototypeCharCodeAt, ArrayPrototypeJoin, StringFromCharCode, - Uint8Array, Uint8ArrayFrom, } = window.__bootstrap.primordials; From a37827f52f708b43cbd65b25521bdade196c0907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 6 Jul 2021 12:18:42 +0200 Subject: [PATCH 8/9] try TypedArrayFrom --- core/internal.d.ts | 1 - extensions/web/05_base64.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/internal.d.ts b/core/internal.d.ts index 90edd62888c15c..8e52f4bf1eccee 100644 --- a/core/internal.d.ts +++ b/core/internal.d.ts @@ -918,7 +918,6 @@ declare namespace __bootstrap { export const Uint8Array: typeof globalThis.Uint8Array; export const Uint8ArrayLength: typeof Uint8Array.length; export const Uint8ArrayName: typeof Uint8Array.name; - export const Uint8ArrayFrom: typeof Uint8Array.from; export const Uint8ArrayPrototype: typeof Uint8Array.prototype; export const Uint8ArrayBYTES_PER_ELEMENT: typeof Uint8Array.BYTES_PER_ELEMENT; diff --git a/extensions/web/05_base64.js b/extensions/web/05_base64.js index ba11cd9872339f..ee9caeef2f3a05 100644 --- a/extensions/web/05_base64.js +++ b/extensions/web/05_base64.js @@ -20,7 +20,7 @@ StringPrototypeCharCodeAt, ArrayPrototypeJoin, StringFromCharCode, - Uint8ArrayFrom, + TypedArrayFrom, } = window.__bootstrap.primordials; /** @@ -62,7 +62,7 @@ } return charCode; }); - return forgivingBase64Encode(Uint8ArrayFrom(byteArray)); + return forgivingBase64Encode(TypedArrayFrom(byteArray)); } window.__bootstrap.base64 = { From 60c60831c167038ac6eefa87fd76db146c6253d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 6 Jul 2021 13:50:52 +0200 Subject: [PATCH 9/9] fix again --- core/internal.d.ts | 4 ++++ extensions/web/05_base64.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/internal.d.ts b/core/internal.d.ts index 8e52f4bf1eccee..21f01cbcd8c8d9 100644 --- a/core/internal.d.ts +++ b/core/internal.d.ts @@ -833,6 +833,10 @@ declare namespace __bootstrap { export const TypeErrorLength: typeof TypeError.length; export const TypeErrorName: typeof TypeError.name; export const TypeErrorPrototype: typeof TypeError.prototype; + export const TypedArrayFrom: ( + constructor: Uint8ArrayConstructor, + arrayLike: ArrayLike, + ) => Uint8Array; export const TypedArrayPrototypeCopyWithin: UncurryThis< typeof Uint8Array.prototype.copyWithin >; diff --git a/extensions/web/05_base64.js b/extensions/web/05_base64.js index ee9caeef2f3a05..818815ecdea182 100644 --- a/extensions/web/05_base64.js +++ b/extensions/web/05_base64.js @@ -62,7 +62,7 @@ } return charCode; }); - return forgivingBase64Encode(TypedArrayFrom(byteArray)); + return forgivingBase64Encode(TypedArrayFrom(Uint8Array, byteArray)); } window.__bootstrap.base64 = {