@@ -488,8 +488,12 @@ Maybe<bool> Message::Serialize(Environment* env,
488
488
Local<Object> entry = entry_val.As <Object>();
489
489
// See https://github.com/nodejs/node/pull/30339#issuecomment-552225353
490
490
// for details.
491
- if (entry->HasPrivate (context, env->untransferable_object_private_symbol ())
492
- .ToChecked ()) {
491
+ bool ans;
492
+ if (!entry->HasPrivate (context, env->untransferable_object_private_symbol ())
493
+ .To (&ans)) {
494
+ return Nothing<bool >();
495
+ }
496
+ if (ans) {
493
497
ThrowDataCloneException (context, env->transfer_unsupported_type_str ());
494
498
return Nothing<bool >();
495
499
}
@@ -587,7 +591,9 @@ Maybe<bool> Message::Serialize(Environment* env,
587
591
for (Local<ArrayBuffer> ab : array_buffers) {
588
592
// If serialization succeeded, we render it inaccessible in this Isolate.
589
593
std::shared_ptr<BackingStore> backing_store = ab->GetBackingStore ();
590
- ab->Detach (Local<Value>()).Check ();
594
+ if (ab->Detach (Local<Value>()).IsNothing ()) {
595
+ return Nothing<bool >();
596
+ }
591
597
592
598
array_buffers_.emplace_back (std::move (backing_store));
593
599
}
@@ -1068,7 +1074,10 @@ bool GetTransferList(Environment* env,
1068
1074
void MessagePort::PostMessage (const FunctionCallbackInfo<Value>& args) {
1069
1075
Environment* env = Environment::GetCurrent (args);
1070
1076
Local<Object> obj = args.This ();
1071
- Local<Context> context = obj->GetCreationContextChecked ();
1077
+ Local<Context> context;
1078
+ if (!obj->GetCreationContext ().ToLocal (&context)) {
1079
+ return ;
1080
+ }
1072
1081
1073
1082
if (args.Length () == 0 ) {
1074
1083
return THROW_ERR_MISSING_ARGS (env, " Not enough arguments to "
@@ -1155,11 +1164,15 @@ void MessagePort::ReceiveMessage(const FunctionCallbackInfo<Value>& args) {
1155
1164
return ;
1156
1165
}
1157
1166
1158
- MaybeLocal<Value> payload =
1159
- port->ReceiveMessage (port->object ()->GetCreationContextChecked (),
1160
- MessageProcessingMode::kForceReadMessages );
1161
- if (!payload.IsEmpty ())
1162
- args.GetReturnValue ().Set (payload.ToLocalChecked ());
1167
+ Local<Value> payload;
1168
+ Local<Context> context;
1169
+ if (!port->object ()->GetCreationContext ().ToLocal (&context)) {
1170
+ return ;
1171
+ }
1172
+ if (port->ReceiveMessage (context, MessageProcessingMode::kForceReadMessages )
1173
+ .ToLocal (&payload)) {
1174
+ args.GetReturnValue ().Set (payload);
1175
+ }
1163
1176
}
1164
1177
1165
1178
void MessagePort::MoveToContext (const FunctionCallbackInfo<Value>& args) {
@@ -1615,7 +1628,10 @@ static void MessageChannel(const FunctionCallbackInfo<Value>& args) {
1615
1628
return ;
1616
1629
}
1617
1630
1618
- Local<Context> context = args.This ()->GetCreationContextChecked ();
1631
+ Local<Context> context;
1632
+ if (!args.This ()->GetCreationContext ().ToLocal (&context)) {
1633
+ return ;
1634
+ }
1619
1635
Context::Scope context_scope (context);
1620
1636
1621
1637
MessagePort* port1 = MessagePort::New (env, context);
0 commit comments