From ffefb059e23743b1eb00ce2c616a3d3ae5820543 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 24 Feb 2020 19:14:15 -0800 Subject: [PATCH] src: move InternalCallbackScope to StartExecution PR-URL: https://github.com/nodejs/node/pull/31944 Reviewed-By: Anna Henningsen Reviewed-By: Stephen Belanger Reviewed-By: Joyee Cheung --- src/node.cc | 6 ++++++ src/node_main_instance.cc | 9 +-------- src/node_worker.cc | 5 ----- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/node.cc b/src/node.cc index e8625bd9659950..583c8d5b8b818f 100644 --- a/src/node.cc +++ b/src/node.cc @@ -389,6 +389,12 @@ MaybeLocal StartExecution(Environment* env, const char* main_script_id) { ->GetFunction(env->context()) .ToLocalChecked()}; + InternalCallbackScope callback_scope( + env, + Object::New(env->isolate()), + { 1, 0 }, + InternalCallbackScope::kSkipAsyncHooks); + return scope.EscapeMaybe( ExecuteBootstrapper(env, main_script_id, ¶meters, &arguments)); } diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc index d53eaa7329beed..6f240d7e809f8e 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -122,14 +122,7 @@ int NodeMainInstance::Run() { Context::Scope context_scope(env->context()); if (exit_code == 0) { - { - InternalCallbackScope callback_scope( - env.get(), - Object::New(isolate_), - { 1, 0 }, - InternalCallbackScope::kSkipAsyncHooks); - LoadEnvironment(env.get()); - } + LoadEnvironment(env.get()); env->set_trace_sync_io(env->options()->trace_sync_io); diff --git a/src/node_worker.cc b/src/node_worker.cc index 78eaa3a042bebd..8dd72ee81067e2 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -344,11 +344,6 @@ void Worker::Run() { env_->InitializeInspector(std::move(inspector_parent_handle_)); #endif HandleScope handle_scope(isolate_); - InternalCallbackScope callback_scope( - env_.get(), - Object::New(isolate_), - { 1, 0 }, - InternalCallbackScope::kSkipAsyncHooks); if (!env_->RunBootstrapping().IsEmpty()) { CreateEnvMessagePort(env_.get());