Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarshan Sen <darshan.sen@postman.com>2021-10-12 13:02:03 +0300
committerNode.js GitHub Bot <github-bot@iojs.org>2021-10-20 18:32:54 +0300
commit516cdcd8aaf4c693711d3359bcd45e0dac568b0c (patch)
treeba934d2b49b752cd755fcdd819829e5c271a3c76 /src/stream_pipe.cc
parent7ed303bebadecb08ed1a9deb914469c51acadec3 (diff)
src,stream: remove `*Check*()` calls from non-`Initialize()` functions
There is no need to crash the process if any of these checks fail. Signed-off-by: Darshan Sen <darshan.sen@postman.com> PR-URL: https://github.com/nodejs/node/pull/40425 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/stream_pipe.cc')
-rw-r--r--src/stream_pipe.cc31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/stream_pipe.cc b/src/stream_pipe.cc
index aa636dbb75e..94ba8604bd7 100644
--- a/src/stream_pipe.cc
+++ b/src/stream_pipe.cc
@@ -33,14 +33,26 @@ StreamPipe::StreamPipe(StreamBase* source,
// In particular, this makes sure that they are garbage collected as a group,
// if that applies to the given streams (for example, Http2Streams use
// weak references).
- obj->Set(env()->context(), env()->source_string(), source->GetObject())
- .Check();
- source->GetObject()->Set(env()->context(), env()->pipe_target_string(), obj)
- .Check();
- obj->Set(env()->context(), env()->sink_string(), sink->GetObject())
- .Check();
- sink->GetObject()->Set(env()->context(), env()->pipe_source_string(), obj)
- .Check();
+ if (obj->Set(env()->context(),
+ env()->source_string(),
+ source->GetObject()).IsNothing()) {
+ return;
+ }
+ if (source->GetObject()->Set(env()->context(),
+ env()->pipe_target_string(),
+ obj).IsNothing()) {
+ return;
+ }
+ if (obj->Set(env()->context(),
+ env()->sink_string(),
+ sink->GetObject()).IsNothing()) {
+ return;
+ }
+ if (sink->GetObject()->Set(env()->context(),
+ env()->pipe_source_string(),
+ obj).IsNothing()) {
+ return;
+ }
}
StreamPipe::~StreamPipe() {
@@ -172,7 +184,8 @@ void StreamPipe::WritableListener::OnStreamAfterWrite(WriteWrap* w,
Environment* env = pipe->env();
HandleScope handle_scope(env->isolate());
Context::Scope context_scope(env->context());
- pipe->MakeCallback(env->oncomplete_string(), 0, nullptr).ToLocalChecked();
+ if (pipe->MakeCallback(env->oncomplete_string(), 0, nullptr).IsEmpty())
+ return;
stream()->RemoveStreamListener(this);
}
return;