diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-05-07 22:02:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-07 21:02:29 +0000 |
commit | 25fcfe5d79850b6969f2756415fc01e2234850c9 (patch) | |
tree | c9b57ed0a0beee991db3cefaadbf42bf446ec040 /ext/web/01_dom_exception.js | |
parent | 998036b3998301dc53b0dc4700b91d0a9c630702 (diff) |
fix: DOMException doesn't throw on __callSitesEvals (#23729)
Diffstat (limited to 'ext/web/01_dom_exception.js')
-rw-r--r-- | ext/web/01_dom_exception.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/web/01_dom_exception.js b/ext/web/01_dom_exception.js index 9bab4881a..82e8f867f 100644 --- a/ext/web/01_dom_exception.js +++ b/ext/web/01_dom_exception.js @@ -167,7 +167,12 @@ ObjectDefineProperty(DOMException.prototype, "stack", { // hack doesn't apply. This patches it in. ObjectDefineProperty(DOMException.prototype, "__callSiteEvals", { get() { - return ArrayPrototypeSlice(this[_error].__callSiteEvals, 1); + // Call the stack getter so `__callSiteEvals` get populated. + this[_error].stack; + // To be extra sure, use an empty array if `__callSiteEvals` is still not there, + // eg. if the user overrides `Error.prepareStackTrace`. + const callSiteEvals = this[_error].__callSiteEvals ?? []; + return ArrayPrototypeSlice(callSiteEvals, 1); }, configurable: true, }); |