diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2023-11-19 17:13:38 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-19 09:13:38 +0100 |
commit | c806fbdabe144c865612bbbc9ef596c9611c8310 (patch) | |
tree | edb38d58720377580677ccbeffb693ffa1225cc4 /ext/web/13_message_port.js | |
parent | a7548afb58b9848e501a085455446f5de897ffaa (diff) |
fix(ext,runtime): add missing custom inspections (#21219)
Diffstat (limited to 'ext/web/13_message_port.js')
-rw-r--r-- | ext/web/13_message_port.js | 31 |
1 files changed, 27 insertions, 4 deletions
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) { |