summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2018-12-07 01:29:58 -0500
committerRich Trott <rtrott@gmail.com>2018-12-08 22:42:05 -0800
commit24e6b709eadd320ae39fd942261ac111446bb3c9 (patch)
treebe4581f06e462c683f1ba28d86e73b2f9ee069ac
parent4dc10ac7d7ddd2cc52e84d1394f7e863d576109f (diff)
downloadandroid-node-v8-24e6b709eadd320ae39fd942261ac111446bb3c9.tar.gz
android-node-v8-24e6b709eadd320ae39fd942261ac111446bb3c9.tar.bz2
android-node-v8-24e6b709eadd320ae39fd942261ac111446bb3c9.zip
src: use isolate version of BooleanValue()
This fixes deprecation warnings. PR-URL: https://github.com/nodejs/node/pull/24883 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
-rw-r--r--src/inspector_js_api.cc4
-rw-r--r--src/node_crypto.cc4
-rw-r--r--src/node_http2.cc9
-rw-r--r--src/node_i18n.cc2
-rw-r--r--src/node_serdes.cc5
-rw-r--r--src/spawn_sync.cc14
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<Value>& 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<Value>& 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<Value>& 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> 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<Value>& args) {
Local<Context> 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<Value>& args) {
// Send a PRIORITY frame
void Http2Stream::Priority(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
- Local<Context> 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<Value>& 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<char> 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<bool> 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<Value>& 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<Array> SyncProcessRunner::BuildOutputArray() {
}
Maybe<int> SyncProcessRunner::ParseOptions(Local<Value> js_value) {
- HandleScope scope(env()->isolate());
+ Isolate* isolate = env()->isolate();
+ HandleScope scope(isolate);
int r;
if (!js_value->IsObject()) return Just<int>(UV_EINVAL);
@@ -797,19 +798,19 @@ Maybe<int> SyncProcessRunner::ParseOptions(Local<Value> js_value) {
Local<Value> 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<Value> 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<Value> 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<Value> 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<String> rs = env()->readable_string();
Local<String> 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);