Skip to content

Commit

Permalink
timers: check can_call_into_js in Immediates
Browse files Browse the repository at this point in the history
Prevent an infinite loop if it's not possible to call into JS.

PR-URL: #21057
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
  • Loading branch information
apapirovski authored and MylesBorins committed Jun 6, 2018
1 parent 1e607d0 commit ba71fe8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,17 @@ void Environment::CheckImmediate(uv_check_t* handle) {

env->RunAndClearNativeImmediates();

if (!env->can_call_into_js())
return;

do {
MakeCallback(env->isolate(),
env->process_object(),
env->immediate_callback_function(),
0,
nullptr,
{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)
env->ToggleImmediateRef(false);
Expand Down

0 comments on commit ba71fe8

Please sign in to comment.