From 0f14c550731d1f418764d33ee46712d97ffae469 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 --- 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 a0398b1a4f8d2c..83703d93016c2b 100644 --- a/src/node.cc +++ b/src/node.cc @@ -397,6 +397,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());