@@ -111,9 +111,10 @@ static void SafeGetenv(const FunctionCallbackInfo<Value>& args) {
111
111
Utf8Value strenvtag (isolate, args[0 ]);
112
112
std::string text;
113
113
if (!SafeGetenv (*strenvtag, &text, env)) return ;
114
- Local<Value> result =
115
- ToV8Value (isolate->GetCurrentContext (), text).ToLocalChecked ();
116
- args.GetReturnValue ().Set (result);
114
+ Local<Value> result;
115
+ if (ToV8Value (isolate->GetCurrentContext (), text).ToLocal (&result)) {
116
+ args.GetReturnValue ().Set (result);
117
+ }
117
118
}
118
119
119
120
static void GetTempDir (const FunctionCallbackInfo<Value>& args) {
@@ -137,8 +138,10 @@ static void GetTempDir(const FunctionCallbackInfo<Value>& args) {
137
138
dir.pop_back ();
138
139
}
139
140
140
- args.GetReturnValue ().Set (
141
- ToV8Value (isolate->GetCurrentContext (), dir).ToLocalChecked ());
141
+ Local<Value> result;
142
+ if (ToV8Value (isolate->GetCurrentContext (), dir).ToLocal (&result)) {
143
+ args.GetReturnValue ().Set (result);
144
+ }
142
145
}
143
146
144
147
#ifdef NODE_IMPLEMENTS_POSIX_CREDENTIALS
@@ -385,9 +388,10 @@ static void GetGroups(const FunctionCallbackInfo<Value>& args) {
385
388
gid_t egid = getegid ();
386
389
if (std::find (groups.begin (), groups.end (), egid) == groups.end ())
387
390
groups.push_back (egid);
388
- MaybeLocal<Value> array = ToV8Value (env->context (), groups);
389
- if (!array.IsEmpty ())
390
- args.GetReturnValue ().Set (array.ToLocalChecked ());
391
+ Local<Value> result;
392
+ if (ToV8Value (env->context (), groups).ToLocal (&result)) {
393
+ args.GetReturnValue ().Set (result);
394
+ }
391
395
}
392
396
393
397
static void SetGroups (const FunctionCallbackInfo<Value>& args) {
@@ -403,8 +407,12 @@ static void SetGroups(const FunctionCallbackInfo<Value>& args) {
403
407
MaybeStackBuffer<gid_t , 64 > groups (size);
404
408
405
409
for (size_t i = 0 ; i < size; i++) {
406
- gid_t gid = gid_by_name (
407
- env->isolate (), groups_list->Get (env->context (), i).ToLocalChecked ());
410
+ Local<Value> val;
411
+ if (!groups_list->Get (env->context (), i).ToLocal (&val)) {
412
+ // V8 will have scheduled an error to be thrown.
413
+ return ;
414
+ }
415
+ gid_t gid = gid_by_name (env->isolate (), val);
408
416
409
417
if (gid == gid_not_found) {
410
418
// Tells JS to throw ERR_INVALID_CREDENTIAL
0 commit comments