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