]> git.kaiwu.me - njs.git/commit
QuickJS: fix empty stack in errors created by the host
authorDmitry Volyntsev <xeioex@nginx.com>
Mon, 17 Aug 2026 16:33:34 +0000 (09:33 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Thu, 20 Aug 2026 17:31:10 +0000 (10:31 -0700)
commit0d5511c5f560e6ec30949e7d3c75527a53cf2f3a
tree6c4f86fc17acfa019028c9b737199c4aac383252
parentde76bf747641df80249a9047bb5f2b5c4bcbc1c0
QuickJS: fix empty stack in errors created by the host

An error created outside of a JS frame, from a fetch() completion
callback for instance, records an empty stack.  Up to QuickJS-NG 0.15.1
deleting the recorded "stack" property let the engine attach a real one
where the error was thrown.  Since 0.16.0 the stack is kept in the error
internal data behind an accessor, the property to delete no longer
exists and the empty stack became final.

JS_NewError() is JS_NewObjectClass() plus the stack recording, and the
first half alone is reachable through the public API.  Creating the
object that way records nothing, so the engine attaches the stack at the
throw site.  This works the same way for every supported engine, hence
the feature test is gone.
auto/quickjs
src/qjs.h