test: fix unreliable assumption in js-native-api/test_cannot_run_js · nodejs/node@627d399 · GitHub
Skip to content

Commit 627d399

Browse files
joyeecheungrichardlau
authored andcommitted
test: fix unreliable assumption in js-native-api/test_cannot_run_js
Previously the test assumes that when the queued finalizer is run, it must be run at a point where env->can_call_into_js() is false (typically, during Environment shutdown), which is not certain. If GC kicks in early and the second pass finalizer is queued before the event loop runs the check callbacks, the finalizer would then be called in check callbacks (via native immediates), where the finalizer can still call into JS. Essentially, addons can't make assumptions about where the queued finalizer would be called. This patch updates the assertions in the test to account for that. PR-URL: #51898 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 9f521f4 commit 627d399

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

test/js-native-api/test_cannot_run_js/test_cannot_run_js.c

Lines changed: 24 additions & 8 deletions

test/root.status

Lines changed: 0 additions & 1 deletion

0 commit comments

Comments
 (0)