From 2e8c04b1bb3fd9e735b26ff0de2f18d8e9c7099c Mon Sep 17 00:00:00 2001 From: Tom Boutell Date: Fri, 6 Oct 2017 11:30:48 -0700 Subject: [PATCH] src: use maybe versions of methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16005 Fixes: https://github.com/nodejs/node/issues/15864 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Timothy Gu Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig --- src/inspector_agent.cc | 9 +++++---- src/inspector_js_api.cc | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 4828fa3071cc5b..beaebde1c3e45a 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -496,11 +496,11 @@ bool Agent::StartIoThread(bool wait_for_connect) { v8::Isolate* isolate = parent_env_->isolate(); HandleScope handle_scope(isolate); + auto context = parent_env_->context(); // Enable tracking of async stack traces if (!enable_async_hook_function_.IsEmpty()) { Local enable_fn = enable_async_hook_function_.Get(isolate); - auto context = parent_env_->context(); auto result = enable_fn->Call(context, Undefined(isolate), 0, nullptr); if (result.IsEmpty()) { FatalError( @@ -512,14 +512,15 @@ bool Agent::StartIoThread(bool wait_for_connect) { // Send message to enable debug in workers Local process_object = parent_env_->process_object(); Local emit_fn = - process_object->Get(FIXED_ONE_BYTE_STRING(isolate, "emit")); + process_object->Get(context, FIXED_ONE_BYTE_STRING(isolate, "emit")) + .ToLocalChecked(); // In case the thread started early during the startup if (!emit_fn->IsFunction()) return true; Local message = Object::New(isolate); - message->Set(FIXED_ONE_BYTE_STRING(isolate, "cmd"), - FIXED_ONE_BYTE_STRING(isolate, "NODE_DEBUG_ENABLED")); + message->Set(context, FIXED_ONE_BYTE_STRING(isolate, "cmd"), + FIXED_ONE_BYTE_STRING(isolate, "NODE_DEBUG_ENABLED")).FromJust(); Local argv[] = { FIXED_ONE_BYTE_STRING(isolate, "internalMessage"), message diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 110f1363aa527a..8bd682351a0531 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -284,7 +284,7 @@ void Open(const FunctionCallbackInfo& args) { } if (args.Length() > 2 && args[2]->IsBoolean()) { - wait_for_connect = args[2]->BooleanValue(); + wait_for_connect = args[2]->BooleanValue(env->context()).FromJust(); } agent->StartIoThread(wait_for_connect);