| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3e6e010 commit 17d59ef
18 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -767,16 +767,16 @@ Maybe<void> ExportJWKEcKey(Environment* env, | |||
| 767 | 767 | const int nid = EC_GROUP_get_curve_name(group); | |
| 768 | 768 | switch (nid) { | |
| 769 | 769 | case NID_X9_62_prime256v1: | |
| 770 | - crv_name = OneByteString(env->isolate(), "P-256"); | ||
| 770 | + crv_name = FIXED_ONE_BYTE_STRING(env->isolate(), "P-256"); | ||
| 771 | 771 | break; | |
| 772 | 772 | case NID_secp256k1: | |
| 773 | - crv_name = OneByteString(env->isolate(), "secp256k1"); | ||
| 773 | + crv_name = FIXED_ONE_BYTE_STRING(env->isolate(), "secp256k1"); | ||
| 774 | 774 | break; | |
| 775 | 775 | case NID_secp384r1: | |
| 776 | - crv_name = OneByteString(env->isolate(), "P-384"); | ||
| 776 | + crv_name = FIXED_ONE_BYTE_STRING(env->isolate(), "P-384"); | ||
| 777 | 777 | break; | |
| 778 | 778 | case NID_secp521r1: | |
| 779 | - crv_name = OneByteString(env->isolate(), "P-521"); | ||
| 779 | + crv_name = FIXED_ONE_BYTE_STRING(env->isolate(), "P-521"); | ||
| 780 | 780 | break; | |
| 781 | 781 | default: { | |
| 782 | 782 | THROW_ERR_CRYPTO_JWK_UNSUPPORTED_CURVE( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -152,7 +152,7 @@ void Hash::GetCachedAliases(const FunctionCallbackInfo<Value>& args) { | |||
| 152 | 152 | names.reserve(size); | |
| 153 | 153 | values.reserve(size); | |
| 154 | 154 | for (auto& [alias, id] : env->alias_to_md_id_map) { | |
| 155 | - names.push_back(OneByteString(isolate, alias.c_str(), alias.size())); | ||
| 155 | + names.push_back(OneByteString(isolate, alias)); | ||
| 156 | 156 | values.push_back(v8::Uint32::New(isolate, id)); | |
| 157 | 157 | } | |
| 158 | 158 | #else | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -859,8 +859,7 @@ void TLSWrap::ClearOut() { | |||
| 859 | 859 | if (context.IsEmpty()) [[unlikely]] | |
| 860 | 860 | return; | |
| 861 | 861 | const std::string error_str = GetBIOError(); | |
| 862 | - Local<String> message = OneByteString( | ||
| 863 | - env()->isolate(), error_str.c_str(), error_str.size()); | ||
| 862 | + Local<String> message = OneByteString(env()->isolate(), error_str); | ||
| 864 | 863 | if (message.IsEmpty()) [[unlikely]] | |
| 865 | 864 | return; | |
| 866 | 865 | error = Exception::Error(message); | |
@@ -1974,7 +1973,7 @@ void TLSWrap::GetSharedSigalgs(const FunctionCallbackInfo<Value>& args) { | |||
| 1974 | 1973 | } else { | |
| 1975 | 1974 | sig_with_md += "UNDEF"; | |
| 1976 | 1975 | } | |
| 1977 | - ret_arr[i] = OneByteString(env->isolate(), sig_with_md.c_str()); | ||
| 1976 | + ret_arr[i] = OneByteString(env->isolate(), sig_with_md); | ||
| 1978 | 1977 | } | |
| 1979 | 1978 | ||
| 1980 | 1979 | args.GetReturnValue().Set( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -341,7 +341,7 @@ Local<FunctionTemplate> IntervalHistogram::GetConstructorTemplate( | |||
| 341 | 341 | Isolate* isolate = env->isolate(); | |
| 342 | 342 | tmpl = NewFunctionTemplate(isolate, nullptr); | |
| 343 | 343 | tmpl->Inherit(HandleWrap::GetConstructorTemplate(env)); | |
| 344 | - tmpl->SetClassName(OneByteString(isolate, "Histogram")); | ||
| 344 | + tmpl->SetClassName(FIXED_ONE_BYTE_STRING(isolate, "Histogram")); | ||
| 345 | 345 | auto instance = tmpl->InstanceTemplate(); | |
| 346 | 346 | instance->SetInternalFieldCount(HistogramImpl::kInternalFieldCount); | |
| 347 | 347 | HistogramImpl::AddMethods(isolate, tmpl); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -333,7 +333,7 @@ void Url(const FunctionCallbackInfo<Value>& args) { | |||
| 333 | 333 | if (url.empty()) { | |
| 334 | 334 | return; | |
| 335 | 335 | } | |
| 336 | - args.GetReturnValue().Set(OneByteString(env->isolate(), url.c_str())); | ||
| 336 | + args.GetReturnValue().Set(OneByteString(env->isolate(), url)); | ||
| 337 | 337 | } | |
| 338 | 338 | ||
| 339 | 339 | void Initialize(Local<Object> target, Local<Value> unused, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,7 +78,7 @@ void BuiltinLoader::GetNatives(Local<Name> property, | |||
| 78 | 78 | Local<Object> out = Object::New(isolate); | |
| 79 | 79 | auto source = env->builtin_loader()->source_.read(); | |
| 80 | 80 | for (auto const& x : *source) { | |
| 81 | - Local<String> key = OneByteString(isolate, x.first.c_str(), x.first.size()); | ||
| 81 | + Local<String> key = OneByteString(isolate, x.first); | ||
| 82 | 82 | out->Set(context, key, x.second.ToStringChecked(isolate)).FromJust(); | |
| 83 | 83 | } | |
| 84 | 84 | info.GetReturnValue().Set(out); | |
@@ -206,7 +206,7 @@ MaybeLocal<String> BuiltinLoader::LoadBuiltinSource(Isolate* isolate, | |||
| 206 | 206 | uv_err_name(r), | |
| 207 | 207 | uv_strerror(r), | |
| 208 | 208 | filename); | |
| 209 | - Local<String> message = OneByteString(isolate, buf.c_str()); | ||
| 209 | + Local<String> message = OneByteString(isolate, buf); | ||
| 210 | 210 | isolate->ThrowException(v8::Exception::Error(message)); | |
| 211 | 211 | return MaybeLocal<String>(); | |
| 212 | 212 | } | |
@@ -276,8 +276,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal( | |||
| 276 | 276 | } | |
| 277 | 277 | ||
| 278 | 278 | std::string filename_s = std::string("node:") + id; | |
| 279 | - Local<String> filename = | ||
| 280 | - OneByteString(isolate, filename_s.c_str(), filename_s.size()); | ||
| 279 | + Local<String> filename = OneByteString(isolate, filename_s); | ||
| 281 | 280 | ScriptOrigin origin(filename, 0, 0, true); | |
| 282 | 281 | ||
| 283 | 282 | BuiltinCodeCacheData cached_data{}; | |
@@ -594,7 +593,7 @@ void BuiltinLoader::GetBuiltinCategories( | |||
| 594 | 593 | return; | |
| 595 | 594 | if (result | |
| 596 | 595 | ->Set(context, | |
| 597 | - OneByteString(isolate, "cannotBeRequired"), | ||
| 596 | + FIXED_ONE_BYTE_STRING(isolate, "cannotBeRequired"), | ||
| 598 | 597 | cannot_be_required_js) | |
| 599 | 598 | .IsNothing()) | |
| 600 | 599 | return; | |
@@ -603,7 +602,7 @@ void BuiltinLoader::GetBuiltinCategories( | |||
| 603 | 602 | return; | |
| 604 | 603 | if (result | |
| 605 | 604 | ->Set(context, | |
| 606 | - OneByteString(isolate, "canBeRequired"), | ||
| 605 | + FIXED_ONE_BYTE_STRING(isolate, "canBeRequired"), | ||
| 607 | 606 | can_be_required_js) | |
| 608 | 607 | .IsNothing()) { | |
| 609 | 608 | return; | |
@@ -626,7 +625,7 @@ void BuiltinLoader::GetCacheUsage(const FunctionCallbackInfo<Value>& args) { | |||
| 626 | 625 | } | |
| 627 | 626 | if (result | |
| 628 | 627 | ->Set(context, | |
| 629 | - OneByteString(isolate, "compiledWithCache"), | ||
| 628 | + FIXED_ONE_BYTE_STRING(isolate, "compiledWithCache"), | ||
| 630 | 629 | builtins_with_cache_js) | |
| 631 | 630 | .IsNothing()) { | |
| 632 | 631 | return; | |
@@ -638,7 +637,7 @@ void BuiltinLoader::GetCacheUsage(const FunctionCallbackInfo<Value>& args) { | |||
| 638 | 637 | } | |
| 639 | 638 | if (result | |
| 640 | 639 | ->Set(context, | |
| 641 | - OneByteString(isolate, "compiledWithoutCache"), | ||
| 640 | + FIXED_ONE_BYTE_STRING(isolate, "compiledWithoutCache"), | ||
| 642 | 641 | builtins_without_cache_js) | |
| 643 | 642 | .IsNothing()) { | |
| 644 | 643 | return; | |
@@ -650,7 +649,7 @@ void BuiltinLoader::GetCacheUsage(const FunctionCallbackInfo<Value>& args) { | |||
| 650 | 649 | } | |
| 651 | 650 | if (result | |
| 652 | 651 | ->Set(context, | |
| 653 | - OneByteString(isolate, "compiledInSnapshot"), | ||
| 652 | + FIXED_ONE_BYTE_STRING(isolate, "compiledInSnapshot"), | ||
| 654 | 653 | builtins_in_snapshot_js) | |
| 655 | 654 | .IsNothing()) { | |
| 656 | 655 | return; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1337,33 +1337,47 @@ void CreatePerContextProperties(Local<Object> target, | |||
| 1337 | 1337 | // Define libuv constants. | |
| 1338 | 1338 | NODE_DEFINE_CONSTANT(os_constants, UV_UDP_REUSEADDR); | |
| 1339 | 1339 | ||
| 1340 | - os_constants->Set(env->context(), | ||
| 1341 | - OneByteString(isolate, "dlopen"), | ||
| 1342 | - dlopen_constants).Check(); | ||
| 1343 | - os_constants->Set(env->context(), | ||
| 1344 | - OneByteString(isolate, "errno"), | ||
| 1345 | - err_constants).Check(); | ||
| 1346 | - os_constants->Set(env->context(), | ||
| 1347 | - OneByteString(isolate, "signals"), | ||
| 1348 | - sig_constants).Check(); | ||
| 1349 | - os_constants->Set(env->context(), | ||
| 1350 | - OneByteString(isolate, "priority"), | ||
| 1351 | - priority_constants).Check(); | ||
| 1352 | - target->Set(env->context(), | ||
| 1353 | - OneByteString(isolate, "os"), | ||
| 1354 | - os_constants).Check(); | ||
| 1355 | - target->Set(env->context(), | ||
| 1356 | - OneByteString(isolate, "fs"), | ||
| 1357 | - fs_constants).Check(); | ||
| 1358 | - target->Set(env->context(), | ||
| 1359 | - OneByteString(isolate, "crypto"), | ||
| 1360 | - crypto_constants).Check(); | ||
| 1361 | - target->Set(env->context(), | ||
| 1362 | - OneByteString(isolate, "zlib"), | ||
| 1363 | - zlib_constants).Check(); | ||
| 1364 | - target->Set(env->context(), | ||
| 1365 | - OneByteString(isolate, "trace"), | ||
| 1366 | - trace_constants).Check(); | ||
| 1340 | + os_constants | ||
| 1341 | + ->Set(env->context(), | ||
| 1342 | + FIXED_ONE_BYTE_STRING(isolate, "dlopen"), | ||
| 1343 | + dlopen_constants) | ||
| 1344 | + .Check(); | ||
| 1345 | + os_constants | ||
| 1346 | + ->Set(env->context(), | ||
| 1347 | + FIXED_ONE_BYTE_STRING(isolate, "errno"), | ||
| 1348 | + err_constants) | ||
| 1349 | + .Check(); | ||
| 1350 | + os_constants | ||
| 1351 | + ->Set(env->context(), | ||
| 1352 | + FIXED_ONE_BYTE_STRING(isolate, "signals"), | ||
| 1353 | + sig_constants) | ||
| 1354 | + .Check(); | ||
| 1355 | + os_constants | ||
| 1356 | + ->Set(env->context(), | ||
| 1357 | + FIXED_ONE_BYTE_STRING(isolate, "priority"), | ||
| 1358 | + priority_constants) | ||
| 1359 | + .Check(); | ||
| 1360 | + target | ||
| 1361 | + ->Set(env->context(), FIXED_ONE_BYTE_STRING(isolate, "os"), os_constants) | ||
| 1362 | + .Check(); | ||
| 1363 | + target | ||
| 1364 | + ->Set(env->context(), FIXED_ONE_BYTE_STRING(isolate, "fs"), fs_constants) | ||
| 1365 | + .Check(); | ||
| 1366 | + target | ||
| 1367 | + ->Set(env->context(), | ||
| 1368 | + FIXED_ONE_BYTE_STRING(isolate, "crypto"), | ||
| 1369 | + crypto_constants) | ||
| 1370 | + .Check(); | ||
| 1371 | + target | ||
| 1372 | + ->Set(env->context(), | ||
| 1373 | + FIXED_ONE_BYTE_STRING(isolate, "zlib"), | ||
| 1374 | + zlib_constants) | ||
| 1375 | + .Check(); | ||
| 1376 | + target | ||
| 1377 | + ->Set(env->context(), | ||
| 1378 | + FIXED_ONE_BYTE_STRING(isolate, "trace"), | ||
| 1379 | + trace_constants) | ||
| 1380 | + .Check(); | ||
| 1367 | 1381 | } | |
| 1368 | 1382 | ||
| 1369 | 1383 | } // namespace constants | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -118,7 +118,7 @@ void OOMErrorHandler(const char* location, const v8::OOMDetails& details); | |||
| 118 | 118 | inline v8::Local<v8::Object> code( \ | |
| 119 | 119 | v8::Isolate* isolate, const char* format, Args&&... args) { \ | |
| 120 | 120 | std::string message = SPrintF(format, std::forward<Args>(args)...); \ | |
| 121 | - v8::Local<v8::String> js_code = OneByteString(isolate, #code); \ | ||
| 121 | + v8::Local<v8::String> js_code = FIXED_ONE_BYTE_STRING(isolate, #code); \ | ||
| 122 | 122 | v8::Local<v8::String> js_msg = \ | |
| 123 | 123 | v8::String::NewFromUtf8(isolate, \ | |
| 124 | 124 | message.c_str(), \ | |
@@ -129,7 +129,7 @@ void OOMErrorHandler(const char* location, const v8::OOMDetails& details); | |||
| 129 | 129 | ->ToObject(isolate->GetCurrentContext()) \ | |
| 130 | 130 | .ToLocalChecked(); \ | |
| 131 | 131 | e->Set(isolate->GetCurrentContext(), \ | |
| 132 | - OneByteString(isolate, "code"), \ | ||
| 132 | + FIXED_ONE_BYTE_STRING(isolate, "code"), \ | ||
| 133 | 133 | js_code) \ | |
| 134 | 134 | .Check(); \ | |
| 135 | 135 | return e; \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -725,13 +725,14 @@ MaybeLocal<Object> Http2SessionPerformanceEntryTraits::GetDetails( | |||
| 725 | 725 | SET(stream_average_duration_string, stream_average_duration) | |
| 726 | 726 | SET(stream_count_string, stream_count) | |
| 727 | 727 | ||
| 728 | - if (!obj->Set( | ||
| 729 | - env->context(), | ||
| 730 | - env->type_string(), | ||
| 731 | - OneByteString( | ||
| 732 | - env->isolate(), | ||
| 733 | - (entry.details.session_type == NGHTTP2_SESSION_SERVER) | ||
| 734 | - ? "server" : "client")).IsJust()) { | ||
| 728 | + if (!obj->Set(env->context(), | ||
| 729 | + env->type_string(), | ||
| 730 | + FIXED_ONE_BYTE_STRING( | ||
| 731 | + env->isolate(), | ||
| 732 | + (entry.details.session_type == NGHTTP2_SESSION_SERVER) | ||
| 733 | + ? "server" | ||
| 734 | + : "client")) | ||
| 735 | + .IsJust()) { | ||
| 735 | 736 | return MaybeLocal<Object>(); | |
| 736 | 737 | } | |
| 737 | 738 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1660,7 +1660,7 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data, | |||
| 1660 | 1660 | Local<FunctionTemplate> t = FunctionTemplate::New(isolate); | |
| 1661 | 1661 | t->InstanceTemplate()->SetInternalFieldCount( | |
| 1662 | 1662 | JSTransferable::kInternalFieldCount); | |
| 1663 | - t->SetClassName(OneByteString(isolate, "JSTransferable")); | ||
| 1663 | + t->SetClassName(FIXED_ONE_BYTE_STRING(isolate, "JSTransferable")); | ||
| 1664 | 1664 | isolate_data->set_js_transferable_constructor_template(t); | |
| 1665 | 1665 | } | |
| 1666 | 1666 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments