File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Open diff view settings
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Open diff view settings
Original file line number Diff line number Diff line change @@ -48,13 +48,11 @@ using v8::String;
4848using v8::Value;
4949
5050TLSWrap::TLSWrap (Environment* env,
51+ Local<Object> obj,
5152 Kind kind,
5253 StreamBase* stream,
5354 SecureContext* sc)
54- : AsyncWrap(env,
55- env->tls_wrap_constructor_function ()
56- ->NewInstance(env->context ()).ToLocalChecked(),
57- AsyncWrap::PROVIDER_TLSWRAP),
55+ : AsyncWrap(env, obj, AsyncWrap::PROVIDER_TLSWRAP),
5856 SSLWrap<TLSWrap>(env, sc, kind),
5957 StreamBase (env),
6058 sc_(sc) {
@@ -159,7 +157,14 @@ void TLSWrap::Wrap(const FunctionCallbackInfo<Value>& args) {
159157 StreamBase* stream = static_cast <StreamBase*>(stream_obj->Value ());
160158 CHECK_NOT_NULL (stream);
161159
162- TLSWrap* res = new TLSWrap (env, kind, stream, Unwrap<SecureContext>(sc));
160+ Local<Object> obj;
161+ if (!env->tls_wrap_constructor_function ()
162+ ->NewInstance (env->context ())
163+ .ToLocal (&obj)) {
164+ return ;
165+ }
166+
167+ TLSWrap* res = new TLSWrap (env, obj, kind, stream, Unwrap<SecureContext>(sc));
163168
164169 args.GetReturnValue ().Set (res->object ());
165170}
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ class TLSWrap : public AsyncWrap,
108108 static const int kSimultaneousBufferCount = 10 ;
109109
110110 TLSWrap (Environment* env,
111+ v8::Local<v8::Object> obj,
111112 Kind kind,
112113 StreamBase* stream,
113114 crypto::SecureContext* sc);
You can’t perform that action at this time.
0 commit comments