-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
process,tls: stop relying on process.features #21087
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2456,44 +2456,46 @@ static void GetParentProcessId(Local<Name> property, | |
|
||
|
||
static Local<Object> GetFeatures(Environment* env) { | ||
EscapableHandleScope scope(env->isolate()); | ||
Isolate* isolate = env->isolate(); | ||
EscapableHandleScope scope(isolate); | ||
Local<Boolean> true_value = True(isolate); | ||
Local<Boolean> false_value = False(isolate); | ||
|
||
Local<Object> obj = Object::New(env->isolate()); | ||
Local<Object> obj = Object::New(isolate); | ||
#if defined(DEBUG) && DEBUG | ||
Local<Value> debug = True(env->isolate()); | ||
Local<Boolean> debug = true_value; | ||
#else | ||
Local<Value> debug = False(env->isolate()); | ||
Local<Boolean> debug = false_value; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of making this change multiple times, what if we instead removed the temporary variables instead and just set the values directly in the obj->Set(FIXED_ONE_BYTE_STRING(isolate, "debug"),
#if defined(DEBUG) && DEBUG
True(isolate)
#else
False(isolate)
#endif
); or something similar or maybe even write a macro for this? |
||
#endif // defined(DEBUG) && DEBUG | ||
obj->Set(FIXED_ONE_BYTE_STRING(isolate, "debug"), debug); | ||
|
||
obj->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "debug"), debug); | ||
obj->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "uv"), True(env->isolate())); | ||
obj->Set(FIXED_ONE_BYTE_STRING(isolate, "uv"), true_value); | ||
// TODO(bnoordhuis) ping libuv | ||
obj->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "ipv6"), True(env->isolate())); | ||
obj->Set(FIXED_ONE_BYTE_STRING(isolate, "ipv6"), true_value); | ||
|
||
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation | ||
Local<Boolean> tls_alpn = True(env->isolate()); | ||
Local<Boolean> tls_alpn = true_value; | ||
#else | ||
Local<Boolean> tls_alpn = False(env->isolate()); | ||
Local<Boolean> tls_alpn = false_value; | ||
#endif | ||
obj->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "tls_alpn"), tls_alpn); | ||
obj->Set(FIXED_ONE_BYTE_STRING(isolate, "tls_alpn"), tls_alpn); | ||
|
||
#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB | ||
Local<Boolean> tls_sni = True(env->isolate()); | ||
Local<Boolean> tls_sni = true_value; | ||
#else | ||
Local<Boolean> tls_sni = False(env->isolate()); | ||
Local<Boolean> tls_sni = false_value; | ||
#endif | ||
obj->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "tls_sni"), tls_sni); | ||
obj->Set(FIXED_ONE_BYTE_STRING(isolate, "tls_sni"), tls_sni); | ||
|
||
#if !defined(OPENSSL_NO_TLSEXT) && defined(SSL_CTX_set_tlsext_status_cb) | ||
Local<Boolean> tls_ocsp = True(env->isolate()); | ||
Local<Boolean> tls_ocsp = true_value; | ||
#else | ||
Local<Boolean> tls_ocsp = False(env->isolate()); | ||
Local<Boolean> tls_ocsp = false_value; | ||
#endif // !defined(OPENSSL_NO_TLSEXT) && defined(SSL_CTX_set_tlsext_status_cb) | ||
obj->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "tls_ocsp"), tls_ocsp); | ||
obj->Set(FIXED_ONE_BYTE_STRING(isolate, "tls_ocsp"), tls_ocsp); | ||
|
||
obj->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "tls"), | ||
Boolean::New(env->isolate(), | ||
get_builtin_module("crypto") != nullptr)); | ||
obj->Set(FIXED_ONE_BYTE_STRING(isolate, "tls"), | ||
Boolean::New(isolate, get_builtin_module("crypto") != nullptr)); | ||
|
||
return scope.Escape(obj); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need these two separate variables instead of using
True(isolate)
andFalse(isolate)
inline like before?