diff --git a/src/node.cc b/src/node.cc index fd65fbff0bddf3..c8299f9a3614b7 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1687,23 +1687,21 @@ static const char* name_by_gid(gid_t gid) { #endif -static uid_t uid_by_name(Handle value) { +static uid_t uid_by_name(Isolate* isolate, Handle value) { if (value->IsUint32()) { return static_cast(value->Uint32Value()); } else { - // TODO(trevnorris): Fix to not use GetCurrent(). - node::Utf8Value name(Isolate::GetCurrent(), value); + node::Utf8Value name(isolate, value); return uid_by_name(*name); } } -static gid_t gid_by_name(Handle value) { +static gid_t gid_by_name(Isolate* isolate, Handle value) { if (value->IsUint32()) { return static_cast(value->Uint32Value()); } else { - // TODO(trevnorris): Fix to not use GetCurrent(). - node::Utf8Value name(Isolate::GetCurrent(), value); + node::Utf8Value name(isolate, value); return gid_by_name(*name); } } @@ -1728,7 +1726,7 @@ static void SetGid(const FunctionCallbackInfo& args) { return env->ThrowTypeError("setgid argument must be a number or a string"); } - gid_t gid = gid_by_name(args[0]); + gid_t gid = gid_by_name(env->isolate(), args[0]); if (gid == gid_not_found) { return env->ThrowError("setgid group id does not exist"); @@ -1747,7 +1745,7 @@ static void SetUid(const FunctionCallbackInfo& args) { return env->ThrowTypeError("setuid argument must be a number or a string"); } - uid_t uid = uid_by_name(args[0]); + uid_t uid = uid_by_name(env->isolate(), args[0]); if (uid == uid_not_found) { return env->ThrowError("setuid user id does not exist"); @@ -1809,7 +1807,7 @@ static void SetGroups(const FunctionCallbackInfo& args) { gid_t* groups = new gid_t[size]; for (size_t i = 0; i < size; i++) { - gid_t gid = gid_by_name(groups_list->Get(i)); + gid_t gid = gid_by_name(env->isolate(), groups_list->Get(i)); if (gid == gid_not_found) { delete[] groups; @@ -1856,7 +1854,7 @@ static void InitGroups(const FunctionCallbackInfo& args) { return env->ThrowError("initgroups user not found"); } - extra_group = gid_by_name(args[1]); + extra_group = gid_by_name(env->isolate(), args[1]); if (extra_group == gid_not_found) { if (must_free) diff --git a/src/node.h b/src/node.h index 097441e107009c..4787783b6838cd 100644 --- a/src/node.h +++ b/src/node.h @@ -190,7 +190,7 @@ NODE_EXTERN void RunAtExit(Environment* env); // Used to be a macro, hence the uppercase name. #define NODE_DEFINE_CONSTANT(target, constant) \ do { \ - v8::Isolate* isolate = v8::Isolate::GetCurrent(); \ + v8::Isolate* isolate = target->GetIsolate(); \ v8::Local constant_name = \ v8::String::NewFromUtf8(isolate, #constant); \ v8::Local constant_value = \ diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h index d00e1484b7c10c..93c73a05752dcf 100644 --- a/src/node_object_wrap.h +++ b/src/node_object_wrap.h @@ -36,7 +36,7 @@ class ObjectWrap { inline v8::Local handle() { - return handle(v8::Isolate::GetCurrent()); + return v8::Local::New(handle_->GetIsolate(), persistent()); } diff --git a/src/smalloc.cc b/src/smalloc.cc index ad2ae3c29f93bc..eda13c7e457fa4 100644 --- a/src/smalloc.cc +++ b/src/smalloc.cc @@ -472,8 +472,7 @@ const char RetainedAllocInfo::label_[] = "smalloc"; RetainedAllocInfo::RetainedAllocInfo(Handle wrapper) { - // TODO(trevnorris): Fix to properly acquire the Isolate. - Local obj = wrapper->ToObject(Isolate::GetCurrent()); + Local obj = wrapper.As(); length_ = obj->GetIndexedPropertiesExternalArrayDataLength(); data_ = static_cast(obj->GetIndexedPropertiesExternalArrayData()); }