Skip to content

Fix calling build_backtrace too often#906

Merged
bnoordhuis merged 1 commit intoquickjs-ng:masterfrom
bnoordhuis:fix904
Feb 10, 2025
Merged

Fix calling build_backtrace too often#906
bnoordhuis merged 1 commit intoquickjs-ng:masterfrom
bnoordhuis:fix904

Conversation

@bnoordhuis
Copy link
Copy Markdown
Contributor

Bug introduced in commit 4c32c53 from late last month.

When unwinding the stack, call build_backtrace only when the exception object doesn't already have a .stack property, like how it was before commit 4c32c53.

Fixes: #904

Bug introduced in commit 4c32c53 from late last month.

When unwinding the stack, call build_backtrace only when the exception
object doesn't already have a .stack property, like how it was before
commit 4c32c53.

Fixes: quickjs-ng#904
Comment thread tests/bug904.js
Error.prepareStackTrace = function() { calls++ }
function f() { f() }
assertThrows(RangeError, f)
assert(calls, 0)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact the number of calls is zero instead of one is currently more or less by accident but in the case of stack overflow that's the desired behavior IMO (no JS calls) and I have an upcoming pull request that makes that intentional.

@bnoordhuis bnoordhuis merged commit 55db71e into quickjs-ng:master Feb 10, 2025
@bnoordhuis bnoordhuis deleted the fix904 branch February 10, 2025 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build_backtrace called too often on stack unwinding

2 participants