Skip to content

Commit 24e6b70

Browse files
cjihrigTrott
authored andcommitted
src: use isolate version of BooleanValue()
This fixes deprecation warnings. PR-URL: #24883 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 4dc10ac commit 24e6b70

6 files changed

+19
-19
lines changed

src/inspector_js_api.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static void AsyncTaskScheduledWrapper(const FunctionCallbackInfo<Value>& args) {
215215
void* task = GetAsyncTask(task_id);
216216

217217
CHECK(args[2]->IsBoolean());
218-
bool recurring = args[2]->BooleanValue(env->context()).FromJust();
218+
bool recurring = args[2]->BooleanValue(args.GetIsolate());
219219

220220
env->inspector_agent()->AsyncTaskScheduled(task_name_view, task, recurring);
221221
}
@@ -252,7 +252,7 @@ void Open(const FunctionCallbackInfo<Value>& args) {
252252
}
253253

254254
if (args.Length() > 2 && args[2]->IsBoolean()) {
255-
wait_for_connect = args[2]->BooleanValue(env->context()).FromJust();
255+
wait_for_connect = args[2]->BooleanValue(args.GetIsolate());
256256
}
257257
agent->StartIoThread();
258258
if (wait_for_connect)

src/node_crypto.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -5751,8 +5751,8 @@ void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
57515751
CHECK(!per_process_opts->force_fips_crypto);
57525752
Environment* env = Environment::GetCurrent(args);
57535753
const bool enabled = FIPS_mode();
5754-
bool enable;
5755-
if (!args[0]->BooleanValue(env->context()).To(&enable)) return;
5754+
bool enable = args[0]->BooleanValue(env->isolate());
5755+
57565756
if (enable == enabled)
57575757
return; // No action needed.
57585758
if (!FIPS_mode_set(enable)) {

src/node_http2.cc

+4-5
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ Http2Priority::Http2Priority(Environment* env,
341341
Local<Context> context = env->context();
342342
int32_t parent_ = parent->Int32Value(context).ToChecked();
343343
int32_t weight_ = weight->Int32Value(context).ToChecked();
344-
bool exclusive_ = exclusive->BooleanValue(context).ToChecked();
344+
bool exclusive_ = exclusive->BooleanValue(env->isolate());
345345
Debug(env, DebugCategory::HTTP2STREAM,
346346
"Http2Priority: parent: %d, weight: %d, exclusive: %d\n",
347347
parent_, weight_, exclusive_);
@@ -1096,7 +1096,7 @@ int Http2Session::OnStreamClose(nghttp2_session* handle,
10961096
stream->MakeCallback(env->http2session_on_stream_close_function(),
10971097
1, &arg);
10981098
if (answer.IsEmpty() ||
1099-
!(answer.ToLocalChecked()->BooleanValue(env->context()).FromJust())) {
1099+
!(answer.ToLocalChecked()->BooleanValue(env->isolate()))) {
11001100
// Skip to destroy
11011101
stream->Destroy();
11021102
}
@@ -2436,7 +2436,7 @@ void Http2Session::Destroy(const FunctionCallbackInfo<Value>& args) {
24362436
Local<Context> context = env->context();
24372437

24382438
uint32_t code = args[0]->Uint32Value(context).ToChecked();
2439-
bool socketDestroyed = args[1]->BooleanValue(context).ToChecked();
2439+
bool socketDestroyed = args[1]->BooleanValue(env->isolate());
24402440

24412441
session->Close(code, socketDestroyed);
24422442
}
@@ -2647,12 +2647,11 @@ void Http2Stream::PushPromise(const FunctionCallbackInfo<Value>& args) {
26472647
// Send a PRIORITY frame
26482648
void Http2Stream::Priority(const FunctionCallbackInfo<Value>& args) {
26492649
Environment* env = Environment::GetCurrent(args);
2650-
Local<Context> context = env->context();
26512650
Http2Stream* stream;
26522651
ASSIGN_OR_RETURN_UNWRAP(&stream, args.Holder());
26532652

26542653
Http2Priority priority(env, args[0], args[1], args[2]);
2655-
bool silent = args[3]->BooleanValue(context).ToChecked();
2654+
bool silent = args[3]->BooleanValue(env->isolate());
26562655

26572656
CHECK_EQ(stream->SubmitPriority(*priority, silent), 0);
26582657
Debug(stream, "priority submitted");

src/node_i18n.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ static void ToASCII(const FunctionCallbackInfo<Value>& args) {
733733
CHECK(args[0]->IsString());
734734
Utf8Value val(env->isolate(), args[0]);
735735
// optional arg
736-
bool lenient = args[1]->BooleanValue(env->context()).FromJust();
736+
bool lenient = args[1]->BooleanValue(env->isolate());
737737
enum idna_mode mode = lenient ? IDNA_LENIENT : IDNA_DEFAULT;
738738

739739
MaybeStackBuffer<char> buf;

src/node_serdes.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,8 @@ void SerializerContext::SetTreatArrayBufferViewsAsHostObjects(
192192
SerializerContext* ctx;
193193
ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder());
194194

195-
Maybe<bool> value = args[0]->BooleanValue(ctx->env()->context());
196-
if (value.IsNothing()) return;
197-
ctx->serializer_.SetTreatArrayBufferViewsAsHostObjects(value.FromJust());
195+
bool value = args[0]->BooleanValue(ctx->env()->isolate());
196+
ctx->serializer_.SetTreatArrayBufferViewsAsHostObjects(value);
198197
}
199198

200199
void SerializerContext::ReleaseBuffer(const FunctionCallbackInfo<Value>& args) {

src/spawn_sync.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,8 @@ Local<Array> SyncProcessRunner::BuildOutputArray() {
740740
}
741741

742742
Maybe<int> SyncProcessRunner::ParseOptions(Local<Value> js_value) {
743-
HandleScope scope(env()->isolate());
743+
Isolate* isolate = env()->isolate();
744+
HandleScope scope(isolate);
744745
int r;
745746

746747
if (!js_value->IsObject()) return Just<int>(UV_EINVAL);
@@ -797,19 +798,19 @@ Maybe<int> SyncProcessRunner::ParseOptions(Local<Value> js_value) {
797798

798799
Local<Value> js_detached =
799800
js_options->Get(context, env()->detached_string()).ToLocalChecked();
800-
if (js_detached->BooleanValue(context).FromJust())
801+
if (js_detached->BooleanValue(isolate))
801802
uv_process_options_.flags |= UV_PROCESS_DETACHED;
802803

803804
Local<Value> js_win_hide =
804805
js_options->Get(context, env()->windows_hide_string()).ToLocalChecked();
805-
if (js_win_hide->BooleanValue(context).FromJust())
806+
if (js_win_hide->BooleanValue(isolate))
806807
uv_process_options_.flags |= UV_PROCESS_WINDOWS_HIDE;
807808

808809
Local<Value> js_wva =
809810
js_options->Get(context, env()->windows_verbatim_arguments_string())
810811
.ToLocalChecked();
811812

812-
if (js_wva->BooleanValue(context).FromJust())
813+
if (js_wva->BooleanValue(isolate))
813814
uv_process_options_.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS;
814815

815816
Local<Value> js_timeout =
@@ -889,14 +890,15 @@ int SyncProcessRunner::ParseStdioOption(int child_fd,
889890
return AddStdioIgnore(child_fd);
890891

891892
} else if (js_type->StrictEquals(env()->pipe_string())) {
893+
Isolate* isolate = env()->isolate();
892894
Local<String> rs = env()->readable_string();
893895
Local<String> ws = env()->writable_string();
894896

895897
bool readable = js_stdio_option->Get(context, rs)
896-
.ToLocalChecked()->BooleanValue(context).FromJust();
898+
.ToLocalChecked()->BooleanValue(isolate);
897899
bool writable =
898900
js_stdio_option->Get(context, ws)
899-
.ToLocalChecked()->BooleanValue(context).FromJust();
901+
.ToLocalChecked()->BooleanValue(isolate);
900902

901903
uv_buf_t buf = uv_buf_init(nullptr, 0);
902904

0 commit comments

Comments
 (0)