]> git.kaiwu.me - njs.git/commit
Fixed handling of unhandled promise rejection.
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 27 Sep 2022 23:52:31 +0000 (16:52 -0700)
committerDmitry Volyntsev <xeioex@nginx.com>
Tue, 27 Sep 2022 23:52:31 +0000 (16:52 -0700)
commit6a11bf3763ccd36bf7137777799ab4ebcaa19500
tree7204ca6e73e2833b273dc5044fa3013c0c73dce3
parenta6f6be96fc523250bdc36893c6402b42db73b87d
Fixed handling of unhandled promise rejection.

Previously, a direct pointer to the first element of an array of
rejected promise values was used to convert that element to a string.
This is not correct because that pointer may become invalid if rejected
promise values array is resized between invocation of "toString" and
"valueOf" methods which are called while converting the element to a
string.

The fix is to ensure that the rejected promise value is never changed.

This closes #580 issue on Github.
src/njs_vm.c
test/js/promise_rejection_tracker_recursive.t.js [new file with mode: 0644]