mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
feat(web): Implement DOMException
's stack
property. (#12294)
As per WebIDL (https://heycam.github.io/webidl/#es-DOMException-specialness), if `Error` objects have a `stack` property, so should `DOMException` instances.
This commit is contained in:
parent
8884141c3f
commit
2170a41d97
2 changed files with 12 additions and 9 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue