@@ -1121,8 +1121,10 @@ void QuicEndpoint::Initialize(
11211121 Isolate* isolate = env->isolate ();
11221122 Local<String> class_name = FIXED_ONE_BYTE_STRING (isolate, " QuicEndpoint" );
11231123 Local<FunctionTemplate> endpoint = env->NewFunctionTemplate (NewQuicEndpoint);
1124+ endpoint->Inherit (BaseObject::GetConstructorTemplate (env));
11241125 endpoint->SetClassName (class_name);
1125- endpoint->InstanceTemplate ()->SetInternalFieldCount (1 );
1126+ endpoint->InstanceTemplate ()->SetInternalFieldCount (
1127+ QuicEndpoint::kInternalFieldCount );
11261128 env->SetProtoMethod (endpoint,
11271129 " waitForPendingCallbacks" ,
11281130 QuicEndpointWaitForPendingCallbacks);
@@ -1142,8 +1144,10 @@ void QuicSocket::Initialize(
11421144 Isolate* isolate = env->isolate ();
11431145 Local<String> class_name = FIXED_ONE_BYTE_STRING (isolate, " QuicSocket" );
11441146 Local<FunctionTemplate> socket = env->NewFunctionTemplate (NewQuicSocket);
1147+ socket->Inherit (AsyncWrap::GetConstructorTemplate (env));
11451148 socket->SetClassName (class_name);
1146- socket->InstanceTemplate ()->SetInternalFieldCount (1 );
1149+ socket->InstanceTemplate ()->SetInternalFieldCount (
1150+ QuicSocket::kInternalFieldCount );
11471151 socket->InstanceTemplate ()->Set (env->owner_symbol (), Null (isolate));
11481152 env->SetProtoMethod (socket,
11491153 " addEndpoint" ,
@@ -1170,9 +1174,11 @@ void QuicSocket::Initialize(
11701174 target->Set (context, class_name,
11711175 socket->GetFunction (env->context ()).ToLocalChecked ()).FromJust ();
11721176
1173- // TODO(addaleax): None of these templates actually are constructor templates.
1174- Local<ObjectTemplate> sendwrap_template = ObjectTemplate::New (isolate);
1175- sendwrap_template->SetInternalFieldCount (1 );
1177+ Local<FunctionTemplate> sendwrap_ctor = FunctionTemplate::New (isolate);
1178+ sendwrap_ctor->Inherit (AsyncWrap::GetConstructorTemplate (env));
1179+ sendwrap_ctor->SetClassName (FIXED_ONE_BYTE_STRING (isolate, " SendWrap" ));
1180+ Local<ObjectTemplate> sendwrap_template = sendwrap_ctor->InstanceTemplate ();
1181+ sendwrap_template->SetInternalFieldCount (SendWrap::kInternalFieldCount );
11761182 env->set_quicsocketsendwrap_instance_template (sendwrap_template);
11771183}
11781184
0 commit comments