Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
src: improve error handling in node_messaging.cc
PR-URL: #57211
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
jasnell authored and aduh95 committed Feb 28, 2025
commit 40deed2ebdf696dd0066cd318670ae12b841499f
13 changes: 9 additions & 4 deletions src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1627,10 +1627,15 @@ static void MessageChannel(const FunctionCallbackInfo<Value>& args) {

MessagePort::Entangle(port1, port2);

args.This()->Set(context, env->port1_string(), port1->object())
.Check();
args.This()->Set(context, env->port2_string(), port2->object())
.Check();
if (args.This()
->Set(context, env->port1_string(), port1->object())
.IsNothing() ||
args.This()
->Set(context, env->port2_string(), port2->object())
.IsNothing()) {
port1->Close();
port2->Close();
}
}

static void BroadcastChannel(const FunctionCallbackInfo<Value>& args) {
Expand Down