diff options
Diffstat (limited to 'src/node_util.cc')
-rw-r--r-- | src/node_util.cc | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/node_util.cc b/src/node_util.cc index 3eefa73739a..3f829081cb3 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -352,19 +352,15 @@ void Initialize(Local<Object> target, env->should_abort_on_uncaught_toggle().GetJSArray()) .FromJust()); - Local<String> weak_ref_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "WeakReference"); Local<FunctionTemplate> weak_ref = env->NewFunctionTemplate(WeakReference::New); weak_ref->InstanceTemplate()->SetInternalFieldCount( WeakReference::kInternalFieldCount); - weak_ref->SetClassName(weak_ref_string); weak_ref->Inherit(BaseObject::GetConstructorTemplate(env)); env->SetProtoMethod(weak_ref, "get", WeakReference::Get); env->SetProtoMethod(weak_ref, "incRef", WeakReference::IncRef); env->SetProtoMethod(weak_ref, "decRef", WeakReference::DecRef); - target->Set(context, weak_ref_string, - weak_ref->GetFunction(context).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "WeakReference", weak_ref); env->SetMethod(target, "guessHandleType", GuessHandleType); } |