Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Error.prepareStackTrace support #134

Closed
TooTallNate opened this issue Nov 25, 2023 · 6 comments · Fixed by #223
Closed

Add Error.prepareStackTrace support #134

TooTallNate opened this issue Nov 25, 2023 · 6 comments · Fixed by #223
Assignees

Comments

@TooTallNate
Copy link
Contributor

To enable support for stack traces within applications using QuickJS, it would be ideal to support some form of the non-standard Error.prepareStackTrace API.

I have a fork of QuickJS where I am using this, you can re-use the implementation from there if desired: TooTallNate/quickjs@29339cc

@saghul
Copy link
Contributor

saghul commented Nov 25, 2023

Yep I'd like us to have it. The Frida fork also has an implementation, I'll take a look and see what the differences are.

While we're at it it would be nice to add sourcemap support to the CLI :-)

@saghul
Copy link
Contributor

saghul commented Nov 25, 2023

The Frida implementation: frida/quickjs@78fd25f

@bnoordhuis
Copy link
Contributor

Relevant implementation detail: V8 passes in a list of CallSite objects with the following methods:

getColumnNumber
getEnclosingColumnNumber
getEnclosingLineNumber
getEvalOrigin
getFileName
getFunction
getFunctionName
getLineNumber
getMethodName
getPosition
getPromiseIndex
getScriptNameOrSourceURL
getThis
getTypeName
isAsync
isConstructor
isEval
isNative
isPromiseAll
isToplevel

@saghul
Copy link
Contributor

saghul commented Nov 27, 2023

@TooTallNate
Copy link
Contributor Author

Also somewhat related to this, is QuickJS's stack traces seem to not include column number information, which makes resolving source maps of minified files basically useless. Would be nice to rectify that, but I had no idea how to do so when I was digging through the code.

@bnoordhuis
Copy link
Contributor

#149 for column numbers. PR welcome if you're up for it :)

@saghul saghul self-assigned this Dec 16, 2023
saghul added a commit that referenced this issue Dec 17, 2023
saghul added a commit that referenced this issue Dec 19, 2023
saghul added a commit that referenced this issue Dec 19, 2023
saghul added a commit that referenced this issue Dec 19, 2023
bluesky950520 pushed a commit to bluesky950520/quickjs that referenced this issue Mar 14, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants