@@ -491,8 +491,12 @@ Maybe<bool> Message::Serialize(Environment* env,
491491 Local<Object> entry = entry_val.As <Object>();
492492 // See https://github.com/nodejs/node/pull/30339#issuecomment-552225353
493493 // for details.
494- if (entry->HasPrivate (context, env->untransferable_object_private_symbol ())
495- .ToChecked ()) {
494+ bool ans;
495+ if (!entry->HasPrivate (context, env->untransferable_object_private_symbol ())
496+ .To (&ans)) {
497+ return Nothing<bool >();
498+ }
499+ if (ans) {
496500 ThrowDataCloneException (context, env->transfer_unsupported_type_str ());
497501 return Nothing<bool >();
498502 }
@@ -591,7 +595,9 @@ Maybe<bool> Message::Serialize(Environment* env,
591595 for (Local<ArrayBuffer> ab : array_buffers) {
592596 // If serialization succeeded, we render it inaccessible in this Isolate.
593597 std::shared_ptr<BackingStore> backing_store = ab->GetBackingStore ();
594- ab->Detach (Local<Value>()).Check ();
598+ if (ab->Detach (Local<Value>()).IsNothing ()) {
599+ return Nothing<bool >();
600+ }
595601
596602 array_buffers_.emplace_back (std::move (backing_store));
597603 }
@@ -1073,7 +1079,10 @@ bool GetTransferList(Environment* env,
10731079void MessagePort::PostMessage (const FunctionCallbackInfo<Value>& args) {
10741080 Environment* env = Environment::GetCurrent (args);
10751081 Local<Object> obj = args.This ();
1076- Local<Context> context = obj->GetCreationContextChecked ();
1082+ Local<Context> context;
1083+ if (!obj->GetCreationContext ().ToLocal (&context)) {
1084+ return ;
1085+ }
10771086
10781087 if (args.Length () == 0 ) {
10791088 return THROW_ERR_MISSING_ARGS (env, " Not enough arguments to "
@@ -1160,8 +1169,11 @@ void MessagePort::ReceiveMessage(const FunctionCallbackInfo<Value>& args) {
11601169 }
11611170
11621171 Local<Value> payload;
1163- if (port->ReceiveMessage (port->object ()->GetCreationContextChecked (),
1164- MessageProcessingMode::kForceReadMessages )
1172+ Local<Context> context;
1173+ if (!port->object ()->GetCreationContext ().ToLocal (&context)) {
1174+ return ;
1175+ }
1176+ if (port->ReceiveMessage (context, MessageProcessingMode::kForceReadMessages )
11651177 .ToLocal (&payload)) {
11661178 args.GetReturnValue ().Set (payload);
11671179 }
@@ -1619,7 +1631,10 @@ static void MessageChannel(const FunctionCallbackInfo<Value>& args) {
16191631 return ;
16201632 }
16211633
1622- Local<Context> context = args.This ()->GetCreationContextChecked ();
1634+ Local<Context> context;
1635+ if (!args.This ()->GetCreationContext ().ToLocal (&context)) {
1636+ return ;
1637+ }
16231638 Context::Scope context_scope (context);
16241639
16251640 MessagePort* port1 = MessagePort::New (env, context);
0 commit comments