node/test/js-native-api/test_cannot_run_js
Joyee Cheung 30c9181994
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: https://github.com/nodejs/node/pull/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>
2024-03-01 01:44:55 +00:00
..
binding.gyp test: avoid copying test source files 2023-09-10 06:11:36 +00:00
test_cannot_run_js.c test: fix unreliable assumption in js-native-api/test_cannot_run_js 2024-03-01 01:44:55 +00:00
test.js