diff --git a/src/api/environment.cc b/src/api/environment.cc index c9bb4bdf1645e2..cfc4426e1aa6c0 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -23,6 +23,7 @@ namespace node { using errors::TryCatchScope; using v8::Array; +using v8::Boolean; using v8::Context; using v8::EscapableHandleScope; using v8::Function; @@ -667,7 +668,7 @@ Maybe InitializeContextRuntime(Local context) { context->AllowCodeGenerationFromStrings(false); context->SetEmbedderData( ContextEmbedderIndex::kAllowCodeGenerationFromStrings, - is_code_generation_from_strings_allowed ? True(isolate) : False(isolate)); + Boolean::New(isolate, is_code_generation_from_strings_allowed)); if (per_process::cli_options->disable_proto == "") { return Just(true); diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc index dafea2cf4af6c6..3baa64047ec4f1 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -22,6 +22,7 @@ namespace node { using v8::Array; using v8::ArrayBufferView; +using v8::Boolean; using v8::Context; using v8::DontDelete; using v8::Exception; @@ -1191,7 +1192,7 @@ int SecureContext::TicketKeyCallback(SSL* ssl, return -1; } - argv[2] = enc != 0 ? v8::True(env->isolate()) : v8::False(env->isolate()); + argv[2] = Boolean::New(env->isolate(), enc != 0); Local ret; if (!node::MakeCallback( diff --git a/src/crypto/crypto_hmac.cc b/src/crypto/crypto_hmac.cc index 41c83b31eb219d..b101d5c7b08fe3 100644 --- a/src/crypto/crypto_hmac.cc +++ b/src/crypto/crypto_hmac.cc @@ -13,6 +13,7 @@ namespace node { +using v8::Boolean; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; @@ -264,11 +265,10 @@ Maybe HmacTraits::EncodeOutput( *result = out->ToArrayBuffer(env); break; case SignConfiguration::kVerify: - *result = + *result = Boolean::New( + env->isolate(), out->size() > 0 && out->size() == params.signature.size() && - memcmp(out->data(), params.signature.data(), out->size()) == 0 - ? v8::True(env->isolate()) - : v8::False(env->isolate()); + memcmp(out->data(), params.signature.data(), out->size()) == 0); break; default: UNREACHABLE(); diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc index 2652b7d8aae17a..272dbdaf7c9125 100644 --- a/src/crypto/crypto_random.cc +++ b/src/crypto/crypto_random.cc @@ -13,7 +13,7 @@ namespace node { using v8::ArrayBuffer; using v8::BackingStore; -using v8::False; +using v8::Boolean; using v8::FunctionCallbackInfo; using v8::Int32; using v8::Just; @@ -21,7 +21,6 @@ using v8::Local; using v8::Maybe; using v8::Nothing; using v8::Object; -using v8::True; using v8::Uint32; using v8::Value; @@ -225,7 +224,7 @@ Maybe CheckPrimeTraits::EncodeOutput( const CheckPrimeConfig& params, ByteSource* out, v8::Local* result) { - *result = out->data()[0] ? True(env->isolate()) : False(env->isolate()); + *result = Boolean::New(env->isolate(), out->data()[0] != 0); return Just(true); } diff --git a/src/crypto/crypto_sig.cc b/src/crypto/crypto_sig.cc index 8e8b5f0c61e219..e38bc9eec083ad 100644 --- a/src/crypto/crypto_sig.cc +++ b/src/crypto/crypto_sig.cc @@ -13,6 +13,7 @@ namespace node { using v8::ArrayBuffer; using v8::BackingStore; +using v8::Boolean; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; @@ -816,8 +817,7 @@ Maybe SignTraits::EncodeOutput( *result = out->ToArrayBuffer(env); break; case SignConfiguration::kVerify: - *result = out->data()[0] == 1 ? v8::True(env->isolate()) - : v8::False(env->isolate()); + *result = Boolean::New(env->isolate(), out->data()[0] == 1); break; default: UNREACHABLE(); diff --git a/src/crypto/crypto_tls.cc b/src/crypto/crypto_tls.cc index f14adec767af41..05b5828c18b5a2 100644 --- a/src/crypto/crypto_tls.cc +++ b/src/crypto/crypto_tls.cc @@ -39,6 +39,7 @@ using v8::Array; using v8::ArrayBuffer; using v8::ArrayBufferView; using v8::BackingStore; +using v8::Boolean; using v8::Context; using v8::DontDelete; using v8::Exception; @@ -57,7 +58,6 @@ using v8::PropertyAttribute; using v8::ReadOnly; using v8::Signature; using v8::String; -using v8::True; using v8::Uint32; using v8::Value; @@ -96,15 +96,14 @@ void OnClientHello( if ((buf.IsEmpty() || hello_obj->Set(env->context(), env->session_id_string(), buf) - .IsNothing()) || + .IsNothing()) || hello_obj->Set(env->context(), env->servername_string(), servername) .IsNothing() || - hello_obj->Set( - env->context(), - env->tls_ticket_string(), - hello.has_ticket() - ? True(env->isolate()) - : False(env->isolate())).IsNothing()) { + hello_obj + ->Set(env->context(), + env->tls_ticket_string(), + Boolean::New(env->isolate(), hello.has_ticket())) + .IsNothing()) { return; } @@ -202,9 +201,8 @@ int SSLCertCallback(SSL* s, void* arg) { ? String::Empty(env->isolate()) : OneByteString(env->isolate(), servername, strlen(servername)); - Local ocsp = (SSL_get_tlsext_status_type(s) == TLSEXT_STATUSTYPE_ocsp) - ? True(env->isolate()) - : False(env->isolate()); + Local ocsp = Boolean::New( + env->isolate(), SSL_get_tlsext_status_type(s) == TLSEXT_STATUSTYPE_ocsp); if (info->Set(env->context(), env->servername_string(), servername_str) .IsNothing() || diff --git a/src/node_http2.cc b/src/node_http2.cc index a4b559e8e5c3d5..29d1207ecff58f 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -28,7 +28,6 @@ using v8::BackingStore; using v8::Boolean; using v8::Context; using v8::EscapableHandleScope; -using v8::False; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; @@ -42,7 +41,6 @@ using v8::Number; using v8::Object; using v8::ObjectTemplate; using v8::String; -using v8::True; using v8::Uint8Array; using v8::Undefined; using v8::Value; @@ -332,10 +330,8 @@ void Http2Settings::Done(bool ack) { uint64_t end = uv_hrtime(); double duration = (end - startTime_) / 1e6; - Local argv[] = { - ack ? True(env()->isolate()) : False(env()->isolate()), - Number::New(env()->isolate(), duration) - }; + Local argv[] = {Boolean::New(env()->isolate(), ack), + Number::New(env()->isolate(), duration)}; MakeCallback(callback(), arraysize(argv), argv); } @@ -3131,10 +3127,7 @@ void Http2Ping::Done(bool ack, const uint8_t* payload) { } Local argv[] = { - ack ? True(isolate) : False(isolate), - Number::New(isolate, duration_ms), - buf - }; + Boolean::New(isolate, ack), Number::New(isolate, duration_ms), buf}; MakeCallback(callback(), arraysize(argv), argv); } diff --git a/src/node_os.cc b/src/node_os.cc index cf1928521b138e..7318c1a368d871 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -234,7 +234,7 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo& args) { result.emplace_back(family); result.emplace_back(FIXED_ONE_BYTE_STRING(isolate, mac)); result.emplace_back( - interfaces[i].is_internal ? True(isolate) : False(isolate)); + Boolean::New(env->isolate(), interfaces[i].is_internal)); if (interfaces[i].address.address4.sin_family == AF_INET6) { uint32_t scopeid = interfaces[i].address.address6.sin6_scope_id; result.emplace_back(Integer::NewFromUnsigned(isolate, scopeid));