diff --git a/src/node_messaging.cc b/src/node_messaging.cc index 82313cc754bcc8..0849d159748325 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -489,8 +489,12 @@ Maybe Message::Serialize(Environment* env, Local entry = entry_val.As(); // See https://github.com/nodejs/node/pull/30339#issuecomment-552225353 // for details. - if (entry->HasPrivate(context, env->untransferable_object_private_symbol()) - .ToChecked()) { + bool ans; + if (!entry->HasPrivate(context, env->untransferable_object_private_symbol()) + .To(&ans)) { + return Nothing(); + } + if (ans) { ThrowDataCloneException(context, env->transfer_unsupported_type_str()); return Nothing(); } @@ -589,7 +593,9 @@ Maybe Message::Serialize(Environment* env, for (Local ab : array_buffers) { // If serialization succeeded, we render it inaccessible in this Isolate. std::shared_ptr backing_store = ab->GetBackingStore(); - ab->Detach(Local()).Check(); + if (ab->Detach(Local()).IsNothing()) { + return Nothing(); + } array_buffers_.emplace_back(std::move(backing_store)); } @@ -1070,7 +1076,10 @@ bool GetTransferList(Environment* env, void MessagePort::PostMessage(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Local obj = args.This(); - Local context = obj->GetCreationContextChecked(); + Local context; + if (!obj->GetCreationContext().ToLocal(&context)) { + return; + } if (args.Length() == 0) { return THROW_ERR_MISSING_ARGS(env, "Not enough arguments to " @@ -1157,8 +1166,11 @@ void MessagePort::ReceiveMessage(const FunctionCallbackInfo& args) { } Local payload; - if (port->ReceiveMessage(port->object()->GetCreationContextChecked(), - MessageProcessingMode::kForceReadMessages) + Local context; + if (!port->object()->GetCreationContext().ToLocal(&context)) { + return; + } + if (port->ReceiveMessage(context, MessageProcessingMode::kForceReadMessages) .ToLocal(&payload)) { args.GetReturnValue().Set(payload); } @@ -1616,7 +1628,10 @@ static void MessageChannel(const FunctionCallbackInfo& args) { return; } - Local context = args.This()->GetCreationContextChecked(); + Local context; + if (!args.This()->GetCreationContext().ToLocal(&context)) { + return; + } Context::Scope context_scope(context); MessagePort* port1 = MessagePort::New(env, context);