timers: check can_call_into_js in Immediates
Prevent an infinite loop if it's not possible to call into JS. PR-URL: https://github.com/nodejs/node/pull/21057 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
parent
898609e3b7
commit
5a6b1975d5
@ -457,6 +457,9 @@ void Environment::CheckImmediate(uv_check_t* handle) {
|
|||||||
|
|
||||||
env->RunAndClearNativeImmediates();
|
env->RunAndClearNativeImmediates();
|
||||||
|
|
||||||
|
if (!env->can_call_into_js())
|
||||||
|
return;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
MakeCallback(env->isolate(),
|
MakeCallback(env->isolate(),
|
||||||
env->process_object(),
|
env->process_object(),
|
||||||
@ -464,7 +467,7 @@ void Environment::CheckImmediate(uv_check_t* handle) {
|
|||||||
0,
|
0,
|
||||||
nullptr,
|
nullptr,
|
||||||
{0, 0}).ToLocalChecked();
|
{0, 0}).ToLocalChecked();
|
||||||
} while (env->immediate_info()->has_outstanding());
|
} while (env->immediate_info()->has_outstanding() && env->can_call_into_js());
|
||||||
|
|
||||||
if (env->immediate_info()->ref_count() == 0)
|
if (env->immediate_info()->ref_count() == 0)
|
||||||
env->ToggleImmediateRef(false);
|
env->ToggleImmediateRef(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user