summaryrefslogtreecommitdiff
path: root/extensions/web/01_dom_exception.js
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2021-07-04 16:08:53 +0200
committerGitHub <noreply@github.com>2021-07-04 16:08:53 +0200
commit3c0267dbb526e1067ba7ab7702663a429f8f3a10 (patch)
tree2f28c1cda2b8899a5116530103023ab7d9edc6c7 /extensions/web/01_dom_exception.js
parent5addba2abc2e384e751e8884b4ac3219688c2473 (diff)
fix: align DOMException to webidl spec (#11259)
Diffstat (limited to 'extensions/web/01_dom_exception.js')
-rw-r--r--extensions/web/01_dom_exception.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/extensions/web/01_dom_exception.js b/extensions/web/01_dom_exception.js
index 6c3c95f38..90ddb267b 100644
--- a/extensions/web/01_dom_exception.js
+++ b/extensions/web/01_dom_exception.js
@@ -10,8 +10,12 @@
"use strict";
((window) => {
- const { ObjectDefineProperty, ObjectEntries } =
- window.__bootstrap.primordials;
+ const {
+ Error,
+ ObjectDefineProperty,
+ ObjectEntries,
+ ObjectSetPrototypeOf,
+ } = window.__bootstrap.primordials;
const webidl = window.__bootstrap.webidl;
// Defined in WebIDL 4.3.
@@ -72,13 +76,12 @@
// Defined in WebIDL 4.3.
// https://heycam.github.io/webidl/#idl-DOMException
- class DOMException extends Error {
+ class DOMException {
#message = "";
#name = "";
#code = 0;
constructor(message = "", name = "Error") {
- super();
this.#message = webidl.converters.DOMString(message, {
prefix: "Failed to construct 'DOMException'",
context: "Argument 1",
@@ -105,8 +108,14 @@
get [Symbol.toStringTag]() {
return "DOMException";
}
+
+ [Symbol.for("Deno.customInspect")]() {
+ return `DOMException: ${this.#message}`;
+ }
}
+ ObjectSetPrototypeOf(DOMException.prototype, Error.prototype);
+
webidl.configurePrototype(DOMException);
for (