1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix: remove inspect proxy abstraction

This commit is contained in:
Marvin Hagemeister 2024-08-16 13:34:09 +02:00
parent 0c26d9b638
commit 71ab7d44c5
28 changed files with 405 additions and 1030 deletions

View file

@ -13,14 +13,13 @@ const {
ArrayPrototypeIndexOf, ArrayPrototypeIndexOf,
ArrayPrototypePush, ArrayPrototypePush,
ArrayPrototypeSplice, ArrayPrototypeSplice,
ObjectPrototypeIsPrototypeOf,
Symbol, Symbol,
SymbolFor, SymbolFor,
Uint8Array, Uint8Array,
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { import {
defineEventHandler, defineEventHandler,
EventTarget, EventTarget,
@ -143,18 +142,7 @@ class BroadcastChannel extends EventTarget {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["canvas"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(BroadcastChannelPrototype, this),
keys: [
"name",
"onmessage",
"onmessageerror",
],
}),
inspectOptions,
);
} }
} }

View file

@ -4,7 +4,7 @@ import { internals, primordials } from "ext:core/mod.js";
import { op_image_decode_png, op_image_process } from "ext:core/ops"; import { op_image_decode_png, op_image_process } from "ext:core/ops";
import * as webidl from "ext:deno_webidl/00_webidl.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"; import { privateInspect } from "ext:deno_console/01_console.js";
import { BlobPrototype } from "ext:deno_web/09_file.js"; import { BlobPrototype } from "ext:deno_web/09_file.js";
import { sniffImage } from "ext:deno_web/01_mimesniff.js"; import { sniffImage } from "ext:deno_web/01_mimesniff.js";
const { const {
@ -140,17 +140,7 @@ class ImageBitmap {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["width", "height"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(ImageBitmapPrototype, this),
keys: [
"width",
"height",
],
}),
inspectOptions,
);
} }
} }
const ImageBitmapPrototype = ImageBitmap.prototype; const ImageBitmapPrototype = ImageBitmap.prototype;

View file

@ -102,10 +102,7 @@ const {
ObjectPrototypePropertyIsEnumerable, ObjectPrototypePropertyIsEnumerable,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
ObjectValues, ObjectValues,
Proxy,
ReflectGet, ReflectGet,
ReflectGetOwnPropertyDescriptor,
ReflectGetPrototypeOf,
ReflectHas, ReflectHas,
ReflectOwnKeys, ReflectOwnKeys,
RegExpPrototypeExec, RegExpPrototypeExec,
@ -471,7 +468,7 @@ function formatValue(
// inspect implementations in `extensions` need it, but may not have access // inspect implementations in `extensions` need it, but may not have access
// to the `Deno` namespace in web workers. Remove when the `Deno` // to the `Deno` namespace in web workers. Remove when the `Deno`
// namespace is always enabled. // namespace is always enabled.
return String(value[privateCustomInspect](inspect, ctx)); return String(value[privateCustomInspect].call(value, inspect, ctx));
} else if (ReflectHas(value, nodeCustomInspectSymbol)) { } else if (ReflectHas(value, nodeCustomInspectSymbol)) {
const maybeCustom = value[nodeCustomInspectSymbol]; const maybeCustom = value[nodeCustomInspectSymbol];
if ( if (
@ -3449,67 +3446,24 @@ function inspect(
return formatValue(ctx, value, 0); return formatValue(ctx, value, 0);
} }
class FilteredProxy extends Proxy { /**
privateCustomInspectProxy; * Print a serialized version of the passed object with only the
} * keys specified. This is used in `Deno.privateCustomInspect()`
* @template T
/** Creates a proxy that represents a subset of the properties * @param {T} obj
* of the original object optionally without evaluating the properties * @param {keyof T} keys
* in order to get the values. */ * @param {typeof inspect} inspect
function createFilteredInspectProxy({ object, keys, evaluate }) { * @param {*} inspectOptions
const obj = class {}; * @returns {string}
if (object.constructor?.name) { */
ObjectDefineProperty(obj, "name", { value: object.constructor.name }); function privateInspect(obj, keys, inspect, inspectOptions) {
const value = {};
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
value[key] = ReflectGet(obj, key);
} }
return new Proxy(new obj(), { return `${obj.constructor.name} ${inspect(value, inspectOptions)}`;
get(_target, key) {
if (key === SymbolToStringTag) {
return object.constructor?.name;
} else if (key === privateCustomInspectProxy) {
return true;
} else if (ArrayPrototypeIncludes(keys, key)) {
return ReflectGet(object, key);
} else {
return undefined;
}
},
getOwnPropertyDescriptor(_target, key) {
if (!ArrayPrototypeIncludes(keys, key)) {
return undefined;
} else if (evaluate) {
return getEvaluatedDescriptor(object, key);
} else {
return getDescendantPropertyDescriptor(object, key) ??
getEvaluatedDescriptor(object, key);
}
},
has(_target, key) {
return ArrayPrototypeIncludes(keys, key);
},
ownKeys() {
return keys;
},
});
function getDescendantPropertyDescriptor(object, key) {
let propertyDescriptor = ReflectGetOwnPropertyDescriptor(object, key);
if (!propertyDescriptor) {
const prototype = ReflectGetPrototypeOf(object);
if (prototype) {
propertyDescriptor = getDescendantPropertyDescriptor(prototype, key);
}
}
return propertyDescriptor;
}
function getEvaluatedDescriptor(object, key) {
return {
configurable: true,
enumerable: true,
value: object[key],
};
}
} }
// Expose these fields to internalObject for tests. // Expose these fields to internalObject for tests.
@ -3522,7 +3476,6 @@ internals.parseCssColor = parseCssColor;
export { export {
colors, colors,
Console, Console,
createFilteredInspectProxy,
createStylizeWithColor, createStylizeWithColor,
CSI, CSI,
customInspect, customInspect,
@ -3534,6 +3487,7 @@ export {
getStdoutNoColor, getStdoutNoColor,
inspect, inspect,
inspectArgs, inspectArgs,
privateInspect,
quoteString, quoteString,
setNoColorFns, setNoColorFns,
styles, styles,

View file

@ -81,8 +81,8 @@ const {
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; 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"; import { DOMException } from "ext:deno_web/01_dom_exception.js";
import { privateInspect } from "ext:deno_console/01_console.js";
const supportedNamedCurves = ["P-256", "P-384", "P-521"]; const supportedNamedCurves = ["P-256", "P-384", "P-521"];
const recognisedUsages = [ const recognisedUsages = [
@ -380,17 +380,10 @@ class CryptoKey {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["type", "extractable", "algorithm", "usages"],
evaluate: ObjectPrototypeIsPrototypeOf(CryptoKeyPrototype, this), inspect,
keys: [
"type",
"extractable",
"algorithm",
"usages",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -4757,14 +4750,7 @@ class Crypto {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["subtle"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(CryptoPrototype, this),
keys: ["subtle"],
}),
inspectOptions,
);
} }
} }

View file

@ -25,7 +25,7 @@ const {
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { import {
byteUpperCase, byteUpperCase,
HTTP_TOKEN_CODE_POINT_RE, HTTP_TOKEN_CODE_POINT_RE,
@ -511,18 +511,10 @@ class Request {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["bodyUsed", "headers", "method", "redirect", "url"],
evaluate: ObjectPrototypeIsPrototypeOf(RequestPrototype, this), inspect,
keys: [
"bodyUsed",
"headers",
"method",
"redirect",
"url",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -12,7 +12,7 @@
import { core, primordials } from "ext:core/mod.js"; import { core, primordials } from "ext:core/mod.js";
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { import {
byteLowerCase, byteLowerCase,
HTTP_TAB_OR_SPACE, HTTP_TAB_OR_SPACE,
@ -34,7 +34,6 @@ const {
ArrayPrototypeMap, ArrayPrototypeMap,
ArrayPrototypePush, ArrayPrototypePush,
ObjectDefineProperties, ObjectDefineProperties,
ObjectPrototypeIsPrototypeOf,
RangeError, RangeError,
RegExpPrototypeExec, RegExpPrototypeExec,
SafeArrayIterator, SafeArrayIterator,
@ -408,21 +407,19 @@ class Response {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(ResponsePrototype, this), "body",
keys: [ "bodyUsed",
"body", "headers",
"bodyUsed", "ok",
"headers", "redirected",
"ok", "status",
"redirected", "statusText",
"status", "url",
"statusText", ],
"url", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -10,7 +10,6 @@ const {
NumberIsFinite, NumberIsFinite,
NumberIsNaN, NumberIsNaN,
ObjectDefineProperties, ObjectDefineProperties,
ObjectPrototypeIsPrototypeOf,
StringPrototypeEndsWith, StringPrototypeEndsWith,
StringPrototypeIncludes, StringPrototypeIncludes,
StringPrototypeIndexOf, StringPrototypeIndexOf,
@ -21,7 +20,7 @@ const {
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { URL } from "ext:deno_url/00_url.js"; 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 { import {
@ -333,19 +332,17 @@ class EventSource extends EventTarget {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(EventSourcePrototype, this), "readyState",
keys: [ "url",
"readyState", "withCredentials",
"url", "onopen",
"withCredentials", "onmessage",
"onopen", "onerror",
"onmessage", ],
"onerror", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -22,7 +22,6 @@ const {
ArrayPrototypeSort, ArrayPrototypeSort,
ArrayPrototypeSplice, ArrayPrototypeSplice,
ObjectKeys, ObjectKeys,
ObjectPrototypeIsPrototypeOf,
SafeArrayIterator, SafeArrayIterator,
StringPrototypeSlice, StringPrototypeSlice,
StringPrototypeStartsWith, StringPrototypeStartsWith,
@ -34,7 +33,7 @@ const {
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
const _list = Symbol("list"); const _list = Symbol("list");
const _urlObject = Symbol("url object"); const _urlObject = Symbol("url object");
@ -459,24 +458,22 @@ class URL {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(URLPrototype, this), "href",
keys: [ "origin",
"href", "protocol",
"origin", "username",
"protocol", "password",
"username", "host",
"password", "hostname",
"host", "port",
"hostname", "pathname",
"port", "hash",
"pathname", "search",
"hash", ],
"search", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -17,7 +17,6 @@ const {
MathRandom, MathRandom,
ObjectAssign, ObjectAssign,
ObjectCreate, ObjectCreate,
ObjectPrototypeIsPrototypeOf,
RegExpPrototypeExec, RegExpPrototypeExec,
RegExpPrototypeTest, RegExpPrototypeTest,
SafeMap, SafeMap,
@ -28,7 +27,7 @@ const {
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
const _components = Symbol("components"); const _components = Symbol("components");
@ -368,22 +367,20 @@ class URLPattern {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(URLPatternPrototype, this), "protocol",
keys: [ "username",
"protocol", "password",
"username", "hostname",
"password", "port",
"hostname", "pathname",
"port", "search",
"pathname", "hash",
"search", "hasRegExpGroups",
"hash", ],
"hasRegExpGroups", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -15,14 +15,13 @@ const {
ObjectCreate, ObjectCreate,
ObjectEntries, ObjectEntries,
ObjectHasOwn, ObjectHasOwn,
ObjectPrototypeIsPrototypeOf,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
Symbol, Symbol,
SymbolFor, SymbolFor,
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
const _name = Symbol("name"); const _name = Symbol("name");
const _message = Symbol("message"); const _message = Symbol("message");
@ -137,16 +136,10 @@ class DOMException {
return stack; return stack;
} }
} }
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["message", "name", "code"],
evaluate: ObjectPrototypeIsPrototypeOf(DOMExceptionPrototype, this), inspect,
keys: [
"message",
"name",
"code",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -36,7 +36,7 @@ const {
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { DOMException } from "./01_dom_exception.js"; import { DOMException } from "./01_dom_exception.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
// This should be set via setGlobalThis this is required so that if even // This should be set via setGlobalThis this is required so that if even
// user deletes globalThis it is still usable // user deletes globalThis it is still usable
@ -158,14 +158,7 @@ class Event {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, EVENT_PROPS, inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(EventPrototype, this),
keys: EVENT_PROPS,
}),
inspectOptions,
);
} }
get type() { get type() {
@ -387,8 +380,6 @@ class Event {
} }
} }
const EventPrototype = Event.prototype;
// Not spec compliant. The spec defines it as [LegacyUnforgeable] // Not spec compliant. The spec defines it as [LegacyUnforgeable]
// but doing so has a big performance hit // but doing so has a big performance hit
ReflectDefineProperty(Event.prototype, "isTrusted", { ReflectDefineProperty(Event.prototype, "isTrusted", {
@ -1111,19 +1102,17 @@ class ErrorEvent extends Event {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(ErrorEventPrototype, this), ...new SafeArrayIterator(EVENT_PROPS),
keys: [ "message",
...new SafeArrayIterator(EVENT_PROPS), "filename",
"message", "lineno",
"filename", "colno",
"lineno", "error",
"colno", ],
"error", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -1177,24 +1166,20 @@ class CloseEvent extends Event {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(CloseEventPrototype, this), ...new SafeArrayIterator(EVENT_PROPS),
keys: [ "wasClean",
...new SafeArrayIterator(EVENT_PROPS), "code",
"wasClean", "reason",
"code", ],
"reason", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
} }
const CloseEventPrototype = CloseEvent.prototype;
class MessageEvent extends Event { class MessageEvent extends Event {
get source() { get source() {
return null; return null;
@ -1214,17 +1199,15 @@ class MessageEvent extends Event {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(MessageEventPrototype, this), ...new SafeArrayIterator(EVENT_PROPS),
keys: [ "data",
...new SafeArrayIterator(EVENT_PROPS), "origin",
"data", "lastEventId",
"origin", ],
"lastEventId", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -1233,8 +1216,6 @@ class MessageEvent extends Event {
[SymbolToStringTag] = "MessageEvent"; [SymbolToStringTag] = "MessageEvent";
} }
const MessageEventPrototype = MessageEvent.prototype;
class CustomEvent extends Event { class CustomEvent extends Event {
#detail = null; #detail = null;
@ -1254,15 +1235,13 @@ class CustomEvent extends Event {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(CustomEventPrototype, this), ...new SafeArrayIterator(EVENT_PROPS),
keys: [ "detail",
...new SafeArrayIterator(EVENT_PROPS), ],
"detail", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -1271,8 +1250,6 @@ class CustomEvent extends Event {
[SymbolToStringTag] = "CustomEvent"; [SymbolToStringTag] = "CustomEvent";
} }
const CustomEventPrototype = CustomEvent.prototype;
ReflectDefineProperty(CustomEvent.prototype, "detail", { ReflectDefineProperty(CustomEvent.prototype, "detail", {
enumerable: true, enumerable: true,
}); });
@ -1289,17 +1266,15 @@ class ProgressEvent extends Event {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(ProgressEventPrototype, this), ...new SafeArrayIterator(EVENT_PROPS),
keys: [ "lengthComputable",
...new SafeArrayIterator(EVENT_PROPS), "loaded",
"lengthComputable", "total",
"loaded", ],
"total", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -1308,8 +1283,6 @@ class ProgressEvent extends Event {
[SymbolToStringTag] = "ProgressEvent"; [SymbolToStringTag] = "ProgressEvent";
} }
const ProgressEventPrototype = ProgressEvent.prototype;
class PromiseRejectionEvent extends Event { class PromiseRejectionEvent extends Event {
#promise = null; #promise = null;
#reason = null; #reason = null;
@ -1342,19 +1315,14 @@ class PromiseRejectionEvent extends Event {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf( ...new SafeArrayIterator(EVENT_PROPS),
PromiseRejectionEventPrototype, "promise",
this, "reason",
), ],
keys: [ inspect,
...new SafeArrayIterator(EVENT_PROPS),
"promise",
"reason",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -1363,8 +1331,6 @@ class PromiseRejectionEvent extends Event {
[SymbolToStringTag] = "PromiseRejectionEvent"; [SymbolToStringTag] = "PromiseRejectionEvent";
} }
const PromiseRejectionEventPrototype = PromiseRejectionEvent.prototype;
defineEnumerableProps(PromiseRejectionEvent, [ defineEnumerableProps(PromiseRejectionEvent, [
"promise", "promise",
"reason", "reason",

View file

@ -8,7 +8,6 @@ const {
ArrayPrototypeEvery, ArrayPrototypeEvery,
ArrayPrototypePush, ArrayPrototypePush,
FunctionPrototypeApply, FunctionPrototypeApply,
ObjectPrototypeIsPrototypeOf,
SafeSet, SafeSet,
SafeSetIterator, SafeSetIterator,
SafeWeakRef, SafeWeakRef,
@ -25,7 +24,7 @@ const {
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { assert } from "./00_infra.js"; import { assert } from "./00_infra.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { import {
defineEventHandler, defineEventHandler,
Event, Event,
@ -250,16 +249,10 @@ class AbortSignal extends EventTarget {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["aborted", "reason", "onabort"],
evaluate: ObjectPrototypeIsPrototypeOf(AbortSignalPrototype, this), inspect,
keys: [
"aborted",
"reason",
"onabort",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -287,16 +280,7 @@ class AbortController {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["signal"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(AbortControllerPrototype, this),
keys: [
"signal",
],
}),
inspectOptions,
);
} }
} }

View file

@ -99,7 +99,7 @@ import {
signalAbort, signalAbort,
} from "./03_abort_signal.js"; } from "./03_abort_signal.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { assert, AssertionError } from "./00_infra.js"; import { assert, AssertionError } from "./00_infra.js";
/** @template T */ /** @template T */
@ -4993,18 +4993,10 @@ class ByteLengthQueuingStrategy {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["highWaterMark", "size"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
ByteLengthQueuingStrategyPrototype,
this,
),
keys: [
"highWaterMark",
"size",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -5050,18 +5042,10 @@ class CountQueuingStrategy {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["highWaterMark", "size"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
CountQueuingStrategyPrototype,
this,
),
keys: [
"highWaterMark",
"size",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -5365,17 +5349,7 @@ class ReadableStream {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["locked"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
ReadableStreamPrototype,
this,
),
keys: ["locked"],
}),
inspectOptions,
);
} }
} }
@ -5487,17 +5461,7 @@ class ReadableStreamDefaultReader {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["closed"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
ReadableStreamDefaultReaderPrototype,
this,
),
keys: ["closed"],
}),
inspectOptions,
);
} }
} }
@ -5657,17 +5621,7 @@ class ReadableStreamBYOBReader {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["closed"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
ReadableStreamBYOBReaderPrototype,
this,
),
keys: ["closed"],
}),
inspectOptions,
);
} }
} }
@ -5883,17 +5837,7 @@ class ReadableByteStreamController {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["desiredSize"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
ReadableByteStreamControllerPrototype,
this,
),
keys: ["desiredSize"],
}),
inspectOptions,
);
} }
/** /**
@ -6037,17 +5981,7 @@ class ReadableStreamDefaultController {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["desiredSize"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
ReadableStreamDefaultControllerPrototype,
this,
),
keys: ["desiredSize"],
}),
inspectOptions,
);
} }
/** /**
@ -6199,15 +6133,10 @@ class TransformStream {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["readable", "writable"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
TransformStreamPrototype,
this,
),
keys: ["readable", "writable"],
}),
inspectOptions, inspectOptions,
); );
} }
@ -6276,17 +6205,7 @@ class TransformStreamDefaultController {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["desiredSize"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
TransformStreamDefaultControllerPrototype,
this,
),
keys: ["desiredSize"],
}),
inspectOptions,
);
} }
} }
@ -6427,17 +6346,7 @@ class WritableStream {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["locked"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
WritableStreamPrototype,
this,
),
keys: ["locked"],
}),
inspectOptions,
);
} }
} }
@ -6572,19 +6481,10 @@ class WritableStreamDefaultWriter {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["closed", "desiredSize", "ready"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
WritableStreamDefaultWriterPrototype,
this,
),
keys: [
"closed",
"desiredSize",
"ready",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -6646,17 +6546,7 @@ class WritableStreamDefaultController {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["signal"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
WritableStreamDefaultControllerPrototype,
this,
),
keys: ["signal"],
}),
inspectOptions,
);
} }
/** /**

View file

@ -27,7 +27,6 @@ const {
DataViewPrototypeGetBuffer, DataViewPrototypeGetBuffer,
DataViewPrototypeGetByteLength, DataViewPrototypeGetByteLength,
DataViewPrototypeGetByteOffset, DataViewPrototypeGetByteOffset,
ObjectPrototypeIsPrototypeOf,
PromiseReject, PromiseReject,
PromiseResolve, PromiseResolve,
// TODO(lucacasonato): add SharedArrayBuffer to primordials // TODO(lucacasonato): add SharedArrayBuffer to primordials
@ -44,7 +43,7 @@ const {
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
class TextDecoder { class TextDecoder {
/** @type {string} */ /** @type {string} */
@ -189,16 +188,10 @@ class TextDecoder {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["encoding", "fatal", "ignoreBOM"],
evaluate: ObjectPrototypeIsPrototypeOf(TextDecoderPrototype, this), inspect,
keys: [
"encoding",
"fatal",
"ignoreBOM",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -261,14 +254,7 @@ class TextEncoder {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["encoding"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(TextEncoderPrototype, this),
keys: ["encoding"],
}),
inspectOptions,
);
} }
} }
@ -367,21 +353,10 @@ class TextDecoderStream {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["encoding", "fatal", "ignoreBOM", "readable", "writable"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
TextDecoderStreamPrototype,
this,
),
keys: [
"encoding",
"fatal",
"ignoreBOM",
"readable",
"writable",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -460,19 +435,10 @@ class TextEncoderStream {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["encoding", "readbale", "writable"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
TextEncoderStreamPrototype,
this,
),
keys: [
"encoding",
"readable",
"writable",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -59,7 +59,7 @@ const {
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { ReadableStream } from "./06_streams.js"; import { ReadableStream } from "./06_streams.js";
import { URL } from "ext:deno_url/00_url.js"; import { URL } from "ext:deno_url/00_url.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
// TODO(lucacasonato): this needs to not be hardcoded and instead depend on // TODO(lucacasonato): this needs to not be hardcoded and instead depend on
// host os. // host os.
@ -435,17 +435,10 @@ class Blob {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( // return privateInspect(this, ["size", "type"], inspect, inspectOptions);
createFilteredInspectProxy({ const { size, type } = this;
object: this, const value = { size, type };
evaluate: ObjectPrototypeIsPrototypeOf(BlobPrototype, this), return `${this.constructor.name} ${inspect(value, inspectOptions)}`;
keys: [
"size",
"type",
],
}),
inspectOptions,
);
} }
} }
@ -554,16 +547,10 @@ class File extends Blob {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["name", "size", "type"],
evaluate: ObjectPrototypeIsPrototypeOf(FilePrototype, this), inspect,
keys: [
"name",
"size",
"type",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -19,7 +19,6 @@ const {
MapPrototypeGet, MapPrototypeGet,
MapPrototypeSet, MapPrototypeSet,
ObjectDefineProperty, ObjectDefineProperty,
ObjectPrototypeIsPrototypeOf,
queueMicrotask, queueMicrotask,
SafeArrayIterator, SafeArrayIterator,
SafeMap, SafeMap,
@ -34,7 +33,7 @@ const {
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { forgivingBase64Encode } from "./00_infra.js"; import { forgivingBase64Encode } from "./00_infra.js";
import { EventTarget, ProgressEvent } from "./02_event.js"; import { EventTarget, ProgressEvent } from "./02_event.js";
import { decode, TextDecoder } from "./08_text_encoding.js"; import { decode, TextDecoder } from "./08_text_encoding.js";
@ -435,16 +434,10 @@ class FileReader extends EventTarget {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["error", "readyState", "result"],
evaluate: ObjectPrototypeIsPrototypeOf(FileReaderPrototype, this), inspect,
keys: [
"error",
"readyState",
"result",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -30,7 +30,7 @@ const {
isArrayBuffer, isArrayBuffer,
} = core; } = core;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { import {
defineEventHandler, defineEventHandler,
EventTarget, EventTarget,
@ -69,17 +69,7 @@ class MessageChannel {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["port1", "port2"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(MessageChannelPrototype, this),
keys: [
"port1",
"port2",
],
}),
inspectOptions,
);
} }
} }
@ -277,15 +267,10 @@ class MessagePort extends EventTarget {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspectSerialize(
createFilteredInspectProxy({ this,
object: this, ["onmessage", "onmessageerror"],
evaluate: ObjectPrototypeIsPrototypeOf(MessagePortPrototype, this), inspect,
keys: [
"onmessage",
"onmessageerror",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -13,12 +13,11 @@ import {
} from "ext:core/ops"; } from "ext:core/ops";
const { const {
SymbolFor, SymbolFor,
ObjectPrototypeIsPrototypeOf,
TypedArrayPrototypeGetByteLength, TypedArrayPrototypeGetByteLength,
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { TransformStream } from "./06_streams.js"; import { TransformStream } from "./06_streams.js";
webidl.converters.CompressionFormat = webidl.createEnumConverter( webidl.converters.CompressionFormat = webidl.createEnumConverter(
@ -72,18 +71,10 @@ class CompressionStream {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["readable", "writable"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
CompressionStreamPrototype,
this,
),
keys: [
"readable",
"writable",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -134,18 +125,10 @@ class DecompressionStream {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["readable", "writable"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
DecompressionStreamPrototype,
this,
),
keys: [
"readable",
"writable",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -8,7 +8,6 @@ const {
ArrayPrototypeReverse, ArrayPrototypeReverse,
ArrayPrototypeSlice, ArrayPrototypeSlice,
ObjectKeys, ObjectKeys,
ObjectPrototypeIsPrototypeOf,
ReflectHas, ReflectHas,
Symbol, Symbol,
SymbolFor, SymbolFor,
@ -17,7 +16,7 @@ const {
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { structuredClone } from "./02_structured_clone.js"; import { structuredClone } from "./02_structured_clone.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { EventTarget } from "./02_event.js"; import { EventTarget } from "./02_event.js";
import { opNow } from "./02_timers.js"; import { opNow } from "./02_timers.js";
import { DOMException } from "./01_dom_exception.js"; import { DOMException } from "./01_dom_exception.js";
@ -197,20 +196,10 @@ class PerformanceEntry {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["name", "entryType", "startTime", "duration"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
PerformanceEntryPrototype,
this,
),
keys: [
"name",
"entryType",
"startTime",
"duration",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -269,18 +258,10 @@ class PerformanceMark extends PerformanceEntry {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["name", "entryType", "startTime", "duration", "detail"],
evaluate: ObjectPrototypeIsPrototypeOf(PerformanceMarkPrototype, this), inspect,
keys: [
"name",
"entryType",
"startTime",
"duration",
"detail",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -328,21 +309,10 @@ class PerformanceMeasure extends PerformanceEntry {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["entryType", "startTime", "duration", "detail"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
PerformanceMeasurePrototype,
this,
),
keys: [
"name",
"entryType",
"startTime",
"duration",
"detail",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -579,14 +549,7 @@ class Performance extends EventTarget {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["timeOrigin"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(PerformancePrototype, this),
keys: ["timeOrigin"],
}),
inspectOptions,
);
} }
} }
webidl.configureInterface(Performance); webidl.configureInterface(Performance);

View file

@ -3,9 +3,8 @@
import { primordials } from "ext:core/mod.js"; import { primordials } from "ext:core/mod.js";
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { DOMException } from "./01_dom_exception.js"; import { DOMException } from "./01_dom_exception.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
const { const {
ObjectPrototypeIsPrototypeOf,
Symbol, Symbol,
SymbolFor, SymbolFor,
TypedArrayPrototypeGetLength, TypedArrayPrototypeGetLength,
@ -198,17 +197,10 @@ class ImageData {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["data", "width", "height", "colorSpace"],
evaluate: ObjectPrototypeIsPrototypeOf(ImageDataPrototype, this), inspect,
keys: [
"data",
"width",
"height",
"colorSpace",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -127,7 +127,7 @@ import {
setEventTargetData, setEventTargetData,
} from "ext:deno_web/02_event.js"; } from "ext:deno_web/02_event.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"; import { privateInspect } from "ext:deno_console/01_console.js";
const _rid = Symbol("[[rid]]"); const _rid = Symbol("[[rid]]");
const _size = Symbol("[[size]]"); const _size = Symbol("[[size]]");
@ -391,7 +391,7 @@ class GPU {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return `${this.constructor.name} ${inspect({}, inspectOptions)}`; return privateInspect(this, [], inspect, inspectOptions);
} }
} }
const GPUPrototype = GPU.prototype; const GPUPrototype = GPU.prototype;
@ -539,17 +539,15 @@ class GPUAdapter {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(GPUAdapterPrototype, this), "features",
keys: [ "limits",
"features", "info",
"limits", "isFallbackAdapter",
"info", ],
"isFallbackAdapter", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -590,17 +588,15 @@ class GPUAdapterInfo {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(GPUAdapterInfoPrototype, this), "vendor",
keys: [ "architecture",
"vendor", "device",
"architecture", "description",
"device", ],
"description", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -773,46 +769,41 @@ class GPUSupportedLimits {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf( "maxTextureDimension1D",
GPUSupportedLimitsPrototype, "maxTextureDimension2D",
this, "maxTextureDimension3D",
), "maxTextureArrayLayers",
keys: [ "maxBindGroups",
"maxTextureDimension1D", "maxBindingsPerBindGroup",
"maxTextureDimension2D", "maxBufferSize",
"maxTextureDimension3D", "maxDynamicUniformBuffersPerPipelineLayout",
"maxTextureArrayLayers", "maxDynamicStorageBuffersPerPipelineLayout",
"maxBindGroups", "maxSampledTexturesPerShaderStage",
"maxBindingsPerBindGroup", "maxSamplersPerShaderStage",
"maxBufferSize", "maxStorageBuffersPerShaderStage",
"maxDynamicUniformBuffersPerPipelineLayout", "maxStorageTexturesPerShaderStage",
"maxDynamicStorageBuffersPerPipelineLayout", "maxUniformBuffersPerShaderStage",
"maxSampledTexturesPerShaderStage", "maxUniformBufferBindingSize",
"maxSamplersPerShaderStage", "maxStorageBufferBindingSize",
"maxStorageBuffersPerShaderStage", "minUniformBufferOffsetAlignment",
"maxStorageTexturesPerShaderStage", "minStorageBufferOffsetAlignment",
"maxUniformBuffersPerShaderStage", "maxVertexBuffers",
"maxUniformBufferBindingSize", "maxVertexAttributes",
"maxStorageBufferBindingSize", "maxVertexBufferArrayStride",
"minUniformBufferOffsetAlignment", "maxInterStageShaderComponents",
"minStorageBufferOffsetAlignment", "maxColorAttachments",
"maxVertexBuffers", "maxColorAttachmentBytesPerSample",
"maxVertexAttributes", "maxComputeWorkgroupStorageSize",
"maxVertexBufferArrayStride", "maxComputeInvocationsPerWorkgroup",
"maxInterStageShaderComponents", "maxComputeWorkgroupSizeX",
"maxColorAttachments", "maxComputeWorkgroupSizeY",
"maxColorAttachmentBytesPerSample", "maxComputeWorkgroupSizeZ",
"maxComputeWorkgroupStorageSize", "maxComputeWorkgroupsPerDimension",
"maxComputeInvocationsPerWorkgroup", ],
"maxComputeWorkgroupSizeX", inspect,
"maxComputeWorkgroupSizeY",
"maxComputeWorkgroupSizeZ",
"maxComputeWorkgroupsPerDimension",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -881,18 +872,10 @@ class GPUDeviceLostInfo {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["reason", "message"],
evaluate: ObjectPrototypeIsPrototypeOf( inspect,
GPUDeviceLostInfoPrototype,
this,
),
keys: [
"reason",
"message",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -1831,20 +1814,18 @@ class GPUDevice extends EventTarget {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(GPUDevicePrototype, this), "features",
keys: [ "label",
"features", "limits",
"label", "lost",
"limits", "queue",
"lost", // TODO(lucacasonato): emit an UncapturedErrorEvent
"queue", // "onuncapturederror"
// TODO(lucacasonato): emit an UncapturedErrorEvent ],
// "onuncapturederror" inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -2062,16 +2043,7 @@ class GPUQueue {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(GPUQueuePrototype, this),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUQueue", GPUQueue); GPUObjectBaseMixin("GPUQueue", GPUQueue);
@ -2373,17 +2345,15 @@ class GPUBuffer {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(GPUBufferPrototype, this), "label",
keys: [ "mapState",
"label", "size",
"mapState", "usage",
"size", ],
"usage", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -2585,22 +2555,20 @@ class GPUTexture {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(GPUTexturePrototype, this), "label",
keys: [ "width",
"label", "height",
"width", "depthOrArrayLayers",
"height", "mipLevelCount",
"depthOrArrayLayers", "sampleCount",
"mipLevelCount", "dimension",
"sampleCount", "format",
"dimension", "usage",
"format", ],
"usage", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -2664,16 +2632,7 @@ class GPUTextureView {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(GPUTextureViewPrototype, this),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUTextureView", GPUTextureView); GPUObjectBaseMixin("GPUTextureView", GPUTextureView);
@ -2755,19 +2714,7 @@ class GPUBindGroupLayout {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
GPUBindGroupLayoutPrototype,
this,
),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUBindGroupLayout", GPUBindGroupLayout); GPUObjectBaseMixin("GPUBindGroupLayout", GPUBindGroupLayout);
@ -2806,23 +2753,10 @@ class GPUPipelineLayout {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
GPUPipelineLayoutPrototype,
this,
),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUPipelineLayout", GPUPipelineLayout); GPUObjectBaseMixin("GPUPipelineLayout", GPUPipelineLayout);
const GPUPipelineLayoutPrototype = GPUPipelineLayout.prototype;
/** /**
* @param {string | null} label * @param {string | null} label
@ -2858,20 +2792,10 @@ class GPUBindGroup {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(GPUBindGroupPrototype, this),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUBindGroup", GPUBindGroup); GPUObjectBaseMixin("GPUBindGroup", GPUBindGroup);
const GPUBindGroupPrototype = GPUBindGroup.prototype;
/** /**
* @param {string | null} label * @param {string | null} label
* @param {InnerGPUDevice} device * @param {InnerGPUDevice} device
@ -2906,16 +2830,7 @@ class GPUShaderModule {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(GPUShaderModulePrototype, this),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUShaderModule", GPUShaderModule); GPUObjectBaseMixin("GPUShaderModule", GPUShaderModule);
@ -3000,19 +2915,7 @@ class GPUComputePipeline {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
GPUComputePipelinePrototype,
this,
),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUComputePipeline", GPUComputePipeline); GPUObjectBaseMixin("GPUComputePipeline", GPUComputePipeline);
@ -3078,19 +2981,7 @@ class GPURenderPipeline {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
GPURenderPipelinePrototype,
this,
),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPURenderPipeline", GPURenderPipeline); GPUObjectBaseMixin("GPURenderPipeline", GPURenderPipeline);
@ -3799,19 +3690,7 @@ class GPUCommandEncoder {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
GPUCommandEncoderPrototype,
this,
),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUCommandEncoder", GPUCommandEncoder); GPUObjectBaseMixin("GPUCommandEncoder", GPUCommandEncoder);
@ -4407,19 +4286,7 @@ class GPURenderPassEncoder {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
GPURenderPassEncoderPrototype,
this,
),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPURenderPassEncoder", GPURenderPassEncoder); GPUObjectBaseMixin("GPURenderPassEncoder", GPURenderPassEncoder);
@ -4683,19 +4550,7 @@ class GPUComputePassEncoder {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
GPUComputePassEncoderPrototype,
this,
),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUComputePassEncoder", GPUComputePassEncoder); GPUObjectBaseMixin("GPUComputePassEncoder", GPUComputePassEncoder);
@ -4736,20 +4591,10 @@ class GPUCommandBuffer {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(GPUCommandBufferPrototype, this),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPUCommandBuffer", GPUCommandBuffer); GPUObjectBaseMixin("GPUCommandBuffer", GPUCommandBuffer);
const GPUCommandBufferPrototype = GPUCommandBuffer.prototype;
/** /**
* @param {string | null} label * @param {string | null} label
@ -5124,19 +4969,7 @@ class GPURenderBundleEncoder {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(
GPURenderBundleEncoderPrototype,
this,
),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPURenderBundleEncoder", GPURenderBundleEncoder); GPUObjectBaseMixin("GPURenderBundleEncoder", GPURenderBundleEncoder);
@ -5177,20 +5010,10 @@ class GPURenderBundle {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["label"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(GPURenderBundlePrototype, this),
keys: [
"label",
],
}),
inspectOptions,
);
} }
} }
GPUObjectBaseMixin("GPURenderBundle", GPURenderBundle); GPUObjectBaseMixin("GPURenderBundle", GPURenderBundle);
const GPURenderBundlePrototype = GPURenderBundle.prototype;
/** /**
* @param {string | null} label * @param {string | null} label
* @param {InnerGPUDevice} device * @param {InnerGPUDevice} device
@ -5248,16 +5071,10 @@ class GPUQuerySet {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["label", "type", "count"],
evaluate: ObjectPrototypeIsPrototypeOf(GPUQuerySetPrototype, this), inspect,
keys: [
"label",
"type",
"count",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -14,14 +14,13 @@ import {
op_webgpu_surface_present, op_webgpu_surface_present,
} from "ext:core/ops"; } from "ext:core/ops";
const { const {
ObjectPrototypeIsPrototypeOf,
Symbol, Symbol,
SymbolFor, SymbolFor,
TypeError, TypeError,
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { loadWebGPU } from "ext:deno_webgpu/00_init.js"; import { loadWebGPU } from "ext:deno_webgpu/00_init.js";
const _surfaceRid = Symbol("[[surfaceRid]]"); const _surfaceRid = Symbol("[[surfaceRid]]");
@ -144,16 +143,7 @@ class GPUCanvasContext {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(this, ["canvas"], inspect, inspectOptions);
createFilteredInspectProxy({
object: this,
evaluate: ObjectPrototypeIsPrototypeOf(GPUCanvasContextPrototype, this),
keys: [
"canvas",
],
}),
inspectOptions,
);
} }
} }
const GPUCanvasContextPrototype = GPUCanvasContext.prototype; const GPUCanvasContextPrototype = GPUCanvasContext.prototype;

View file

@ -1138,6 +1138,13 @@ function assertBranded(self, prototype) {
if ( if (
!ObjectPrototypeIsPrototypeOf(prototype, self) || self[brand] !== brand !ObjectPrototypeIsPrototypeOf(prototype, self) || self[brand] !== brand
) { ) {
console.log(
self.toString(),
prototype.toString(),
self === prototype,
self[brand],
brand.toString(),
);
throw new TypeError("Illegal invocation"); throw new TypeError("Illegal invocation");
} }
} }

View file

@ -47,7 +47,7 @@ const {
import { URL } from "ext:deno_url/00_url.js"; import { URL } from "ext:deno_url/00_url.js";
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { HTTP_TOKEN_CODE_POINT_RE } from "ext:deno_web/00_infra.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 { DOMException } from "ext:deno_web/01_dom_exception.js";
import { clearTimeout, setTimeout } from "ext:deno_web/02_timers.js"; import { clearTimeout, setTimeout } from "ext:deno_web/02_timers.js";
@ -603,23 +603,21 @@ class WebSocket extends EventTarget {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, [
evaluate: ObjectPrototypeIsPrototypeOf(WebSocketPrototype, this), "url",
keys: [ "readyState",
"url", "extensions",
"readyState", "protocol",
"extensions", "binaryType",
"protocol", "bufferedAmount",
"binaryType", "onmessage",
"bufferedAmount", "onerror",
"onmessage", "onclose",
"onerror", "onopen",
"onclose", ],
"onopen", inspect,
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -33,7 +33,7 @@ const {
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { Deferred, writableStreamClose } from "ext:deno_web/06_streams.js"; import { Deferred, writableStreamClose } 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";
import { add, remove } from "ext:deno_web/03_abort_signal.js"; import { add, remove } from "ext:deno_web/03_abort_signal.js";
@ -426,16 +426,10 @@ class WebSocketStream {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["closed", "opened", "url"],
evaluate: ObjectPrototypeIsPrototypeOf(WebSocketStreamPrototype, this), inspect,
keys: [
"closed",
"opened",
"url",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -505,17 +499,10 @@ class WebSocketError extends DOMException {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["message", "name", "closeCode", "reason"],
evaluate: ObjectPrototypeIsPrototypeOf(WebSocketErrorPrototype, this), inspect,
keys: [
"message",
"name",
"closeCode",
"reason",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -21,7 +21,7 @@ const {
} = primordials; } = primordials;
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import { URL } from "ext:deno_url/00_url.js"; import { URL } from "ext:deno_url/00_url.js";
import { getLocationHref } from "ext:deno_web/12_location.js"; import { getLocationHref } from "ext:deno_web/12_location.js";
import { serializePermissions } from "ext:runtime/10_permissions.js"; import { serializePermissions } from "ext:runtime/10_permissions.js";
@ -292,16 +292,10 @@ class Worker extends EventTarget {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
createFilteredInspectProxy({ this,
object: this, ["onerror", "onmessage", "onmessageerror"],
evaluate: ObjectPrototypeIsPrototypeOf(WorkerPrototype, this), inspect,
keys: [
"onerror",
"onmessage",
"onmessageerror",
],
}),
inspectOptions, inspectOptions,
); );
} }
@ -309,8 +303,6 @@ class Worker extends EventTarget {
[SymbolToStringTag] = "Worker"; [SymbolToStringTag] = "Worker";
} }
const WorkerPrototype = Worker.prototype;
defineEventHandler(Worker.prototype, "error"); defineEventHandler(Worker.prototype, "error");
defineEventHandler(Worker.prototype, "message"); defineEventHandler(Worker.prototype, "message");
defineEventHandler(Worker.prototype, "messageerror"); defineEventHandler(Worker.prototype, "messageerror");

View file

@ -8,12 +8,11 @@ import {
} from "ext:core/ops"; } from "ext:core/ops";
const { const {
ObjectDefineProperties, ObjectDefineProperties,
ObjectPrototypeIsPrototypeOf,
SymbolFor, SymbolFor,
} = primordials; } = primordials;
import * as location from "ext:deno_web/12_location.js"; import * as location from "ext:deno_web/12_location.js";
import * as console from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import * as globalInterfaces from "ext:deno_web/04_global_interfaces.js"; import * as globalInterfaces from "ext:deno_web/04_global_interfaces.js";
import * as webStorage from "ext:deno_webstorage/01_webstorage.js"; import * as webStorage from "ext:deno_webstorage/01_webstorage.js";
@ -26,17 +25,10 @@ class Navigator {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
console.createFilteredInspectProxy({ this,
object: this, ["hardwareConcurrency", "userAgent", "language", "languages"],
evaluate: ObjectPrototypeIsPrototypeOf(NavigatorPrototype, this), inspect,
keys: [
"hardwareConcurrency",
"userAgent",
"language",
"languages",
],
}),
inspectOptions, inspectOptions,
); );
} }

View file

@ -8,12 +8,11 @@ import {
} from "ext:core/ops"; } from "ext:core/ops";
const { const {
ObjectDefineProperties, ObjectDefineProperties,
ObjectPrototypeIsPrototypeOf,
SymbolFor, SymbolFor,
} = primordials; } = primordials;
import * as location from "ext:deno_web/12_location.js"; import * as location from "ext:deno_web/12_location.js";
import * as console from "ext:deno_console/01_console.js"; import { privateInspect } from "ext:deno_console/01_console.js";
import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as webidl from "ext:deno_webidl/00_webidl.js";
import * as globalInterfaces from "ext:deno_web/04_global_interfaces.js"; import * as globalInterfaces from "ext:deno_web/04_global_interfaces.js";
import { loadWebGPU } from "ext:deno_webgpu/00_init.js"; import { loadWebGPU } from "ext:deno_webgpu/00_init.js";
@ -38,17 +37,10 @@ class WorkerNavigator {
} }
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return inspect( return privateInspect(
console.createFilteredInspectProxy({ this,
object: this, ["hardwareConcurrency", "userAgent", "language", "languages"],
evaluate: ObjectPrototypeIsPrototypeOf(WorkerNavigatorPrototype, this), inspect,
keys: [
"hardwareConcurrency",
"userAgent",
"language",
"languages",
],
}),
inspectOptions, inspectOptions,
); );
} }