From 18ddb1da38ad6eb78c357f182b5379a8ab3332ce 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 aec70381c58e67..6b95796e1269b3 100644 --- a/src/node.cc +++ b/src/node.cc @@ -395,6 +395,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 b7532f8242a31d..d6e0ebb36f4a65 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -341,11 +341,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());