From 24e6b709eadd320ae39fd942261ac111446bb3c9 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 7 Dec 2018 01:29:58 -0500 Subject: src: use isolate version of BooleanValue() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes deprecation warnings. PR-URL: https://github.com/nodejs/node/pull/24883 Reviewed-By: Michaƫl Zasso Reviewed-By: Daniel Bevenius Reviewed-By: Joyee Cheung Reviewed-By: Anna Henningsen --- src/inspector_js_api.cc | 4 ++-- src/node_crypto.cc | 4 ++-- src/node_http2.cc | 9 ++++----- src/node_i18n.cc | 2 +- src/node_serdes.cc | 5 ++--- src/spawn_sync.cc | 14 ++++++++------ 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 1cb51b51ec..ede3987726 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -215,7 +215,7 @@ static void AsyncTaskScheduledWrapper(const FunctionCallbackInfo& args) { void* task = GetAsyncTask(task_id); CHECK(args[2]->IsBoolean()); - bool recurring = args[2]->BooleanValue(env->context()).FromJust(); + bool recurring = args[2]->BooleanValue(args.GetIsolate()); env->inspector_agent()->AsyncTaskScheduled(task_name_view, task, recurring); } @@ -252,7 +252,7 @@ void Open(const FunctionCallbackInfo& args) { } if (args.Length() > 2 && args[2]->IsBoolean()) { - wait_for_connect = args[2]->BooleanValue(env->context()).FromJust(); + wait_for_connect = args[2]->BooleanValue(args.GetIsolate()); } agent->StartIoThread(); if (wait_for_connect) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 222f4089d8..16d958ea88 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5751,8 +5751,8 @@ void SetFipsCrypto(const FunctionCallbackInfo& args) { CHECK(!per_process_opts->force_fips_crypto); Environment* env = Environment::GetCurrent(args); const bool enabled = FIPS_mode(); - bool enable; - if (!args[0]->BooleanValue(env->context()).To(&enable)) return; + bool enable = args[0]->BooleanValue(env->isolate()); + if (enable == enabled) return; // No action needed. if (!FIPS_mode_set(enable)) { diff --git a/src/node_http2.cc b/src/node_http2.cc index 58ba052f04..1489d8b6f8 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -341,7 +341,7 @@ Http2Priority::Http2Priority(Environment* env, Local context = env->context(); int32_t parent_ = parent->Int32Value(context).ToChecked(); int32_t weight_ = weight->Int32Value(context).ToChecked(); - bool exclusive_ = exclusive->BooleanValue(context).ToChecked(); + bool exclusive_ = exclusive->BooleanValue(env->isolate()); Debug(env, DebugCategory::HTTP2STREAM, "Http2Priority: parent: %d, weight: %d, exclusive: %d\n", parent_, weight_, exclusive_); @@ -1096,7 +1096,7 @@ int Http2Session::OnStreamClose(nghttp2_session* handle, stream->MakeCallback(env->http2session_on_stream_close_function(), 1, &arg); if (answer.IsEmpty() || - !(answer.ToLocalChecked()->BooleanValue(env->context()).FromJust())) { + !(answer.ToLocalChecked()->BooleanValue(env->isolate()))) { // Skip to destroy stream->Destroy(); } @@ -2436,7 +2436,7 @@ void Http2Session::Destroy(const FunctionCallbackInfo& args) { Local context = env->context(); uint32_t code = args[0]->Uint32Value(context).ToChecked(); - bool socketDestroyed = args[1]->BooleanValue(context).ToChecked(); + bool socketDestroyed = args[1]->BooleanValue(env->isolate()); session->Close(code, socketDestroyed); } @@ -2647,12 +2647,11 @@ void Http2Stream::PushPromise(const FunctionCallbackInfo& args) { // Send a PRIORITY frame void Http2Stream::Priority(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - Local context = env->context(); Http2Stream* stream; ASSIGN_OR_RETURN_UNWRAP(&stream, args.Holder()); Http2Priority priority(env, args[0], args[1], args[2]); - bool silent = args[3]->BooleanValue(context).ToChecked(); + bool silent = args[3]->BooleanValue(env->isolate()); CHECK_EQ(stream->SubmitPriority(*priority, silent), 0); Debug(stream, "priority submitted"); diff --git a/src/node_i18n.cc b/src/node_i18n.cc index d2a8c38182..d3e1b96616 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -733,7 +733,7 @@ static void ToASCII(const FunctionCallbackInfo& args) { CHECK(args[0]->IsString()); Utf8Value val(env->isolate(), args[0]); // optional arg - bool lenient = args[1]->BooleanValue(env->context()).FromJust(); + bool lenient = args[1]->BooleanValue(env->isolate()); enum idna_mode mode = lenient ? IDNA_LENIENT : IDNA_DEFAULT; MaybeStackBuffer buf; diff --git a/src/node_serdes.cc b/src/node_serdes.cc index 565fb7e3f0..27b4e9e8b4 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -192,9 +192,8 @@ void SerializerContext::SetTreatArrayBufferViewsAsHostObjects( SerializerContext* ctx; ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder()); - Maybe value = args[0]->BooleanValue(ctx->env()->context()); - if (value.IsNothing()) return; - ctx->serializer_.SetTreatArrayBufferViewsAsHostObjects(value.FromJust()); + bool value = args[0]->BooleanValue(ctx->env()->isolate()); + ctx->serializer_.SetTreatArrayBufferViewsAsHostObjects(value); } void SerializerContext::ReleaseBuffer(const FunctionCallbackInfo& args) { diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index 4aad9d8a14..eb16719b05 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -740,7 +740,8 @@ Local SyncProcessRunner::BuildOutputArray() { } Maybe SyncProcessRunner::ParseOptions(Local js_value) { - HandleScope scope(env()->isolate()); + Isolate* isolate = env()->isolate(); + HandleScope scope(isolate); int r; if (!js_value->IsObject()) return Just(UV_EINVAL); @@ -797,19 +798,19 @@ Maybe SyncProcessRunner::ParseOptions(Local js_value) { Local js_detached = js_options->Get(context, env()->detached_string()).ToLocalChecked(); - if (js_detached->BooleanValue(context).FromJust()) + if (js_detached->BooleanValue(isolate)) uv_process_options_.flags |= UV_PROCESS_DETACHED; Local js_win_hide = js_options->Get(context, env()->windows_hide_string()).ToLocalChecked(); - if (js_win_hide->BooleanValue(context).FromJust()) + if (js_win_hide->BooleanValue(isolate)) uv_process_options_.flags |= UV_PROCESS_WINDOWS_HIDE; Local js_wva = js_options->Get(context, env()->windows_verbatim_arguments_string()) .ToLocalChecked(); - if (js_wva->BooleanValue(context).FromJust()) + if (js_wva->BooleanValue(isolate)) uv_process_options_.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS; Local js_timeout = @@ -889,14 +890,15 @@ int SyncProcessRunner::ParseStdioOption(int child_fd, return AddStdioIgnore(child_fd); } else if (js_type->StrictEquals(env()->pipe_string())) { + Isolate* isolate = env()->isolate(); Local rs = env()->readable_string(); Local ws = env()->writable_string(); bool readable = js_stdio_option->Get(context, rs) - .ToLocalChecked()->BooleanValue(context).FromJust(); + .ToLocalChecked()->BooleanValue(isolate); bool writable = js_stdio_option->Get(context, ws) - .ToLocalChecked()->BooleanValue(context).FromJust(); + .ToLocalChecked()->BooleanValue(isolate); uv_buf_t buf = uv_buf_init(nullptr, 0); -- cgit v1.2.3