From c51f349dfabd03e7cc82d25973faf53157424008 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 7 Aug 2015 21:26:24 +0800 Subject: [PATCH] Run microtask before handling pending process.nextTick tasks This follows the behavior of Node.js. --- atom/common/api/atom_bindings.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/atom_bindings.cc index fa4a88d58437..c748647f48d0 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/atom_bindings.cc @@ -98,6 +98,10 @@ void AtomBindings::OnCallNextTick(uv_async_t* handle) { if (tick_info->in_tick()) continue; + if (tick_info->length() == 0) { + env->isolate()->RunMicrotasks(); + } + if (tick_info->length() == 0) { tick_info->set_index(0); continue;