summaryrefslogtreecommitdiff
path: root/extensions/web/01_dom_exception.js
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2021-07-08 09:43:36 -0400
committerGitHub <noreply@github.com>2021-07-08 09:43:36 -0400
commit5fa58c92165e23386b8ed3c3079103997fe1bef9 (patch)
treed7efc34a11322d10f2749b5083cd84fa1b4a18d6 /extensions/web/01_dom_exception.js
parent5e092b19fe113bdecd36b4e0184c82f4b3343bca (diff)
fix: inspecting prototypes of built-ins with custom inspect implementations should not throw (#11308)
Diffstat (limited to 'extensions/web/01_dom_exception.js')
-rw-r--r--extensions/web/01_dom_exception.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/extensions/web/01_dom_exception.js b/extensions/web/01_dom_exception.js
index 90ddb267b..3e282d969 100644
--- a/extensions/web/01_dom_exception.js
+++ b/extensions/web/01_dom_exception.js
@@ -17,6 +17,7 @@
ObjectSetPrototypeOf,
} = window.__bootstrap.primordials;
const webidl = window.__bootstrap.webidl;
+ const consoleInternal = window.__bootstrap.console;
// Defined in WebIDL 4.3.
// https://heycam.github.io/webidl/#idl-DOMException
@@ -109,8 +110,20 @@
return "DOMException";
}
- [Symbol.for("Deno.customInspect")]() {
- return `DOMException: ${this.#message}`;
+ [Symbol.for("Deno.customInspect")](inspect) {
+ if (this instanceof DOMException) {
+ return `DOMException: ${this.#message}`;
+ } else {
+ return inspect(consoleInternal.createFilteredInspectProxy({
+ object: this,
+ evaluate: false,
+ keys: [
+ "message",
+ "name",
+ "code",
+ ],
+ }));
+ }
}
}