Skip to content

Commit

Permalink
src: break out of timers loop if !can_call_into_js()
Browse files Browse the repository at this point in the history
Otherwise, this turns into an infinite loop when the flag
is set, because it makes `MakeCallback()` return immediately.

PR-URL: #20884
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
addaleax authored and apapirovski committed May 31, 2018
1 parent c1012b4 commit 694ac6d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/timer_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ class TimerWrap : public HandleWrap {
do {
ret = wrap->MakeCallback(env->timers_callback_function(), 1, args)
.ToLocalChecked();
} while (ret->IsUndefined() && !env->tick_info()->has_thrown());
} while (ret->IsUndefined() &&
!env->tick_info()->has_thrown() &&
env->can_call_into_js());
}

static void Now(const FunctionCallbackInfo<Value>& args) {
Expand Down

0 comments on commit 694ac6d

Please sign in to comment.