summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2023-11-19 17:13:38 +0900
committerGitHub <noreply@github.com>2023-11-19 09:13:38 +0100
commitc806fbdabe144c865612bbbc9ef596c9611c8310 (patch)
treeedb38d58720377580677ccbeffb693ffa1225cc4 /ext
parenta7548afb58b9848e501a085455446f5de897ffaa (diff)
fix(ext,runtime): add missing custom inspections (#21219)
Diffstat (limited to 'ext')
-rw-r--r--ext/broadcast_channel/01_broadcast_channel.js18
-rw-r--r--ext/cache/01_cache.js9
-rw-r--r--ext/crypto/00_crypto.js39
-rw-r--r--ext/fetch/20_headers.js15
-rw-r--r--ext/fetch/21_formdata.js12
-rw-r--r--ext/fetch/23_request.js27
-rw-r--r--ext/fetch/23_response.js33
-rw-r--r--ext/fetch/27_eventsource.js21
-rw-r--r--ext/url/00_url.js36
-rw-r--r--ext/url/01_urlpattern.js33
-rw-r--r--ext/web/01_dom_exception.js25
-rw-r--r--ext/web/02_event.js189
-rw-r--r--ext/web/03_abort_signal.js31
-rw-r--r--ext/web/06_streams.js239
-rw-r--r--ext/web/08_text_encoding.js66
-rw-r--r--ext/web/09_file.js44
-rw-r--r--ext/web/10_filereader.js18
-rw-r--r--ext/web/12_location.js54
-rw-r--r--ext/web/13_message_port.js31
-rw-r--r--ext/web/14_compression.js37
-rw-r--r--ext/web/15_performance.js107
-rw-r--r--ext/websocket/01_websocket.js32
-rw-r--r--ext/websocket/02_websocketstream.js20
-rw-r--r--ext/webstorage/01_webstorage.js9
24 files changed, 786 insertions, 359 deletions
diff --git a/ext/broadcast_channel/01_broadcast_channel.js b/ext/broadcast_channel/01_broadcast_channel.js
index e5e4169b6..a482a2dce 100644
--- a/ext/broadcast_channel/01_broadcast_channel.js
+++ b/ext/broadcast_channel/01_broadcast_channel.js
@@ -5,6 +5,7 @@
const core = globalThis.Deno.core;
const ops = core.ops;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import {
defineEventHandler,
EventTarget,
@@ -17,8 +18,10 @@ const {
ArrayPrototypeIndexOf,
ArrayPrototypePush,
ArrayPrototypeSplice,
+ ObjectPrototypeIsPrototypeOf,
PromisePrototypeThen,
Symbol,
+ SymbolFor,
Uint8Array,
} = primordials;
@@ -141,6 +144,21 @@ class BroadcastChannel extends EventTarget {
ops.op_broadcast_unsubscribe(rid);
}
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(BroadcastChannelPrototype, this),
+ keys: [
+ "name",
+ "onmessage",
+ "onmessageerror",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
defineEventHandler(BroadcastChannel.prototype, "message");
diff --git a/ext/cache/01_cache.js b/ext/cache/01_cache.js
index e64178d89..d3514a3f2 100644
--- a/ext/cache/01_cache.js
+++ b/ext/cache/01_cache.js
@@ -8,6 +8,7 @@ const {
StringPrototypeSplit,
StringPrototypeTrim,
Symbol,
+ SymbolFor,
TypeError,
} = primordials;
import {
@@ -59,6 +60,10 @@ class CacheStorage {
cacheName = webidl.converters["DOMString"](cacheName, prefix, "Argument 1");
return await op_cache_storage_delete(cacheName);
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return `${this.constructor.name} ${inspect({}, inspectOptions)}`;
+ }
}
const _matchAll = Symbol("[[matchAll]]");
@@ -275,6 +280,10 @@ class Cache {
return responses;
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return `${this.constructor.name} ${inspect({}, inspectOptions)}`;
+ }
}
webidl.configureInterface(CacheStorage);
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js
index 7e1fac49f..58cbde716 100644
--- a/ext/crypto/00_crypto.js
+++ b/ext/crypto/00_crypto.js
@@ -10,6 +10,7 @@ const core = globalThis.Deno.core;
const ops = core.ops;
const primordials = globalThis.__bootstrap.primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import DOMException from "ext:deno_web/01_dom_exception.js";
const {
ArrayBufferIsView,
@@ -349,15 +350,20 @@ class CryptoKey {
return this[_algorithm];
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- type: this.type,
- extractable: this.extractable,
- algorithm: this.algorithm,
- usages: this.usages,
- })
- }`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(CryptoKeyPrototype, this),
+ keys: [
+ "type",
+ "extractable",
+ "algorithm",
+ "usages",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
@@ -1710,6 +1716,10 @@ class SubtleCrypto {
return result;
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return `${this.constructor.name} ${inspect({}, inspectOptions)}`;
+ }
}
const SubtleCryptoPrototype = SubtleCrypto.prototype;
@@ -4730,8 +4740,15 @@ class Crypto {
return subtle;
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${inspect({})}`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(CryptoPrototype, this),
+ keys: ["subtle"],
+ }),
+ inspectOptions,
+ );
}
}
diff --git a/ext/fetch/20_headers.js b/ext/fetch/20_headers.js
index b99758de5..d03751d08 100644
--- a/ext/fetch/20_headers.js
+++ b/ext/fetch/20_headers.js
@@ -26,7 +26,9 @@ const {
ArrayPrototypeSort,
ArrayPrototypeJoin,
ArrayPrototypeSplice,
+ ObjectFromEntries,
ObjectHasOwn,
+ ObjectPrototypeIsPrototypeOf,
RegExpPrototypeTest,
Symbol,
SymbolFor,
@@ -441,13 +443,14 @@ class Headers {
}
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- const headers = {};
- // deno-lint-ignore prefer-primordials
- for (const header of this) {
- headers[header[0]] = header[1];
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ if (ObjectPrototypeIsPrototypeOf(HeadersPrototype, this)) {
+ return `${this.constructor.name} ${
+ inspect(ObjectFromEntries(this), inspectOptions)
+ }`;
+ } else {
+ return `${this.constructor.name} ${inspect({}, inspectOptions)}`;
}
- return `Headers ${inspect(headers)}`;
}
}
diff --git a/ext/fetch/21_formdata.js b/ext/fetch/21_formdata.js
index 84d31898e..12ce2bb58 100644
--- a/ext/fetch/21_formdata.js
+++ b/ext/fetch/21_formdata.js
@@ -26,10 +26,12 @@ const {
MapPrototypeSet,
MathRandom,
ObjectFreeze,
+ ObjectFromEntries,
ObjectPrototypeIsPrototypeOf,
SafeMap,
SafeRegExp,
Symbol,
+ SymbolFor,
StringFromCharCode,
StringPrototypeCharCodeAt,
StringPrototypeTrim,
@@ -262,6 +264,16 @@ class FormData {
ArrayPrototypePush(list, entry);
}
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ if (ObjectPrototypeIsPrototypeOf(FormDataPrototype, this)) {
+ return `${this.constructor.name} ${
+ inspect(ObjectFromEntries(this), inspectOptions)
+ }`;
+ } else {
+ return `${this.constructor.name} ${inspect({}, inspectOptions)}`;
+ }
+ }
}
webidl.mixinPairIterable("FormData", FormData, entryList, "name", "value");
diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js
index bbaf886a6..b78ed07be 100644
--- a/ext/fetch/23_request.js
+++ b/ext/fetch/23_request.js
@@ -483,18 +483,21 @@ class Request {
);
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(RequestPrototype, this),
- keys: [
- "bodyUsed",
- "headers",
- "method",
- "redirect",
- "url",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(RequestPrototype, this),
+ keys: [
+ "bodyUsed",
+ "headers",
+ "method",
+ "redirect",
+ "url",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js
index 83fad403a..0b37c1229 100644
--- a/ext/fetch/23_response.js
+++ b/ext/fetch/23_response.js
@@ -408,21 +408,24 @@ class Response {
return second;
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(ResponsePrototype, this),
- keys: [
- "body",
- "bodyUsed",
- "headers",
- "ok",
- "redirected",
- "status",
- "statusText",
- "url",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(ResponsePrototype, this),
+ keys: [
+ "body",
+ "bodyUsed",
+ "headers",
+ "ok",
+ "redirected",
+ "status",
+ "statusText",
+ "url",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
diff --git a/ext/fetch/27_eventsource.js b/ext/fetch/27_eventsource.js
index 6e35bb693..1db65d748 100644
--- a/ext/fetch/27_eventsource.js
+++ b/ext/fetch/27_eventsource.js
@@ -5,6 +5,7 @@
const core = globalThis.Deno.core;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import { URL } from "ext:deno_url/00_url.js";
import DOMException from "ext:deno_web/01_dom_exception.js";
import {
@@ -25,6 +26,7 @@ const {
NumberIsFinite,
NumberIsNaN,
ObjectDefineProperties,
+ ObjectPrototypeIsPrototypeOf,
Promise,
StringPrototypeEndsWith,
StringPrototypeIncludes,
@@ -34,6 +36,7 @@ const {
StringPrototypeStartsWith,
StringPrototypeToLowerCase,
Symbol,
+ SymbolFor,
} = primordials;
// Copied from https://github.com/denoland/deno_std/blob/e0753abe0c8602552862a568348c046996709521/streams/text_line_stream.ts#L20-L74
@@ -345,6 +348,24 @@ class EventSource extends EventTarget {
}
}
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(EventSourcePrototype, this),
+ keys: [
+ "readyState",
+ "url",
+ "withCredentials",
+ "onopen",
+ "onmessage",
+ "onerror",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
const EventSourcePrototype = EventSource.prototype;
diff --git a/ext/url/00_url.js b/ext/url/00_url.js
index ce366a27a..d0ec376d6 100644
--- a/ext/url/00_url.js
+++ b/ext/url/00_url.js
@@ -8,6 +8,7 @@
const core = globalThis.Deno.core;
const ops = core.ops;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
const primordials = globalThis.__bootstrap.primordials;
const {
ArrayIsArray,
@@ -17,6 +18,7 @@ const {
ArrayPrototypeSort,
ArrayPrototypeSplice,
ObjectKeys,
+ ObjectPrototypeIsPrototypeOf,
SafeArrayIterator,
StringPrototypeSlice,
StringPrototypeStartsWith,
@@ -410,20 +412,26 @@ class URL {
}
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
- const object = {
- href: this.href,
- origin: this.origin,
- protocol: this.protocol,
- username: this.username,
- password: this.password,
- host: this.host,
- hostname: this.hostname,
- port: this.port,
- pathname: this.pathname,
- hash: this.hash,
- search: this.search,
- };
- return `${this.constructor.name} ${inspect(object, inspectOptions)}`;
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(URLPrototype, this),
+ keys: [
+ "href",
+ "origin",
+ "protocol",
+ "username",
+ "password",
+ "host",
+ "hostname",
+ "port",
+ "pathname",
+ "hash",
+ "search",
+ ],
+ }),
+ inspectOptions,
+ );
}
#updateSearchParams() {
diff --git a/ext/url/01_urlpattern.js b/ext/url/01_urlpattern.js
index 0cabccc1b..71962d405 100644
--- a/ext/url/01_urlpattern.js
+++ b/ext/url/01_urlpattern.js
@@ -10,11 +10,13 @@
const core = globalThis.Deno.core;
const ops = core.ops;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
const primordials = globalThis.__bootstrap.primordials;
const {
ArrayPrototypePop,
RegExpPrototypeExec,
RegExpPrototypeTest,
+ ObjectPrototypeIsPrototypeOf,
SafeRegExp,
Symbol,
SymbolFor,
@@ -222,19 +224,24 @@ class URLPattern {
return result;
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return `URLPattern ${
- inspect({
- protocol: this.protocol,
- username: this.username,
- password: this.password,
- hostname: this.hostname,
- port: this.port,
- pathname: this.pathname,
- search: this.search,
- hash: this.hash,
- })
- }`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(URLPatternPrototype, this),
+ keys: [
+ "protocol",
+ "username",
+ "password",
+ "hostname",
+ "port",
+ "pathname",
+ "search",
+ "hash",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
diff --git a/ext/web/01_dom_exception.js b/ext/web/01_dom_exception.js
index d876d90a6..941b057e4 100644
--- a/ext/web/01_dom_exception.js
+++ b/ext/web/01_dom_exception.js
@@ -131,19 +131,22 @@ class DOMException {
return this[_code];
}
- [SymbolFor("Deno.customInspect")](inspect) {
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
if (ObjectPrototypeIsPrototypeOf(DOMExceptionPrototype, this)) {
- return `DOMException: ${this[_message]}`;
+ return this[_error].stack;
} else {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: false,
- keys: [
- "message",
- "name",
- "code",
- ],
- }));
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: false,
+ keys: [
+ "message",
+ "name",
+ "code",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
}
diff --git a/ext/web/02_event.js b/ext/web/02_event.js
index 8831d37fb..3690f62b7 100644
--- a/ext/web/02_event.js
+++ b/ext/web/02_event.js
@@ -158,12 +158,15 @@ class Event {
};
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(Event.prototype, this),
- keys: EVENT_PROPS,
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(EventPrototype, this),
+ keys: EVENT_PROPS,
+ }),
+ inspectOptions,
+ );
}
get type() {
@@ -385,6 +388,8 @@ class Event {
}
}
+const EventPrototype = Event.prototype;
+
// Not spec compliant. The spec defines it as [LegacyUnforgeable]
// but doing so has a big performance hit
ReflectDefineProperty(Event.prototype, "isTrusted", {
@@ -1042,6 +1047,10 @@ class EventTarget {
getParent(_event) {
return null;
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return `${this.constructor.name} ${inspect({}, inspectOptions)}`;
+ }
}
webidl.configureInterface(EventTarget);
@@ -1102,25 +1111,30 @@ class ErrorEvent extends Event {
this.#error = error;
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(ErrorEvent.prototype, this),
- keys: [
- ...new SafeArrayIterator(EVENT_PROPS),
- "message",
- "filename",
- "lineno",
- "colno",
- "error",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(ErrorEventPrototype, this),
+ keys: [
+ ...new SafeArrayIterator(EVENT_PROPS),
+ "message",
+ "filename",
+ "lineno",
+ "colno",
+ "error",
+ ],
+ }),
+ inspectOptions,
+ );
}
// TODO(lucacasonato): remove when this interface is spec aligned
[SymbolToStringTag] = "ErrorEvent";
}
+const ErrorEventPrototype = ErrorEvent.prototype;
+
defineEnumerableProps(ErrorEvent, [
"message",
"filename",
@@ -1163,20 +1177,25 @@ class CloseEvent extends Event {
this.#reason = reason;
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(CloseEvent.prototype, this),
- keys: [
- ...new SafeArrayIterator(EVENT_PROPS),
- "wasClean",
- "code",
- "reason",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(CloseEventPrototype, this),
+ keys: [
+ ...new SafeArrayIterator(EVENT_PROPS),
+ "wasClean",
+ "code",
+ "reason",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
+const CloseEventPrototype = CloseEvent.prototype;
+
class MessageEvent extends Event {
get source() {
return null;
@@ -1195,23 +1214,28 @@ class MessageEvent extends Event {
this.lastEventId = eventInitDict?.lastEventId ?? "";
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(MessageEvent.prototype, this),
- keys: [
- ...new SafeArrayIterator(EVENT_PROPS),
- "data",
- "origin",
- "lastEventId",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(MessageEventPrototype, this),
+ keys: [
+ ...new SafeArrayIterator(EVENT_PROPS),
+ "data",
+ "origin",
+ "lastEventId",
+ ],
+ }),
+ inspectOptions,
+ );
}
// TODO(lucacasonato): remove when this interface is spec aligned
[SymbolToStringTag] = "CloseEvent";
}
+const MessageEventPrototype = MessageEvent.prototype;
+
class CustomEvent extends Event {
#detail = null;
@@ -1230,21 +1254,26 @@ class CustomEvent extends Event {
return this.#detail;
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(CustomEvent.prototype, this),
- keys: [
- ...new SafeArrayIterator(EVENT_PROPS),
- "detail",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(CustomEventPrototype, this),
+ keys: [
+ ...new SafeArrayIterator(EVENT_PROPS),
+ "detail",
+ ],
+ }),
+ inspectOptions,
+ );
}
// TODO(lucacasonato): remove when this interface is spec aligned
[SymbolToStringTag] = "CustomEvent";
}
+const CustomEventPrototype = CustomEvent.prototype;
+
ReflectDefineProperty(CustomEvent.prototype, "detail", {
enumerable: true,
});
@@ -1260,23 +1289,28 @@ class ProgressEvent extends Event {
this.total = eventInitDict?.total ?? 0;
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(ProgressEvent.prototype, this),
- keys: [
- ...new SafeArrayIterator(EVENT_PROPS),
- "lengthComputable",
- "loaded",
- "total",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(ProgressEventPrototype, this),
+ keys: [
+ ...new SafeArrayIterator(EVENT_PROPS),
+ "lengthComputable",
+ "loaded",
+ "total",
+ ],
+ }),
+ inspectOptions,
+ );
}
// TODO(lucacasonato): remove when this interface is spec aligned
[SymbolToStringTag] = "ProgressEvent";
}
+const ProgressEventPrototype = ProgressEvent.prototype;
+
class PromiseRejectionEvent extends Event {
#promise = null;
#reason = null;
@@ -1308,25 +1342,30 @@ class PromiseRejectionEvent extends Event {
this.#reason = reason;
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- PromiseRejectionEvent.prototype,
- this,
- ),
- keys: [
- ...new SafeArrayIterator(EVENT_PROPS),
- "promise",
- "reason",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ PromiseRejectionEventPrototype,
+ this,
+ ),
+ keys: [
+ ...new SafeArrayIterator(EVENT_PROPS),
+ "promise",
+ "reason",
+ ],
+ }),
+ inspectOptions,
+ );
}
// TODO(lucacasonato): remove when this interface is spec aligned
[SymbolToStringTag] = "PromiseRejectionEvent";
}
+const PromiseRejectionEventPrototype = PromiseRejectionEvent.prototype;
+
defineEnumerableProps(PromiseRejectionEvent, [
"promise",
"reason",
@@ -1342,7 +1381,7 @@ function makeWrappedHandler(handler, isSpecialErrorEventHandler) {
if (
isSpecialErrorEventHandler &&
- ObjectPrototypeIsPrototypeOf(ErrorEvent.prototype, evt) &&
+ ObjectPrototypeIsPrototypeOf(ErrorEventPrototype, evt) &&
evt.type === "error"
) {
const ret = FunctionPrototypeCall(
diff --git a/ext/web/03_abort_signal.js b/ext/web/03_abort_signal.js
index a237b273c..f534ec04f 100644
--- a/ext/web/03_abort_signal.js
+++ b/ext/web/03_abort_signal.js
@@ -5,6 +5,7 @@
import * as webidl from "ext:deno_webidl/00_webidl.js";
import { assert } from "ext:deno_web/00_infra.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import {
defineEventHandler,
Event,
@@ -16,6 +17,7 @@ const primordials = globalThis.__bootstrap.primordials;
const {
ArrayPrototypeEvery,
ArrayPrototypePush,
+ ObjectPrototypeIsPrototypeOf,
SafeArrayIterator,
SafeSet,
SafeSetIterator,
@@ -24,6 +26,7 @@ const {
SetPrototypeAdd,
SetPrototypeDelete,
Symbol,
+ SymbolFor,
TypeError,
WeakRefPrototypeDeref,
WeakSetPrototypeAdd,
@@ -238,6 +241,21 @@ class AbortSignal extends EventTarget {
}
}
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(AbortSignalPrototype, this),
+ keys: [
+ "aborted",
+ "reason",
+ "onabort",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
defineEventHandler(AbortSignal.prototype, "abort");
@@ -260,6 +278,19 @@ class AbortController {
webidl.assertBranded(this, AbortControllerPrototype);
this[signal][signalAbort](reason);
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(AbortControllerPrototype, this),
+ keys: [
+ "signal",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
webidl.configureInterface(AbortController);
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js
index 7ce045e68..b0fa4393f 100644
--- a/ext/web/06_streams.js
+++ b/ext/web/06_streams.js
@@ -4977,18 +4977,21 @@ class ByteLengthQueuingStrategy {
return WeakMapPrototypeGet(byteSizeFunctionWeakMap, this[_globalObject]);
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- ByteLengthQueuingStrategyPrototype,
- this,
- ),
- keys: [
- "highWaterMark",
- "size",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ ByteLengthQueuingStrategyPrototype,
+ this,
+ ),
+ keys: [
+ "highWaterMark",
+ "size",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
@@ -5031,18 +5034,21 @@ class CountQueuingStrategy {
return WeakMapPrototypeGet(countSizeFunctionWeakMap, this[_globalObject]);
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- CountQueuingStrategyPrototype,
- this,
- ),
- keys: [
- "highWaterMark",
- "size",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ CountQueuingStrategyPrototype,
+ this,
+ ),
+ keys: [
+ "highWaterMark",
+ "size",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
@@ -5372,8 +5378,18 @@ class ReadableStream {
return iterator;
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return `${this.constructor.name} ${inspect({ locked: this.locked })}`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ ReadableStreamPrototype,
+ this,
+ ),
+ keys: ["locked"],
+ }),
+ inspectOptions,
+ );
}
}
@@ -5484,8 +5500,18 @@ class ReadableStreamDefaultReader {
return readableStreamReaderGenericCancel(this, reason);
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return `${this.constructor.name} ${inspect({ closed: this.closed })}`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ ReadableStreamDefaultReaderPrototype,
+ this,
+ ),
+ keys: ["closed"],
+ }),
+ inspectOptions,
+ );
}
}
@@ -5621,8 +5647,18 @@ class ReadableStreamBYOBReader {
return readableStreamReaderGenericCancel(this, reason);
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return `${this.constructor.name} ${inspect({ closed: this.closed })}`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ ReadableStreamBYOBReaderPrototype,
+ this,
+ ),
+ keys: ["closed"],
+ }),
+ inspectOptions,
+ );
}
}
@@ -5837,15 +5873,18 @@ class ReadableByteStreamController {
readableByteStreamControllerError(this, e);
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- ReadableByteStreamControllerPrototype,
- this,
- ),
- keys: ["desiredSize"],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ ReadableByteStreamControllerPrototype,
+ this,
+ ),
+ keys: ["desiredSize"],
+ }),
+ inspectOptions,
+ );
}
/**
@@ -5987,15 +6026,18 @@ class ReadableStreamDefaultController {
readableStreamDefaultControllerError(this, e);
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- ReadableStreamDefaultController.prototype,
- this,
- ),
- keys: ["desiredSize"],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ ReadableStreamDefaultControllerPrototype,
+ this,
+ ),
+ keys: ["desiredSize"],
+ }),
+ inspectOptions,
+ );
}
/**
@@ -6146,10 +6188,18 @@ class TransformStream {
return this[_writable];
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({ readable: this.readable, writable: this.writable })
- }`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ TransformStreamPrototype,
+ this,
+ ),
+ keys: ["readable", "writable"],
+ }),
+ inspectOptions,
+ );
}
}
@@ -6215,15 +6265,18 @@ class TransformStreamDefaultController {
transformStreamDefaultControllerTerminate(this);
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- TransformStreamDefaultController.prototype,
- this,
- ),
- keys: ["desiredSize"],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ TransformStreamDefaultControllerPrototype,
+ this,
+ ),
+ keys: ["desiredSize"],
+ }),
+ inspectOptions,
+ );
}
}
@@ -6363,8 +6416,18 @@ class WritableStream {
return acquireWritableStreamDefaultWriter(this);
}
- [SymbolFor("Deno.privateCustomInspect")](inspect) {
- return `${this.constructor.name} ${inspect({ locked: this.locked })}`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ WritableStreamPrototype,
+ this,
+ ),
+ keys: ["locked"],
+ }),
+ inspectOptions,
+ );
}
}
@@ -6498,19 +6561,22 @@ class WritableStreamDefaultWriter {
return writableStreamDefaultWriterWrite(this, chunk);
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- WritableStreamDefaultWriter.prototype,
- this,
- ),
- keys: [
- "closed",
- "desiredSize",
- "ready",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ WritableStreamDefaultWriterPrototype,
+ this,
+ ),
+ keys: [
+ "closed",
+ "desiredSize",
+ "ready",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
@@ -6569,15 +6635,18 @@ class WritableStreamDefaultController {
writableStreamDefaultControllerError(this, e);
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- WritableStreamDefaultController.prototype,
- this,
- ),
- keys: [],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ WritableStreamDefaultControllerPrototype,
+ this,
+ ),
+ keys: ["signal"],
+ }),
+ inspectOptions,
+ );
}
/**
diff --git a/ext/web/08_text_encoding.js b/ext/web/08_text_encoding.js
index 5f8391e12..81a3425ed 100644
--- a/ext/web/08_text_encoding.js
+++ b/ext/web/08_text_encoding.js
@@ -12,6 +12,7 @@
const core = globalThis.Deno.core;
const ops = core.ops;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
const primordials = globalThis.__bootstrap.primordials;
const {
DataViewPrototypeGetBuffer,
@@ -23,6 +24,7 @@ const {
// SharedArrayBufferPrototype
StringPrototypeCharCodeAt,
StringPrototypeSlice,
+ SymbolFor,
TypedArrayPrototypeSubarray,
TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetByteLength,
@@ -190,6 +192,21 @@ class TextDecoder {
}
}
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(TextDecoderPrototype, this),
+ keys: [
+ "encoding",
+ "fatal",
+ "ignoreBOM",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
webidl.configureInterface(TextDecoder);
@@ -247,6 +264,17 @@ class TextEncoder {
written: encodeIntoBuf[1],
};
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(TextEncoderPrototype, this),
+ keys: ["encoding"],
+ }),
+ inspectOptions,
+ );
+ }
}
const encodeIntoBuf = new Uint32Array(2);
@@ -342,6 +370,26 @@ class TextDecoderStream {
webidl.assertBranded(this, TextDecoderStreamPrototype);
return this.#transform.writable;
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ TextDecoderStreamPrototype,
+ this,
+ ),
+ keys: [
+ "encoding",
+ "fatal",
+ "ignoreBOM",
+ "readable",
+ "writable",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
webidl.configureInterface(TextDecoderStream);
@@ -415,6 +463,24 @@ class TextEncoderStream {
webidl.assertBranded(this, TextEncoderStreamPrototype);
return this.#transform.writable;
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ TextEncoderStreamPrototype,
+ this,
+ ),
+ keys: [
+ "encoding",
+ "readable",
+ "writable",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
webidl.configureInterface(TextEncoderStream);
diff --git a/ext/web/09_file.js b/ext/web/09_file.js
index 30b91c053..7ee029d8a 100644
--- a/ext/web/09_file.js
+++ b/ext/web/09_file.js
@@ -416,15 +416,18 @@ class Blob {
return TypedArrayPrototypeGetBuffer(buf);
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(BlobPrototype, this),
- keys: [
- "size",
- "type",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(BlobPrototype, this),
+ keys: [
+ "size",
+ "type",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
@@ -536,16 +539,19 @@ class File extends Blob {
return this[_LastModified];
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(FilePrototype, this),
- keys: [
- "name",
- "size",
- "type",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(FilePrototype, this),
+ keys: [
+ "name",
+ "size",
+ "type",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
diff --git a/ext/web/10_filereader.js b/ext/web/10_filereader.js
index f7b88669b..07a5a38ec 100644
--- a/ext/web/10_filereader.js
+++ b/ext/web/10_filereader.js
@@ -13,6 +13,7 @@
const core = globalThis.Deno.core;
const ops = core.ops;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
const primordials = globalThis.__bootstrap.primordials;
import { forgivingBase64Encode } from "ext:deno_web/00_infra.js";
import { EventTarget, ProgressEvent } from "ext:deno_web/02_event.js";
@@ -26,10 +27,12 @@ const {
MapPrototypeGet,
MapPrototypeSet,
ObjectDefineProperty,
+ ObjectPrototypeIsPrototypeOf,
queueMicrotask,
SafeArrayIterator,
SafeMap,
Symbol,
+ SymbolFor,
TypedArrayPrototypeSet,
TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetByteLength,
@@ -430,6 +433,21 @@ class FileReader extends EventTarget {
set onabort(value) {
this.#setEventHandlerFor("abort", value);
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(FileReaderPrototype, this),
+ keys: [
+ "error",
+ "readyState",
+ "result",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
webidl.configureInterface(FileReader);
diff --git a/ext/web/12_location.js b/ext/web/12_location.js
index c612ca743..f469e9093 100644
--- a/ext/web/12_location.js
+++ b/ext/web/12_location.js
@@ -180,19 +180,20 @@ class Location {
enumerable: true,
},
[SymbolFor("Deno.privateCustomInspect")]: {
- value: function (inspect) {
- const object = {
- hash: this.hash,
- host: this.host,
- hostname: this.hostname,
- href: this.href,
- origin: this.origin,
- pathname: this.pathname,
- port: this.port,
- protocol: this.protocol,
- search: this.search,
- };
- return `${this.constructor.name} ${inspect(object)}`;
+ value: function (inspect, inspectOptions) {
+ return `${this.constructor.name} ${
+ inspect({
+ hash: this.hash,
+ host: this.host,
+ hostname: this.hostname,
+ href: this.href,
+ origin: this.origin,
+ pathname: this.pathname,
+ port: this.port,
+ protocol: this.protocol,
+ search: this.search,
+ }, inspectOptions)
+ }`;
},
},
});
@@ -337,19 +338,20 @@ ObjectDefineProperties(WorkerLocation.prototype, {
configurable: true,
},
[SymbolFor("Deno.privateCustomInspect")]: {
- value: function (inspect) {
- const object = {
- hash: this.hash,
- host: this.host,
- hostname: this.hostname,
- href: this.href,
- origin: this.origin,
- pathname: this.pathname,
- port: this.port,
- protocol: this.protocol,
- search: this.search,
- };
- return `${this.constructor.name} ${inspect(object)}`;
+ value: function (inspect, inspectOptions) {
+ return `${this.constructor.name} ${
+ inspect({
+ hash: this.hash,
+ host: this.host,
+ hostname: this.hostname,
+ href: this.href,
+ origin: this.origin,
+ pathname: this.pathname,
+ port: this.port,
+ protocol: this.protocol,
+ search: this.search,
+ }, inspectOptions)
+ }`;
},
},
});
diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js
index 4b0404ab6..34f86f80c 100644
--- a/ext/web/13_message_port.js
+++ b/ext/web/13_message_port.js
@@ -9,6 +9,7 @@
const core = globalThis.Deno.core;
const { InterruptedPrototype, ops } = core;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import {
defineEventHandler,
EventTarget,
@@ -57,10 +58,18 @@ class MessageChannel {
return this.#port2;
}
- [SymbolFor("Deno.inspect")](inspect) {
- return `MessageChannel ${
- inspect({ port1: this.port1, port2: this.port2 })
- }`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(MessageChannelPrototype, this),
+ keys: [
+ "port1",
+ "port2",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
@@ -181,6 +190,20 @@ class MessagePort extends EventTarget {
this[_id] = null;
}
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(MessagePortPrototype, this),
+ keys: [
+ "onmessage",
+ "onmessageerror",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
defineEventHandler(MessagePort.prototype, "message", function (self) {
diff --git a/ext/web/14_compression.js b/ext/web/14_compression.js
index 1b6dd4964..0563861c2 100644
--- a/ext/web/14_compression.js
+++ b/ext/web/14_compression.js
@@ -9,9 +9,12 @@ const core = globalThis.Deno.core;
const ops = core.ops;
const primordials = globalThis.__bootstrap.primordials;
const {
+ SymbolFor,
+ ObjectPrototypeIsPrototypeOf,
TypedArrayPrototypeGetByteLength,
} = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import { TransformStream } from "ext:deno_web/06_streams.js";
webidl.converters.CompressionFormat = webidl.createEnumConverter(
@@ -60,6 +63,23 @@ class CompressionStream {
webidl.assertBranded(this, CompressionStreamPrototype);
return this.#transform.writable;
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ CompressionStreamPrototype,
+ this,
+ ),
+ keys: [
+ "readable",
+ "writable",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
webidl.configureInterface(CompressionStream);
@@ -102,6 +122,23 @@ class DecompressionStream {
webidl.assertBranded(this, DecompressionStreamPrototype);
return this.#transform.writable;
}
+
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ DecompressionStreamPrototype,
+ this,
+ ),
+ keys: [
+ "readable",
+ "writable",
+ ],
+ }),
+ inspectOptions,
+ );
+ }
}
function maybeEnqueue(controller, output) {
diff --git a/ext/web/15_performance.js b/ext/web/15_performance.js
index 9ec2cd376..4527ff00c 100644
--- a/ext/web/15_performance.js
+++ b/ext/web/15_performance.js
@@ -22,7 +22,6 @@ import { opNow } from "ext:deno_web/02_timers.js";
import DOMException from "ext:deno_web/01_dom_exception.js";
const illegalConstructorKey = Symbol("illegalConstructorKey");
-const customInspect = SymbolFor("Deno.customInspect");
let performanceEntries = [];
let timeOrigin;
@@ -196,20 +195,23 @@ class PerformanceEntry {
};
}
- [customInspect](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- PerformanceEntryPrototype,
- this,
- ),
- keys: [
- "name",
- "entryType",
- "startTime",
- "duration",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ PerformanceEntryPrototype,
+ this,
+ ),
+ keys: [
+ "name",
+ "entryType",
+ "startTime",
+ "duration",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
webidl.configureInterface(PerformanceEntry);
@@ -265,18 +267,21 @@ class PerformanceMark extends PerformanceEntry {
};
}
- [customInspect](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(PerformanceMarkPrototype, this),
- keys: [
- "name",
- "entryType",
- "startTime",
- "duration",
- "detail",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(PerformanceMarkPrototype, this),
+ keys: [
+ "name",
+ "entryType",
+ "startTime",
+ "duration",
+ "detail",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
webidl.configureInterface(PerformanceMark);
@@ -321,21 +326,24 @@ class PerformanceMeasure extends PerformanceEntry {
};
}
- [customInspect](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(
- PerformanceMeasurePrototype,
- this,
- ),
- keys: [
- "name",
- "entryType",
- "startTime",
- "duration",
- "detail",
- ],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(
+ PerformanceMeasurePrototype,
+ this,
+ ),
+ keys: [
+ "name",
+ "entryType",
+ "startTime",
+ "duration",
+ "detail",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
webidl.configureInterface(PerformanceMeasure);
@@ -569,12 +577,15 @@ class Performance extends EventTarget {
};
}
- [customInspect](inspect) {
- return inspect(createFilteredInspectProxy({
- object: this,
- evaluate: ObjectPrototypeIsPrototypeOf(PerformancePrototype, this),
- keys: [],
- }));
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(PerformancePrototype, this),
+ keys: ["timeOrigin"],
+ }),
+ inspectOptions,
+ );
}
}
webidl.configureInterface(Performance);
diff --git a/ext/websocket/01_websocket.js b/ext/websocket/01_websocket.js
index 752ff93bd..a4e6b71a3 100644
--- a/ext/websocket/01_websocket.js
+++ b/ext/websocket/01_websocket.js
@@ -5,6 +5,7 @@
const core = globalThis.Deno.core;
import { URL } from "ext:deno_url/00_url.js";
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import { HTTP_TOKEN_CODE_POINT_RE } from "ext:deno_web/00_infra.js";
import DOMException from "ext:deno_web/01_dom_exception.js";
import {
@@ -536,17 +537,26 @@ class WebSocket extends EventTarget {
}
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- url: this.url,
- readyState: this.readyState,
- extensions: this.extensions,
- protocol: this.protocol,
- binaryType: this.binaryType,
- bufferedAmount: this.bufferedAmount,
- })
- }`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(WebSocketPrototype, this),
+ keys: [
+ "url",
+ "readyState",
+ "extensions",
+ "protocol",
+ "binaryType",
+ "bufferedAmount",
+ "onmessage",
+ "onerror",
+ "onclose",
+ "onopen",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
diff --git a/ext/websocket/02_websocketstream.js b/ext/websocket/02_websocketstream.js
index d4c960338..ff24a72af 100644
--- a/ext/websocket/02_websocketstream.js
+++ b/ext/websocket/02_websocketstream.js
@@ -5,6 +5,7 @@
const core = globalThis.Deno.core;
const ops = core.ops;
import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
import { Deferred, writableStreamClose } from "ext:deno_web/06_streams.js";
import DOMException from "ext:deno_web/01_dom_exception.js";
import { add, remove } from "ext:deno_web/03_abort_signal.js";
@@ -423,12 +424,19 @@ class WebSocketStream {
}
}
- [SymbolFor("Deno.customInspect")](inspect) {
- return `${this.constructor.name} ${
- inspect({
- url: this.url,
- })
- }`;
+ [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
+ return inspect(
+ createFilteredInspectProxy({
+ object: this,
+ evaluate: ObjectPrototypeIsPrototypeOf(WebSocketStreamPrototype, this),
+ keys: [
+ "closed",
+ "opened",
+ "url",
+ ],
+ }),
+ inspectOptions,
+ );
}
}
diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js
index 59abab1bf..4e7c77aa0 100644
--- a/ext/webstorage/01_webstorage.js
+++ b/ext/webstorage/01_webstorage.js
@@ -147,12 +147,15 @@ function createStorage(persistent) {
},
});
- proxy[SymbolFor("Deno.customInspect")] = function (inspect) {
+ storage[SymbolFor("Deno.privateCustomInspect")] = function (
+ inspect,
+ inspectOptions,
+ ) {
return `${this.constructor.name} ${
inspect({
- length: this.length,
...ObjectFromEntries(ObjectEntries(proxy)),
- })
+ length: this.length,
+ }, inspectOptions)
}`;
};