summaryrefslogtreecommitdiff
path: root/ext/web
diff options
context:
space:
mode:
Diffstat (limited to 'ext/web')
-rw-r--r--ext/web/01_dom_exception.js2
-rw-r--r--ext/web/02_event.js2
-rw-r--r--ext/web/02_structured_clone.js8
-rw-r--r--ext/web/05_base64.js2
-rw-r--r--ext/web/06_streams.js104
-rw-r--r--ext/web/08_text_encoding.js75
-rw-r--r--ext/web/09_file.js72
-rw-r--r--ext/web/10_filereader.js2
-rw-r--r--ext/web/12_location.js2
-rw-r--r--ext/web/13_message_port.js12
-rw-r--r--ext/web/15_performance.js2
-rw-r--r--ext/web/16_image_data.js2
-rw-r--r--ext/web/internal.d.ts2
13 files changed, 135 insertions, 152 deletions
diff --git a/ext/web/01_dom_exception.js b/ext/web/01_dom_exception.js
index 99e917f0f..14cabc286 100644
--- a/ext/web/01_dom_exception.js
+++ b/ext/web/01_dom_exception.js
@@ -210,4 +210,4 @@ for (let i = 0; i < entries.length; ++i) {
ObjectDefineProperty(DOMException.prototype, key, desc);
}
-export default DOMException;
+export { DOMException, DOMExceptionPrototype };
diff --git a/ext/web/02_event.js b/ext/web/02_event.js
index 80ae81b99..d014b7a73 100644
--- a/ext/web/02_event.js
+++ b/ext/web/02_event.js
@@ -7,7 +7,7 @@
import { core, primordials } from "ext:core/mod.js";
import * as webidl from "ext:deno_webidl/00_webidl.js";
-import DOMException from "ext:deno_web/01_dom_exception.js";
+import { DOMException } from "ext:deno_web/01_dom_exception.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
const {
ArrayPrototypeFilter,
diff --git a/ext/web/02_structured_clone.js b/ext/web/02_structured_clone.js
index 72778e803..13275e2d8 100644
--- a/ext/web/02_structured_clone.js
+++ b/ext/web/02_structured_clone.js
@@ -7,10 +7,9 @@
/// <reference path="../web/lib.deno_web.d.ts" />
import { core, primordials } from "ext:core/mod.js";
-import DOMException from "ext:deno_web/01_dom_exception.js";
+import { DOMException } from "ext:deno_web/01_dom_exception.js";
const {
ArrayBuffer,
- ArrayBufferPrototype,
ArrayBufferPrototypeGetByteLength,
ArrayBufferPrototypeSlice,
ArrayBufferIsView,
@@ -38,6 +37,9 @@ const {
Float32Array,
Float64Array,
} = primordials;
+const {
+ isArrayBuffer,
+} = core;
const objectCloneMemo = new SafeWeakMap();
@@ -61,7 +63,7 @@ function cloneArrayBuffer(
function structuredClone(value) {
// Performance optimization for buffers, otherwise
// `serialize/deserialize` will allocate new buffer.
- if (ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, value)) {
+ if (isArrayBuffer(value)) {
const cloned = cloneArrayBuffer(
value,
0,
diff --git a/ext/web/05_base64.js b/ext/web/05_base64.js
index 63e9d95f8..c6e92d390 100644
--- a/ext/web/05_base64.js
+++ b/ext/web/05_base64.js
@@ -9,7 +9,7 @@
import { core, primordials } from "ext:core/mod.js";
const ops = core.ops;
import * as webidl from "ext:deno_webidl/00_webidl.js";
-import DOMException from "ext:deno_web/01_dom_exception.js";
+import { DOMException } from "ext:deno_web/01_dom_exception.js";
const {
ObjectPrototypeIsPrototypeOf,
TypeErrorPrototype,
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js
index 65f6ac05e..49c1eb41c 100644
--- a/ext/web/06_streams.js
+++ b/ext/web/06_streams.js
@@ -36,7 +36,6 @@ import {
const {
ArrayBuffer,
ArrayBufferIsView,
- ArrayBufferPrototype,
ArrayBufferPrototypeGetByteLength,
ArrayBufferPrototypeSlice,
ArrayPrototypeMap,
@@ -96,6 +95,12 @@ const {
WeakMapPrototypeSet,
queueMicrotask,
} = primordials;
+const {
+ isAnyArrayBuffer,
+ isArrayBuffer,
+ isSharedArrayBuffer,
+ isTypedArray,
+} = core;
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import { assert, AssertionError } from "ext:deno_web/00_infra.js";
@@ -272,8 +277,7 @@ class Queue {
* @returns {boolean}
*/
function isDetachedBuffer(O) {
- // deno-lint-ignore prefer-primordials
- if (ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, O)) {
+ if (isSharedArrayBuffer(O)) {
return false;
}
return ArrayBufferPrototypeGetByteLength(O) === 0 &&
@@ -286,11 +290,7 @@ function isDetachedBuffer(O) {
*/
function canTransferArrayBuffer(O) {
assert(typeof O === "object");
- assert(
- ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, O) ||
- // deno-lint-ignore prefer-primordials
- ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, O),
- );
+ assert(isAnyArrayBuffer(O));
if (isDetachedBuffer(O)) {
return false;
}
@@ -311,8 +311,7 @@ function transferArrayBuffer(O) {
* @returns {number}
*/
function getArrayBufferByteLength(O) {
- // deno-lint-ignore prefer-primordials
- if (ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, O)) {
+ if (isSharedArrayBuffer(O)) {
// TODO(petamoriken): use primordials
// deno-lint-ignore prefer-primordials
return O.byteLength;
@@ -328,8 +327,7 @@ function getArrayBufferByteLength(O) {
function cloneAsUint8Array(O) {
assert(typeof O === "object");
assert(ArrayBufferIsView(O));
- if (TypedArrayPrototypeGetSymbolToStringTag(O) !== undefined) {
- // TypedArray
+ if (isTypedArray(O)) {
return TypedArrayPrototypeSlice(
new Uint8Array(
TypedArrayPrototypeGetBuffer(/** @type {Uint8Array} */ (O)),
@@ -338,7 +336,6 @@ function cloneAsUint8Array(O) {
),
);
} else {
- // DataView
return TypedArrayPrototypeSlice(
new Uint8Array(
DataViewPrototypeGetBuffer(/** @type {DataView} */ (O)),
@@ -1340,15 +1337,7 @@ function readableByteStreamControllerEnqueue(controller, chunk) {
}
let buffer, byteLength, byteOffset;
- if (TypedArrayPrototypeGetSymbolToStringTag(chunk) === undefined) {
- buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (chunk));
- byteLength = DataViewPrototypeGetByteLength(
- /** @type {DataView} */ (chunk),
- );
- byteOffset = DataViewPrototypeGetByteOffset(
- /** @type {DataView} */ (chunk),
- );
- } else {
+ if (isTypedArray(chunk)) {
buffer = TypedArrayPrototypeGetBuffer(/** @type {Uint8Array}} */ (chunk));
byteLength = TypedArrayPrototypeGetByteLength(
/** @type {Uint8Array} */ (chunk),
@@ -1356,6 +1345,14 @@ function readableByteStreamControllerEnqueue(controller, chunk) {
byteOffset = TypedArrayPrototypeGetByteOffset(
/** @type {Uint8Array} */ (chunk),
);
+ } else {
+ buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (chunk));
+ byteLength = DataViewPrototypeGetByteLength(
+ /** @type {DataView} */ (chunk),
+ );
+ byteOffset = DataViewPrototypeGetByteOffset(
+ /** @type {DataView} */ (chunk),
+ );
}
if (isDetachedBuffer(buffer)) {
@@ -1461,7 +1458,7 @@ function readableByteStreamControllerEnqueueClonedChunkToQueue(
) {
let cloneResult;
try {
- if (ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, buffer)) {
+ if (isArrayBuffer(buffer)) {
cloneResult = ArrayBufferPrototypeSlice(
buffer,
byteOffset,
@@ -2292,11 +2289,7 @@ function readableByteStreamControllerRespondWithNewView(controller, view) {
assert(controller[_pendingPullIntos].length !== 0);
let buffer, byteLength, byteOffset;
- if (TypedArrayPrototypeGetSymbolToStringTag(view) === undefined) {
- buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (view));
- byteLength = DataViewPrototypeGetByteLength(/** @type {DataView} */ (view));
- byteOffset = DataViewPrototypeGetByteOffset(/** @type {DataView} */ (view));
- } else {
+ if (isTypedArray(view)) {
buffer = TypedArrayPrototypeGetBuffer(/** @type {Uint8Array}} */ (view));
byteLength = TypedArrayPrototypeGetByteLength(
/** @type {Uint8Array} */ (view),
@@ -2304,7 +2297,12 @@ function readableByteStreamControllerRespondWithNewView(controller, view) {
byteOffset = TypedArrayPrototypeGetByteOffset(
/** @type {Uint8Array} */ (view),
);
+ } else {
+ buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (view));
+ byteLength = DataViewPrototypeGetByteLength(/** @type {DataView} */ (view));
+ byteOffset = DataViewPrototypeGetByteOffset(/** @type {DataView} */ (view));
}
+
assert(!isDetachedBuffer(buffer));
const firstDescriptor = controller[_pendingPullIntos][0];
const state = controller[_stream][_state];
@@ -3364,14 +3362,14 @@ function readableByteStreamTee(stream) {
}
if (chunk !== undefined) {
let byteLength;
- if (TypedArrayPrototypeGetSymbolToStringTag(chunk) === undefined) {
- byteLength = DataViewPrototypeGetByteLength(
- /** @type {DataView} */ (chunk),
- );
- } else {
+ if (isTypedArray(chunk)) {
byteLength = TypedArrayPrototypeGetByteLength(
/** @type {Uint8Array} */ (chunk),
);
+ } else {
+ byteLength = DataViewPrototypeGetByteLength(
+ /** @type {DataView} */ (chunk),
+ );
}
assert(byteLength === 0);
if (!byobCanceled) {
@@ -5581,16 +5579,16 @@ class ReadableStreamBYOBReader {
}
let buffer, byteLength;
- if (TypedArrayPrototypeGetSymbolToStringTag(view) === undefined) {
- buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (view));
- byteLength = DataViewPrototypeGetByteLength(
- /** @type {DataView} */ (view),
- );
- } else {
+ if (isTypedArray(view)) {
buffer = TypedArrayPrototypeGetBuffer(/** @type {Uint8Array} */ (view));
byteLength = TypedArrayPrototypeGetByteLength(
/** @type {Uint8Array} */ (view),
);
+ } else {
+ buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (view));
+ byteLength = DataViewPrototypeGetByteLength(
+ /** @type {DataView} */ (view),
+ );
}
if (byteLength === 0) {
return PromiseReject(
@@ -5613,7 +5611,7 @@ class ReadableStreamBYOBReader {
if (options.min === 0) {
return PromiseReject(new TypeError("options.min must be non-zero"));
}
- if (TypedArrayPrototypeGetSymbolToStringTag(view) !== undefined) {
+ if (isTypedArray(view)) {
if (options.min > TypedArrayPrototypeGetLength(view)) {
return PromiseReject(
new RangeError("options.min must be smaller or equal to view's size"),
@@ -5745,12 +5743,12 @@ class ReadableStreamBYOBRequest {
}
let buffer, byteLength;
- if (TypedArrayPrototypeGetSymbolToStringTag(this[_view]) === undefined) {
- buffer = DataViewPrototypeGetBuffer(this[_view]);
- byteLength = DataViewPrototypeGetByteLength(this[_view]);
- } else {
+ if (isTypedArray(this[_view])) {
buffer = TypedArrayPrototypeGetBuffer(this[_view]);
byteLength = TypedArrayPrototypeGetByteLength(this[_view]);
+ } else {
+ buffer = DataViewPrototypeGetBuffer(this[_view]);
+ byteLength = DataViewPrototypeGetByteLength(this[_view]);
}
if (isDetachedBuffer(buffer)) {
throw new TypeError(
@@ -5774,10 +5772,10 @@ class ReadableStreamBYOBRequest {
}
let buffer;
- if (TypedArrayPrototypeGetSymbolToStringTag(view) === undefined) {
- buffer = DataViewPrototypeGetBuffer(view);
- } else {
+ if (isTypedArray(view)) {
buffer = TypedArrayPrototypeGetBuffer(view);
+ } else {
+ buffer = DataViewPrototypeGetBuffer(view);
}
if (isDetachedBuffer(buffer)) {
throw new TypeError(
@@ -5864,16 +5862,16 @@ class ReadableByteStreamController {
const arg1 = "Argument 1";
chunk = webidl.converters.ArrayBufferView(chunk, prefix, arg1);
let buffer, byteLength;
- if (TypedArrayPrototypeGetSymbolToStringTag(chunk) === undefined) {
- buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (chunk));
- byteLength = DataViewPrototypeGetByteLength(
- /** @type {DataView} */ (chunk),
- );
- } else {
+ if (isTypedArray(chunk)) {
buffer = TypedArrayPrototypeGetBuffer(/** @type {Uint8Array} */ (chunk));
byteLength = TypedArrayPrototypeGetByteLength(
/** @type {Uint8Array} */ (chunk),
);
+ } else {
+ buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (chunk));
+ byteLength = DataViewPrototypeGetByteLength(
+ /** @type {DataView} */ (chunk),
+ );
}
if (byteLength === 0) {
throw webidl.makeException(
diff --git a/ext/web/08_text_encoding.js b/ext/web/08_text_encoding.js
index 2b7eb35bb..e563c8bd4 100644
--- a/ext/web/08_text_encoding.js
+++ b/ext/web/08_text_encoding.js
@@ -17,23 +17,26 @@ const {
DataViewPrototypeGetBuffer,
DataViewPrototypeGetByteLength,
DataViewPrototypeGetByteOffset,
+ ObjectPrototypeIsPrototypeOf,
PromiseReject,
PromiseResolve,
// TODO(lucacasonato): add SharedArrayBuffer to primordials
- // SharedArrayBufferPrototype
+ // SharedArrayBufferPrototype,
StringPrototypeCharCodeAt,
StringPrototypeSlice,
SymbolFor,
- TypedArrayPrototypeSubarray,
TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetByteLength,
TypedArrayPrototypeGetByteOffset,
- TypedArrayPrototypeGetSymbolToStringTag,
- Uint8Array,
- ObjectPrototypeIsPrototypeOf,
- ArrayBufferIsView,
+ TypedArrayPrototypeSubarray,
Uint32Array,
+ Uint8Array,
} = primordials;
+const {
+ isDataView,
+ isSharedArrayBuffer,
+ isTypedArray,
+} = core;
class TextDecoder {
/** @type {string} */
@@ -111,51 +114,37 @@ class TextDecoder {
try {
/** @type {ArrayBufferLike} */
let buffer = input;
- if (ArrayBufferIsView(input)) {
- if (TypedArrayPrototypeGetSymbolToStringTag(input) !== undefined) {
- // TypedArray
- buffer = TypedArrayPrototypeGetBuffer(
- /** @type {Uint8Array} */ (input),
- );
- } else {
- // DataView
- buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (input));
- }
+ if (isTypedArray(input)) {
+ buffer = TypedArrayPrototypeGetBuffer(
+ /** @type {Uint8Array} */ (input),
+ );
+ } else if (isDataView(input)) {
+ buffer = DataViewPrototypeGetBuffer(/** @type {DataView} */ (input));
}
// Note from spec: implementations are strongly encouraged to use an implementation strategy that avoids this copy.
// When doing so they will have to make sure that changes to input do not affect future calls to decode().
- if (
- ObjectPrototypeIsPrototypeOf(
- // deno-lint-ignore prefer-primordials
- SharedArrayBuffer.prototype,
- buffer,
- )
- ) {
+ if (isSharedArrayBuffer(buffer)) {
// We clone the data into a non-shared ArrayBuffer so we can pass it
// to Rust.
// `input` is now a Uint8Array, and calling the TypedArray constructor
// with a TypedArray argument copies the data.
- if (ArrayBufferIsView(input)) {
- if (TypedArrayPrototypeGetSymbolToStringTag(input) !== undefined) {
- // TypedArray
- input = new Uint8Array(
- buffer,
- TypedArrayPrototypeGetByteOffset(
- /** @type {Uint8Array} */ (input),
- ),
- TypedArrayPrototypeGetByteLength(
- /** @type {Uint8Array} */ (input),
- ),
- );
- } else {
- // DataView
- input = new Uint8Array(
- buffer,
- DataViewPrototypeGetByteOffset(/** @type {DataView} */ (input)),
- DataViewPrototypeGetByteLength(/** @type {DataView} */ (input)),
- );
- }
+ if (isTypedArray(input)) {
+ input = new Uint8Array(
+ buffer,
+ TypedArrayPrototypeGetByteOffset(
+ /** @type {Uint8Array} */ (input),
+ ),
+ TypedArrayPrototypeGetByteLength(
+ /** @type {Uint8Array} */ (input),
+ ),
+ );
+ } else if (isDataView(input)) {
+ input = new Uint8Array(
+ buffer,
+ DataViewPrototypeGetByteOffset(/** @type {DataView} */ (input)),
+ DataViewPrototypeGetByteLength(/** @type {DataView} */ (input)),
+ );
} else {
input = new Uint8Array(buffer);
}
diff --git a/ext/web/09_file.js b/ext/web/09_file.js
index 4288802af..c38fbd101 100644
--- a/ext/web/09_file.js
+++ b/ext/web/09_file.js
@@ -16,10 +16,9 @@ import * as webidl from "ext:deno_webidl/00_webidl.js";
import { ReadableStream } from "ext:deno_web/06_streams.js";
import { URL } from "ext:deno_url/00_url.js";
const {
- ArrayBufferPrototype,
- ArrayBufferPrototypeSlice,
- ArrayBufferPrototypeGetByteLength,
ArrayBufferIsView,
+ ArrayBufferPrototypeGetByteLength,
+ ArrayBufferPrototypeSlice,
ArrayPrototypePush,
AsyncGeneratorPrototypeNext,
DataViewPrototypeGetBuffer,
@@ -31,23 +30,26 @@ const {
MathMin,
ObjectPrototypeIsPrototypeOf,
RegExpPrototypeTest,
- // TODO(lucacasonato): add SharedArrayBuffer to primordials
- // SharedArrayBufferPrototype
SafeFinalizationRegistry,
SafeRegExp,
StringPrototypeCharAt,
- StringPrototypeToLowerCase,
StringPrototypeSlice,
+ StringPrototypeToLowerCase,
Symbol,
SymbolFor,
- TypedArrayPrototypeSet,
+ TypeError,
TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetByteLength,
TypedArrayPrototypeGetByteOffset,
- TypedArrayPrototypeGetSymbolToStringTag,
- TypeError,
+ TypedArrayPrototypeSet,
Uint8Array,
} = primordials;
+const {
+ isAnyArrayBuffer,
+ isArrayBuffer,
+ isDataView,
+ isTypedArray,
+} = core;
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
const {
op_blob_read_part,
@@ -129,34 +131,30 @@ function processBlobParts(parts, endings) {
let size = 0;
for (let i = 0; i < parts.length; ++i) {
const element = parts[i];
- if (ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, element)) {
+ if (isArrayBuffer(element)) {
const chunk = new Uint8Array(ArrayBufferPrototypeSlice(element, 0));
ArrayPrototypePush(processedParts, BlobReference.fromUint8Array(chunk));
size += ArrayBufferPrototypeGetByteLength(element);
- } else if (ArrayBufferIsView(element)) {
- if (TypedArrayPrototypeGetSymbolToStringTag(element) !== undefined) {
- // TypedArray
- const chunk = new Uint8Array(
- TypedArrayPrototypeGetBuffer(/** @type {Uint8Array} */ (element)),
- TypedArrayPrototypeGetByteOffset(/** @type {Uint8Array} */ (element)),
- TypedArrayPrototypeGetByteLength(/** @type {Uint8Array} */ (element)),
- );
- size += TypedArrayPrototypeGetByteLength(
- /** @type {Uint8Array} */ (element),
- );
- ArrayPrototypePush(processedParts, BlobReference.fromUint8Array(chunk));
- } else {
- // DataView
- const chunk = new Uint8Array(
- DataViewPrototypeGetBuffer(/** @type {DataView} */ (element)),
- DataViewPrototypeGetByteOffset(/** @type {DataView} */ (element)),
- DataViewPrototypeGetByteLength(/** @type {DataView} */ (element)),
- );
- size += DataViewPrototypeGetByteLength(
- /** @type {DataView} */ (element),
- );
- ArrayPrototypePush(processedParts, BlobReference.fromUint8Array(chunk));
- }
+ } else if (isTypedArray(element)) {
+ const chunk = new Uint8Array(
+ TypedArrayPrototypeGetBuffer(/** @type {Uint8Array} */ (element)),
+ TypedArrayPrototypeGetByteOffset(/** @type {Uint8Array} */ (element)),
+ TypedArrayPrototypeGetByteLength(/** @type {Uint8Array} */ (element)),
+ );
+ size += TypedArrayPrototypeGetByteLength(
+ /** @type {Uint8Array} */ (element),
+ );
+ ArrayPrototypePush(processedParts, BlobReference.fromUint8Array(chunk));
+ } else if (isDataView(element)) {
+ const chunk = new Uint8Array(
+ DataViewPrototypeGetBuffer(/** @type {DataView} */ (element)),
+ DataViewPrototypeGetByteOffset(/** @type {DataView} */ (element)),
+ DataViewPrototypeGetByteLength(/** @type {DataView} */ (element)),
+ );
+ size += DataViewPrototypeGetByteLength(
+ /** @type {DataView} */ (element),
+ );
+ ArrayPrototypePush(processedParts, BlobReference.fromUint8Array(chunk));
} else if (ObjectPrototypeIsPrototypeOf(BlobPrototype, element)) {
ArrayPrototypePush(processedParts, element);
size += element.size;
@@ -446,11 +444,7 @@ webidl.converters["BlobPart"] = (V, prefix, context, opts) => {
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, V)) {
return webidl.converters["Blob"](V, prefix, context, opts);
}
- if (
- ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V) ||
- // deno-lint-ignore prefer-primordials
- ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V)
- ) {
+ if (isAnyArrayBuffer(V)) {
return webidl.converters["ArrayBuffer"](V, prefix, context, opts);
}
if (ArrayBufferIsView(V)) {
diff --git a/ext/web/10_filereader.js b/ext/web/10_filereader.js
index 36f4a5188..2a75ff8d6 100644
--- a/ext/web/10_filereader.js
+++ b/ext/web/10_filereader.js
@@ -18,7 +18,7 @@ import { forgivingBase64Encode } from "ext:deno_web/00_infra.js";
import { EventTarget, ProgressEvent } from "ext:deno_web/02_event.js";
import { decode, TextDecoder } from "ext:deno_web/08_text_encoding.js";
import { parseMimeType } from "ext:deno_web/01_mimesniff.js";
-import DOMException from "ext:deno_web/01_dom_exception.js";
+import { DOMException } from "ext:deno_web/01_dom_exception.js";
const {
ArrayPrototypePush,
ArrayPrototypeReduce,
diff --git a/ext/web/12_location.js b/ext/web/12_location.js
index 8ba9be634..5cc850262 100644
--- a/ext/web/12_location.js
+++ b/ext/web/12_location.js
@@ -3,7 +3,7 @@
/// <reference path="../../core/internal.d.ts" />
import { URL } from "ext:deno_url/00_url.js";
-import DOMException from "ext:deno_web/01_dom_exception.js";
+import { DOMException } from "ext:deno_web/01_dom_exception.js";
import { primordials } from "ext:core/mod.js";
const {
Error,
diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js
index 71adae1f4..0fddfc2e8 100644
--- a/ext/web/13_message_port.js
+++ b/ext/web/13_message_port.js
@@ -18,9 +18,8 @@ import {
setIsTrusted,
} from "ext:deno_web/02_event.js";
import { isDetachedBuffer } from "ext:deno_web/06_streams.js";
-import DOMException from "ext:deno_web/01_dom_exception.js";
+import { DOMException } from "ext:deno_web/01_dom_exception.js";
const {
- ArrayBufferPrototype,
ArrayBufferPrototypeGetByteLength,
ArrayPrototypeFilter,
ArrayPrototypeIncludes,
@@ -32,6 +31,9 @@ const {
TypeError,
} = primordials;
const {
+ isArrayBuffer,
+} = core;
+const {
op_message_port_recv_message,
} = core.ensureFastOps();
@@ -282,7 +284,7 @@ function serializeJsMessageData(data, transferables) {
const hostObjects = [];
for (let i = 0, j = 0; i < transferables.length; i++) {
const t = transferables[i];
- if (ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, t)) {
+ if (isArrayBuffer(t)) {
if (
ArrayBufferPrototypeGetByteLength(t) === 0 &&
isDetachedBuffer(t)
@@ -329,9 +331,7 @@ function serializeJsMessageData(data, transferables) {
kind: "messagePort",
data: id,
});
- } else if (
- ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, transferable)
- ) {
+ } else if (isArrayBuffer(transferable)) {
ArrayPrototypePush(serializedTransferables, {
kind: "arrayBuffer",
data: transferredArrayBuffers[arrayBufferI],
diff --git a/ext/web/15_performance.js b/ext/web/15_performance.js
index f5ec96076..b686f75dd 100644
--- a/ext/web/15_performance.js
+++ b/ext/web/15_performance.js
@@ -19,7 +19,7 @@ import { structuredClone } from "ext:deno_web/02_structured_clone.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import { EventTarget } from "ext:deno_web/02_event.js";
import { opNow } from "ext:deno_web/02_timers.js";
-import DOMException from "ext:deno_web/01_dom_exception.js";
+import { DOMException } from "ext:deno_web/01_dom_exception.js";
const illegalConstructorKey = Symbol("illegalConstructorKey");
let performanceEntries = [];
diff --git a/ext/web/16_image_data.js b/ext/web/16_image_data.js
index 63e35733e..c7f8795f5 100644
--- a/ext/web/16_image_data.js
+++ b/ext/web/16_image_data.js
@@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import * as webidl from "ext:deno_webidl/00_webidl.js";
-import DOMException from "ext:deno_web/01_dom_exception.js";
+import { DOMException } from "ext:deno_web/01_dom_exception.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
const primordials = globalThis.__bootstrap.primordials;
const {
diff --git a/ext/web/internal.d.ts b/ext/web/internal.d.ts
index 6b81e3fe3..c980ddcee 100644
--- a/ext/web/internal.d.ts
+++ b/ext/web/internal.d.ts
@@ -47,7 +47,7 @@ declare module "ext:deno_web/00_infra.js" {
}
declare module "ext:deno_web/01_dom_exception.js" {
- export = DOMException;
+ const DOMException: DOMException;
}
declare module "ext:deno_web/01_mimesniff.js" {