Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: use isolate version of BooleanValue() #24883

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/inspector_js_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
9 changes: 4 additions & 5 deletions src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/node_i18n.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/node_serdes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 8 additions & 6 deletions src/spawn_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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);

Expand Down