@@ -1627,10 +1627,15 @@ static void MessageChannel(const FunctionCallbackInfo<Value>& args) {
|
1627 | 1627 | |
1628 | 1628 | MessagePort::Entangle(port1, port2); |
1629 | 1629 | |
1630 | | - args.This()->Set(context, env->port1_string(), port1->object()) |
1631 | | - .Check(); |
1632 | | - args.This()->Set(context, env->port2_string(), port2->object()) |
1633 | | - .Check(); |
| 1630 | +if (args.This() |
| 1631 | + ->Set(context, env->port1_string(), port1->object()) |
| 1632 | + .IsNothing() || |
| 1633 | + args.This() |
| 1634 | + ->Set(context, env->port2_string(), port2->object()) |
| 1635 | + .IsNothing()) { |
| 1636 | + port1->Close(); |
| 1637 | + port2->Close(); |
| 1638 | + } |
1634 | 1639 | } |
1635 | 1640 | |
1636 | 1641 | static void BroadcastChannel(const FunctionCallbackInfo<Value>& args) { |
|