Skip to content

Commit e63f574

Browse files
committed
From review: internalize QUIC error strings
Signed-off-by: Tim Perry <pimterry@gmail.com>
1 parent aefee4f commit e63f574

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/quic/data.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ using v8::Just;
2323
using v8::Local;
2424
using v8::Maybe;
2525
using v8::MaybeLocal;
26+
using v8::NewStringType;
2627
using v8::Nothing;
28+
using v8::String;
2729
using v8::Uint8Array;
2830
using v8::Undefined;
2931
using v8::Value;
@@ -442,7 +444,8 @@ MaybeLocal<Value> QuicError::ToV8Value(Environment* env) const {
442444
// names and OpenSSL TLS alert descriptions for CRYPTO_ERROR). Unknown
443445
// codes leave the slot as undefined.
444446
if (const char* n = name()) {
445-
if (!node::ToV8Value(env->context(), n).ToLocal(&argv[3])) {
447+
if (!String::NewFromUtf8(env->isolate(), n, NewStringType::kInternalized)
448+
.ToLocal(&argv[3])) {
446449
return {};
447450
}
448451
}

src/quic/session.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ using v8::Local;
4949
using v8::LocalVector;
5050
using v8::Maybe;
5151
using v8::MaybeLocal;
52+
using v8::NewStringType;
5253
using v8::Nothing;
5354
using v8::Number;
5455
using v8::Object;
@@ -3164,7 +3165,8 @@ void Session::EmitClose(const QuicError& error) {
31643165
// codes leave the slot as undefined. See QuicError::name() for the
31653166
// matching path on stream-level errors.
31663167
if (const char* n = error.name()) {
3167-
if (!ToV8Value(env()->context(), n).ToLocal(&argv[3])) {
3168+
if (!String::NewFromUtf8(env()->isolate(), n, NewStringType::kInternalized)
3169+
.ToLocal(&argv[3])) {
31683170
return;
31693171
}
31703172
}

0 commit comments

Comments
 (0)