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>
This commit is contained in:
Anna Henningsen committed 2020-12-13 22:03:45 +01:00
1 parent a91a95f820
commit c6c8337402
4 files changed
+62 -3

No files matched your search

+2 -1
View File
@@ -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) {