Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: check microtasks before running them #29434

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: check microtasks before running them
codebytere committed Sep 4, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit d7166fc2cc8e59b7c4752a74ad8b364c05336e68
3 changes: 2 additions & 1 deletion src/api/callback.cc
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ using v8::HandleScope;
using v8::Isolate;
using v8::Local;
using v8::MaybeLocal;
using v8::MicrotasksScope;
using v8::NewStringType;
using v8::Object;
using v8::String;
@@ -100,7 +101,7 @@ void InternalCallbackScope::Close() {

if (!env_->can_call_into_js()) return;
if (!tick_info->has_tick_scheduled()) {
env_->isolate()->RunMicrotasks();
MicrotasksScope::PerformCheckpoint(env_->isolate());
}

// Make sure the stack unwound properly. If there are nested MakeCallback's
3 changes: 2 additions & 1 deletion src/node_task_queue.cc
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ using v8::kPromiseRejectWithNoHandler;
using v8::kPromiseResolveAfterResolved;
using v8::Local;
using v8::Message;
using v8::MicrotasksScope;
using v8::Number;
using v8::Object;
using v8::Promise;
@@ -43,7 +44,7 @@ static void EnqueueMicrotask(const FunctionCallbackInfo<Value>& args) {
bool RunNextTicksNative(Environment* env) {
TickInfo* tick_info = env->tick_info();
if (!tick_info->has_tick_scheduled() && !tick_info->has_rejection_to_warn())
env->isolate()->RunMicrotasks();
MicrotasksScope::PerformCheckpoint(env->isolate());
if (!tick_info->has_tick_scheduled() && !tick_info->has_rejection_to_warn())
return true;