summaryrefslogtreecommitdiff
path: root/ext/fetch/27_eventsource.js
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/fetch/27_eventsource.js
parenta7548afb58b9848e501a085455446f5de897ffaa (diff)
fix(ext,runtime): add missing custom inspections (#21219)
Diffstat (limited to 'ext/fetch/27_eventsource.js')
-rw-r--r--ext/fetch/27_eventsource.js21
1 files changed, 21 insertions, 0 deletions
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;