src: remove calls to deprecated v8 functions (NewFromUtf8)

Remove all calls to deprecated v8 functions (here: String::NewFromUtf8) inside
the code (src directory only).

PR-URL: https://github.com/nodejs/node/pull/21926
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Ujjwal Sharma 2018-07-21 22:09:45 +05:30 committed by Anna Henningsen
parent 51812ff12b
commit 35ec9b247e
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
12 changed files with 89 additions and 54 deletions

View File

@ -1942,7 +1942,9 @@ void CanonicalizeIP(const FunctionCallbackInfo<Value>& args) {
char canonical_ip[INET6_ADDRSTRLEN]; char canonical_ip[INET6_ADDRSTRLEN];
const int af = (rc == 4 ? AF_INET : AF_INET6); const int af = (rc == 4 ? AF_INET : AF_INET6);
CHECK_EQ(0, uv_inet_ntop(af, &result, canonical_ip, sizeof(canonical_ip))); CHECK_EQ(0, uv_inet_ntop(af, &result, canonical_ip, sizeof(canonical_ip)));
args.GetReturnValue().Set(String::NewFromUtf8(isolate, canonical_ip)); v8::Local<String> val = String::NewFromUtf8(isolate, canonical_ip,
v8::NewStringType::kNormal).ToLocalChecked();
args.GetReturnValue().Set(val);
} }
void GetAddrInfo(const FunctionCallbackInfo<Value>& args) { void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {

View File

@ -39,7 +39,8 @@ Local<Value> ErrnoException(Isolate* isolate,
Local<String> path_string; Local<String> path_string;
if (path != nullptr) { if (path != nullptr) {
// FIXME(bnoordhuis) It's questionable to interpret the file path as UTF-8. // FIXME(bnoordhuis) It's questionable to interpret the file path as UTF-8.
path_string = String::NewFromUtf8(env->isolate(), path); path_string = String::NewFromUtf8(env->isolate(), path,
v8::NewStringType::kNormal).ToLocalChecked();
} }
if (path_string.IsEmpty() == false) { if (path_string.IsEmpty() == false) {
@ -68,13 +69,17 @@ static Local<String> StringFromPath(Isolate* isolate, const char* path) {
#ifdef _WIN32 #ifdef _WIN32
if (strncmp(path, "\\\\?\\UNC\\", 8) == 0) { if (strncmp(path, "\\\\?\\UNC\\", 8) == 0) {
return String::Concat(FIXED_ONE_BYTE_STRING(isolate, "\\\\"), return String::Concat(FIXED_ONE_BYTE_STRING(isolate, "\\\\"),
String::NewFromUtf8(isolate, path + 8)); String::NewFromUtf8(isolate, path + 8,
v8::NewStringType::kNormal)
.ToLocalChecked());
} else if (strncmp(path, "\\\\?\\", 4) == 0) { } else if (strncmp(path, "\\\\?\\", 4) == 0) {
return String::NewFromUtf8(isolate, path + 4); return String::NewFromUtf8(isolate, path + 4, v8::NewStringType::kNormal)
.ToLocalChecked();
} }
#endif #endif
return String::NewFromUtf8(isolate, path); return String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal)
.ToLocalChecked();
} }
@ -183,7 +188,9 @@ Local<Value> WinapiErrnoException(Isolate* isolate,
Local<String> cons1 = Local<String> cons1 =
String::Concat(message, FIXED_ONE_BYTE_STRING(isolate, " '")); String::Concat(message, FIXED_ONE_BYTE_STRING(isolate, " '"));
Local<String> cons2 = Local<String> cons2 =
String::Concat(cons1, String::NewFromUtf8(isolate, path)); String::Concat(cons1,
String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal)
.ToLocalChecked());
Local<String> cons3 = Local<String> cons3 =
String::Concat(cons2, FIXED_ONE_BYTE_STRING(isolate, "'")); String::Concat(cons2, FIXED_ONE_BYTE_STRING(isolate, "'"));
e = Exception::Error(cons3); e = Exception::Error(cons3);
@ -195,7 +202,9 @@ Local<Value> WinapiErrnoException(Isolate* isolate,
obj->Set(env->errno_string(), Integer::New(isolate, errorno)); obj->Set(env->errno_string(), Integer::New(isolate, errorno));
if (path != nullptr) { if (path != nullptr) {
obj->Set(env->path_string(), String::NewFromUtf8(isolate, path)); obj->Set(env->path_string(),
String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal)
.ToLocalChecked());
} }
if (syscall != nullptr) { if (syscall != nullptr) {

View File

@ -965,7 +965,8 @@ void AppendExceptionLine(Environment* env,
arrow[off] = '\n'; arrow[off] = '\n';
arrow[off + 1] = '\0'; arrow[off + 1] = '\0';
Local<String> arrow_str = String::NewFromUtf8(env->isolate(), arrow); Local<String> arrow_str = String::NewFromUtf8(env->isolate(), arrow,
v8::NewStringType::kNormal).ToLocalChecked();
const bool can_set_arrow = !arrow_str.IsEmpty() && !err_obj.IsEmpty(); const bool can_set_arrow = !arrow_str.IsEmpty() && !err_obj.IsEmpty();
// If allocating arrow_str failed, print it out. There's not much else to do. // If allocating arrow_str failed, print it out. There's not much else to do.
@ -1742,7 +1743,8 @@ static void GetLinkedBinding(const FunctionCallbackInfo<Value>& args) {
Local<Object> module = Object::New(env->isolate()); Local<Object> module = Object::New(env->isolate());
Local<Object> exports = Object::New(env->isolate()); Local<Object> exports = Object::New(env->isolate());
Local<String> exports_prop = String::NewFromUtf8(env->isolate(), "exports"); Local<String> exports_prop = String::NewFromUtf8(env->isolate(), "exports",
v8::NewStringType::kNormal).ToLocalChecked();
module->Set(exports_prop, exports); module->Set(exports_prop, exports);
if (mod->nm_context_register_func != nullptr) { if (mod->nm_context_register_func != nullptr) {
@ -1765,7 +1767,8 @@ static void ProcessTitleGetter(Local<Name> property,
const PropertyCallbackInfo<Value>& info) { const PropertyCallbackInfo<Value>& info) {
char buffer[512]; char buffer[512];
uv_get_process_title(buffer, sizeof(buffer)); uv_get_process_title(buffer, sizeof(buffer));
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), buffer)); info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), buffer,
v8::NewStringType::kNormal).ToLocalChecked());
} }
@ -1790,7 +1793,8 @@ static void EnvGetter(Local<Name> property,
node::Utf8Value key(isolate, property); node::Utf8Value key(isolate, property);
const char* val = getenv(*key); const char* val = getenv(*key);
if (val) { if (val) {
return info.GetReturnValue().Set(String::NewFromUtf8(isolate, val)); return info.GetReturnValue().Set(String::NewFromUtf8(isolate, val,
v8::NewStringType::kNormal).ToLocalChecked());
} }
#else // _WIN32 #else // _WIN32
node::TwoByteValue key(isolate, property); node::TwoByteValue key(isolate, property);
@ -1918,8 +1922,8 @@ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
const int length = s ? s - var : strlen(var); const int length = s ? s - var : strlen(var);
argv[idx] = String::NewFromUtf8(isolate, argv[idx] = String::NewFromUtf8(isolate,
var, var,
String::kNormalString, v8::NewStringType::kNormal,
length); length).ToLocalChecked();
if (++idx >= arraysize(argv)) { if (++idx >= arraysize(argv)) {
fn->Call(ctx, envarr, idx, argv).ToLocalChecked(); fn->Call(ctx, envarr, idx, argv).ToLocalChecked();
idx = 0; idx = 0;
@ -2196,14 +2200,16 @@ void SetupProcessObject(Environment* env,
// process.argv // process.argv
Local<Array> arguments = Array::New(env->isolate(), argc); Local<Array> arguments = Array::New(env->isolate(), argc);
for (int i = 0; i < argc; ++i) { for (int i = 0; i < argc; ++i) {
arguments->Set(i, String::NewFromUtf8(env->isolate(), argv[i])); arguments->Set(i, String::NewFromUtf8(env->isolate(), argv[i],
v8::NewStringType::kNormal).ToLocalChecked());
} }
process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "argv"), arguments); process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "argv"), arguments);
// process.execArgv // process.execArgv
Local<Array> exec_arguments = Array::New(env->isolate(), exec_argc); Local<Array> exec_arguments = Array::New(env->isolate(), exec_argc);
for (int i = 0; i < exec_argc; ++i) { for (int i = 0; i < exec_argc; ++i) {
exec_arguments->Set(i, String::NewFromUtf8(env->isolate(), exec_argv[i])); exec_arguments->Set(i, String::NewFromUtf8(env->isolate(), exec_argv[i],
v8::NewStringType::kNormal).ToLocalChecked());
} }
process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "execArgv"), process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "execArgv"),
exec_arguments); exec_arguments);
@ -2235,7 +2241,8 @@ void SetupProcessObject(Environment* env,
if (eval_string) { if (eval_string) {
READONLY_PROPERTY(process, READONLY_PROPERTY(process,
"_eval", "_eval",
String::NewFromUtf8(env->isolate(), eval_string)); String::NewFromUtf8(env->isolate(), eval_string,
v8::NewStringType::kNormal).ToLocalChecked());
} }
// -p, --print // -p, --print
@ -2258,7 +2265,9 @@ void SetupProcessObject(Environment* env,
Local<Array> array = Array::New(env->isolate()); Local<Array> array = Array::New(env->isolate());
for (unsigned int i = 0; i < preload_modules.size(); ++i) { for (unsigned int i = 0; i < preload_modules.size(); ++i) {
Local<String> module = String::NewFromUtf8(env->isolate(), Local<String> module = String::NewFromUtf8(env->isolate(),
preload_modules[i].c_str()); preload_modules[i].c_str(),
v8::NewStringType::kNormal)
.ToLocalChecked();
array->Set(i, module); array->Set(i, module);
} }
READONLY_PROPERTY(process, READONLY_PROPERTY(process,
@ -2343,10 +2352,11 @@ void SetupProcessObject(Environment* env,
if (uv_exepath(exec_path, &exec_path_len) == 0) { if (uv_exepath(exec_path, &exec_path_len) == 0) {
exec_path_value = String::NewFromUtf8(env->isolate(), exec_path_value = String::NewFromUtf8(env->isolate(),
exec_path, exec_path,
String::kNormalString, v8::NewStringType::kNormal,
exec_path_len); exec_path_len).ToLocalChecked();
} else { } else {
exec_path_value = String::NewFromUtf8(env->isolate(), argv[0]); exec_path_value = String::NewFromUtf8(env->isolate(), argv[0],
v8::NewStringType::kNormal).ToLocalChecked();
} }
process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "execPath"), process->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "execPath"),
exec_path_value); exec_path_value);

View File

@ -303,7 +303,8 @@ NODE_EXTERN struct uv_loop_s* GetCurrentEventLoop(v8::Isolate* isolate);
v8::Isolate* isolate = target->GetIsolate(); \ v8::Isolate* isolate = target->GetIsolate(); \
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \ v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
v8::Local<v8::String> constant_name = \ v8::Local<v8::String> constant_name = \
v8::String::NewFromUtf8(isolate, #constant); \ v8::String::NewFromUtf8(isolate, #constant, \
v8::NewStringType::kNormal).ToLocalChecked(); \
v8::Local<v8::Number> constant_value = \ v8::Local<v8::Number> constant_value = \
v8::Number::New(isolate, static_cast<double>(constant)); \ v8::Number::New(isolate, static_cast<double>(constant)); \
v8::PropertyAttribute constant_attributes = \ v8::PropertyAttribute constant_attributes = \
@ -344,7 +345,8 @@ inline void NODE_SET_METHOD(v8::Local<v8::Template> recv,
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate, v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate,
callback); callback);
v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name); v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name,
v8::NewStringType::kNormal).ToLocalChecked();
t->SetClassName(fn_name); t->SetClassName(fn_name);
recv->Set(fn_name, t); recv->Set(fn_name, t);
} }
@ -358,7 +360,8 @@ inline void NODE_SET_METHOD(v8::Local<v8::Object> recv,
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate, v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate,
callback); callback);
v8::Local<v8::Function> fn = t->GetFunction(); v8::Local<v8::Function> fn = t->GetFunction();
v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name); v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name,
v8::NewStringType::kNormal).ToLocalChecked();
fn->SetName(fn_name); fn->SetName(fn_name);
recv->Set(fn_name, fn); recv->Set(fn_name, fn);
} }
@ -374,7 +377,8 @@ inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
v8::Local<v8::Signature> s = v8::Signature::New(isolate, recv); v8::Local<v8::Signature> s = v8::Signature::New(isolate, recv);
v8::Local<v8::FunctionTemplate> t = v8::Local<v8::FunctionTemplate> t =
v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), s); v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), s);
v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name); v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name,
v8::NewStringType::kNormal).ToLocalChecked();
t->SetClassName(fn_name); t->SetClassName(fn_name);
recv->PrototypeTemplate()->Set(fn_name, t); recv->PrototypeTemplate()->Set(fn_name, t);
} }

View File

@ -1569,8 +1569,8 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
BIO_get_mem_ptr(bio.get(), &mem); BIO_get_mem_ptr(bio.get(), &mem);
info->Set(context, env->subject_string(), info->Set(context, env->subject_string(),
String::NewFromUtf8(env->isolate(), mem->data, String::NewFromUtf8(env->isolate(), mem->data,
String::kNormalString, NewStringType::kNormal,
mem->length)).FromJust(); mem->length).ToLocalChecked()).FromJust();
} }
USE(BIO_reset(bio.get())); USE(BIO_reset(bio.get()));
@ -1579,8 +1579,8 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
BIO_get_mem_ptr(bio.get(), &mem); BIO_get_mem_ptr(bio.get(), &mem);
info->Set(context, env->issuer_string(), info->Set(context, env->issuer_string(),
String::NewFromUtf8(env->isolate(), mem->data, String::NewFromUtf8(env->isolate(), mem->data,
String::kNormalString, NewStringType::kNormal,
mem->length)).FromJust(); mem->length).ToLocalChecked()).FromJust();
} }
USE(BIO_reset(bio.get())); USE(BIO_reset(bio.get()));
@ -1607,8 +1607,8 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
BIO_get_mem_ptr(bio.get(), &mem); BIO_get_mem_ptr(bio.get(), &mem);
info->Set(context, keys[i], info->Set(context, keys[i],
String::NewFromUtf8(env->isolate(), mem->data, String::NewFromUtf8(env->isolate(), mem->data,
String::kNormalString, NewStringType::kNormal,
mem->length)).FromJust(); mem->length).ToLocalChecked()).FromJust();
USE(BIO_reset(bio.get())); USE(BIO_reset(bio.get()));
} }
@ -1626,8 +1626,8 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
BIO_get_mem_ptr(bio.get(), &mem); BIO_get_mem_ptr(bio.get(), &mem);
info->Set(context, env->modulus_string(), info->Set(context, env->modulus_string(),
String::NewFromUtf8(env->isolate(), mem->data, String::NewFromUtf8(env->isolate(), mem->data,
String::kNormalString, NewStringType::kNormal,
mem->length)).FromJust(); mem->length).ToLocalChecked()).FromJust();
USE(BIO_reset(bio.get())); USE(BIO_reset(bio.get()));
uint64_t exponent_word = static_cast<uint64_t>(BN_get_word(e)); uint64_t exponent_word = static_cast<uint64_t>(BN_get_word(e));
@ -1641,8 +1641,8 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
BIO_get_mem_ptr(bio.get(), &mem); BIO_get_mem_ptr(bio.get(), &mem);
info->Set(context, env->exponent_string(), info->Set(context, env->exponent_string(),
String::NewFromUtf8(env->isolate(), mem->data, String::NewFromUtf8(env->isolate(), mem->data,
String::kNormalString, NewStringType::kNormal,
mem->length)).FromJust(); mem->length).ToLocalChecked()).FromJust();
USE(BIO_reset(bio.get())); USE(BIO_reset(bio.get()));
int size = i2d_RSA_PUBKEY(rsa.get(), nullptr); int size = i2d_RSA_PUBKEY(rsa.get(), nullptr);
@ -1661,16 +1661,16 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
BIO_get_mem_ptr(bio.get(), &mem); BIO_get_mem_ptr(bio.get(), &mem);
info->Set(context, env->valid_from_string(), info->Set(context, env->valid_from_string(),
String::NewFromUtf8(env->isolate(), mem->data, String::NewFromUtf8(env->isolate(), mem->data,
String::kNormalString, NewStringType::kNormal,
mem->length)).FromJust(); mem->length).ToLocalChecked()).FromJust();
USE(BIO_reset(bio.get())); USE(BIO_reset(bio.get()));
ASN1_TIME_print(bio.get(), X509_get_notAfter(cert)); ASN1_TIME_print(bio.get(), X509_get_notAfter(cert));
BIO_get_mem_ptr(bio.get(), &mem); BIO_get_mem_ptr(bio.get(), &mem);
info->Set(context, env->valid_to_string(), info->Set(context, env->valid_to_string(),
String::NewFromUtf8(env->isolate(), mem->data, String::NewFromUtf8(env->isolate(), mem->data,
String::kNormalString, NewStringType::kNormal,
mem->length)).FromJust(); mem->length).ToLocalChecked()).FromJust();
bio.reset(); bio.reset();
unsigned char md[EVP_MAX_MD_SIZE]; unsigned char md[EVP_MAX_MD_SIZE];

View File

@ -794,8 +794,8 @@ static void InternalModuleReadJSON(const FunctionCallbackInfo<Value>& args) {
Local<String> chars_string = Local<String> chars_string =
String::NewFromUtf8(env->isolate(), String::NewFromUtf8(env->isolate(),
&chars[start], &chars[start],
String::kNormalString, v8::NewStringType::kNormal,
size); size).ToLocalChecked();
args.GetReturnValue().Set(chars_string); args.GetReturnValue().Set(chars_string);
} }
} }

View File

@ -552,7 +552,7 @@ void GetVersion(const FunctionCallbackInfo<Value>& args) {
TYPE_ICU "," TYPE_ICU ","
TYPE_UNICODE "," TYPE_UNICODE ","
TYPE_CLDR "," TYPE_CLDR ","
TYPE_TZ)); TYPE_TZ, v8::NewStringType::kNormal).ToLocalChecked());
} else { } else {
CHECK_GE(args.Length(), 1); CHECK_GE(args.Length(), 1);
CHECK(args[0]->IsString()); CHECK(args[0]->IsString());
@ -565,7 +565,7 @@ void GetVersion(const FunctionCallbackInfo<Value>& args) {
// Success. // Success.
args.GetReturnValue().Set( args.GetReturnValue().Set(
String::NewFromUtf8(env->isolate(), String::NewFromUtf8(env->isolate(),
versionString)); versionString, v8::NewStringType::kNormal).ToLocalChecked());
} }
} }
} }

View File

@ -72,9 +72,11 @@ struct sockaddr;
do { \ do { \
v8::Isolate* isolate = target->GetIsolate(); \ v8::Isolate* isolate = target->GetIsolate(); \
v8::Local<v8::String> constant_name = \ v8::Local<v8::String> constant_name = \
v8::String::NewFromUtf8(isolate, name); \ v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kNormal) \
.ToLocalChecked(); \
v8::Local<v8::String> constant_value = \ v8::Local<v8::String> constant_value = \
v8::String::NewFromUtf8(isolate, constant); \ v8::String::NewFromUtf8(isolate, constant, v8::NewStringType::kNormal)\
.ToLocalChecked(); \
v8::PropertyAttribute constant_attributes = \ v8::PropertyAttribute constant_attributes = \
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \ static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
target->DefineOwnProperty(isolate->GetCurrentContext(), \ target->DefineOwnProperty(isolate->GetCurrentContext(), \

View File

@ -261,7 +261,8 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
// contain non-ASCII characters. On UNIX, it's just a binary string with // contain non-ASCII characters. On UNIX, it's just a binary string with
// no particular encoding but we treat it as a one-byte Latin-1 string. // no particular encoding but we treat it as a one-byte Latin-1 string.
#ifdef _WIN32 #ifdef _WIN32
name = String::NewFromUtf8(env->isolate(), raw_name); name = String::NewFromUtf8(env->isolate(), raw_name,
v8::NewStringType::kNormal).ToLocalChecked();
#else #else
name = OneByteString(env->isolate(), raw_name); name = OneByteString(env->isolate(), raw_name);
#endif #endif
@ -335,8 +336,8 @@ static void GetHomeDirectory(const FunctionCallbackInfo<Value>& args) {
Local<String> home = String::NewFromUtf8(env->isolate(), Local<String> home = String::NewFromUtf8(env->isolate(),
buf, buf,
String::kNormalString, v8::NewStringType::kNormal,
len); len).ToLocalChecked();
args.GetReturnValue().Set(home); args.GetReturnValue().Set(home);
} }

View File

@ -75,14 +75,18 @@ inline void InitObject(const PerformanceEntry& entry, Local<Object> obj) {
env->name_string(), env->name_string(),
String::NewFromUtf8(isolate, String::NewFromUtf8(isolate,
entry.name().c_str(), entry.name().c_str(),
String::kNormalString), v8::NewStringType::kNormal)
attr).FromJust(); .ToLocalChecked(),
attr)
.FromJust();
obj->DefineOwnProperty(context, obj->DefineOwnProperty(context,
FIXED_ONE_BYTE_STRING(isolate, "entryType"), FIXED_ONE_BYTE_STRING(isolate, "entryType"),
String::NewFromUtf8(isolate, String::NewFromUtf8(isolate,
entry.type().c_str(), entry.type().c_str(),
String::kNormalString), v8::NewStringType::kNormal)
attr).FromJust(); .ToLocalChecked(),
attr)
.FromJust();
obj->DefineOwnProperty(context, obj->DefineOwnProperty(context,
FIXED_ONE_BYTE_STRING(isolate, "startTime"), FIXED_ONE_BYTE_STRING(isolate, "startTime"),
Number::New(isolate, entry.startTime()), Number::New(isolate, entry.startTime()),

View File

@ -114,8 +114,8 @@ void Cwd(const FunctionCallbackInfo<Value>& args) {
Local<String> cwd = String::NewFromUtf8(env->isolate(), Local<String> cwd = String::NewFromUtf8(env->isolate(),
buf, buf,
String::kNormalString, v8::NewStringType::kNormal,
cwd_len); cwd_len).ToLocalChecked();
args.GetReturnValue().Set(cwd); args.GetReturnValue().Set(cwd);
} }

View File

@ -683,7 +683,10 @@ Local<Object> SyncProcessRunner::BuildResultObject() {
if (term_signal_ > 0) if (term_signal_ > 0)
js_result->Set(context, env()->signal_string(), js_result->Set(context, env()->signal_string(),
String::NewFromUtf8(env()->isolate(), String::NewFromUtf8(env()->isolate(),
signo_string(term_signal_))).FromJust(); signo_string(term_signal_),
v8::NewStringType::kNormal)
.ToLocalChecked())
.FromJust();
else else
js_result->Set(context, env()->signal_string(), js_result->Set(context, env()->signal_string(),
Null(env()->isolate())).FromJust(); Null(env()->isolate())).FromJust();