Bug 260326 - Add support for Error.captureStackTrace
Summary: Add support for Error.captureStackTrace
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Miller
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-08-16 19:47 PDT by Keith Miller
Modified: 2023-08-17 13:15 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Miller 2023-08-16 19:47:30 PDT
v8 has this API and it shows up in benchmarks. We should support it too.
Comment 1 Jarred Sumner 2023-08-16 20:14:05 PDT
oh nice

We implemented this in Bun, but I don't feel great about our implementation. We based it on the node-jsc implementation from years ago and we didn't have as good of an understanding of JSC internals when it was implemented. 

One thing we also did somewhat related to this was add an `onComputeError` WTF::Function in JSC::VM which lets us provide a sourcemapped Error.prototype.stack property and match the V8 stack string format (so that libraries expecting it work). ErrorInstance calls this to generate the stack string
Comment 2 Keith Miller 2023-08-17 07:58:45 PDT
Pull request: https://github.com/WebKit/WebKit/pull/16790
Comment 3 EWS 2023-08-17 13:06:05 PDT
Committed 267010@main (997e074bb35e): <https://commits.webkit.org/267010@main>

Reviewed commits have been landed. Closing PR #16790 and removing active labels.
Comment 4 Radar WebKit Bug Importer 2023-08-17 13:07:16 PDT
<rdar://problem/114042574>
Comment 5 Mark Lam 2023-08-17 13:15:51 PDT
<rdar://problem/113767788>