summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/web/01_dom_exception.js15
-rw-r--r--tools/wpt/expectation.json6
2 files changed, 12 insertions, 9 deletions
diff --git a/ext/web/01_dom_exception.js b/ext/web/01_dom_exception.js
index ae478da2b..25eb85fc2 100644
--- a/ext/web/01_dom_exception.js
+++ b/ext/web/01_dom_exception.js
@@ -96,11 +96,16 @@
});
this.#code = nameToCodeMapping[this.#name] ?? 0;
- // `DOMException` does not have `.stack`, so `Error.prepareStackTrace()`
- // is not called on it, meaning our structured stack trace hack doesn't
- // apply. This patches it in.
- const error = new Error();
- error.stack;
+ const error = new Error(`DOMException: ${this.#message}`);
+ ObjectDefineProperty(this, "stack", {
+ value: error.stack,
+ writable: true,
+ configurable: true,
+ });
+
+ // `DOMException` isn't a native error, so `Error.prepareStackTrace()` is
+ // not called when accessing `.stack`, meaning our structured stack trace
+ // hack doesn't apply. This patches it in.
ObjectDefineProperty(this, "__callSiteEvals", {
value: ArrayPrototypeSlice(error.__callSiteEvals, 1),
configurable: true,
diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json
index 72c276d7b..ab8ebe447 100644
--- a/tools/wpt/expectation.json
+++ b/tools/wpt/expectation.json
@@ -13603,9 +13603,7 @@
"DOMException-constants.any.html": true,
"DOMException-constructor-and-prototype.any.html": true,
"DOMException-constructor-behavior.any.html": true,
- "DOMException-custom-bindings.any.html": [
- "If the implementation has a stack property on normal errors, it also does on DOMExceptions"
- ]
+ "DOMException-custom-bindings.any.html": true
},
"class-string-interface.any.html": true,
"class-string-iterator-prototype-object.any.html": true,
@@ -15339,4 +15337,4 @@
"Pattern: [] Inputs: []"
]
}
-} \ No newline at end of file
+}