diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-12-09 00:48:02 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-12-14 00:03:45 +0300 |
commit | c6c83374028c44d280dd7eaa767348eaee3b9502 (patch) | |
tree | 5d6183c447ac9e48a9a3c6bebc5f4a837eb0c920 /src/node_task_queue.cc | |
parent | a91a95f8203c6683ad497c0cbd4cb5f48030bd23 (diff) |
src: use correct outer Context’s microtask queue
Fall back to using the outer context’s microtask queue, rather than
the Isolate’s default one. This would otherwise result in surprising
behavior if an embedder specified a custom microtask queue for the
main Node.js context.
PR-URL: https://github.com/nodejs/node/pull/36482
Refs: https://github.com/v8/v8/commit/4bf051d536a172e7932845d82f918ad7280c7873
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/node_task_queue.cc')
-rw-r--r-- | src/node_task_queue.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc index 926b27fcf2a..dff59d8dc77 100644 --- a/src/node_task_queue.cc +++ b/src/node_task_queue.cc @@ -96,7 +96,8 @@ static void EnqueueMicrotask(const FunctionCallbackInfo<Value>& args) { CHECK(args[0]->IsFunction()); - isolate->EnqueueMicrotask(args[0].As<Function>()); + isolate->GetCurrentContext()->GetMicrotaskQueue() + ->EnqueueMicrotask(isolate, args[0].As<Function>()); } static void RunMicrotasks(const FunctionCallbackInfo<Value>& args) { |