src: only open HandleScope when necessary

PR-URL: https://github.com/nodejs/node/pull/26734
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
Anna Henningsen authored and Ruben Bridgewater committed 2019-03-22 00:45:48 +01:00
1 parent d812dbb495
commit bca23f2ee7
1 file changed
+1 -1
+1 -1
View File
@@ -79,7 +79,6 @@ InternalCallbackScope::~InternalCallbackScope() {
void InternalCallbackScope::Close() {
if (closed_) return;
closed_ = true;
HandleScope handle_scope(env_->isolate());
if (!env_->can_call_into_js()) return;
if (failed_ && !env_->is_main_thread() && env_->is_stopping()) {
@@ -117,6 +116,7 @@ void InternalCallbackScope::Close() {
return;
}
HandleScope handle_scope(env_->isolate());
Local<Object> process = env_->process_object();
if (!env_->can_call_into_js()) return;