Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e3fd752

Browse filesBrowse files
committed
src: pass along errors from tls object creation
PR-URL: #25822 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent 823fd5b commit e3fd752
Copy full SHA for e3fd752

File tree

Expand file treeCollapse file tree

2 files changed

+11
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-5
lines changed
Open diff view settings
Collapse file

‎src/tls_wrap.cc‎

Copy file name to clipboardExpand all lines: src/tls_wrap.cc
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,11 @@ using v8::String;
4848
using v8::Value;
4949

5050
TLSWrap::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
}
Collapse file

‎src/tls_wrap.h‎

Copy file name to clipboardExpand all lines: src/tls_wrap.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.