summaryrefslogtreecommitdiff
path: root/src/node_messaging.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2021-02-28 17:45:24 +0100
committerMichaël Zasso <targos@protonmail.com>2021-03-15 15:56:25 +0100
commit8e8dea36cc98050371bdc2a3c462399b78a6c0f2 (patch)
treead54fa524a95351ffb642041b47ab3c7ae09b509 /src/node_messaging.cc
parentb1c1c4695ca246e8421341d7d7616100a4e91791 (diff)
downloadnode-new-8e8dea36cc98050371bdc2a3c462399b78a6c0f2.tar.gz
src: use non-deprecated GetCreationContext from V8
Fixes: https://github.com/nodejs/node-v8/issues/193 PR-URL: https://github.com/nodejs/node/pull/37587 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'src/node_messaging.cc')
-rw-r--r--src/node_messaging.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/node_messaging.cc b/src/node_messaging.cc
index 595f793a62..fbe6c407a6 100644
--- a/src/node_messaging.cc
+++ b/src/node_messaging.cc
@@ -727,7 +727,8 @@ MaybeLocal<Value> MessagePort::ReceiveMessage(Local<Context> context,
void MessagePort::OnMessage(MessageProcessingMode mode) {
Debug(this, "Running MessagePort::OnMessage()");
HandleScope handle_scope(env()->isolate());
- Local<Context> context = object(env()->isolate())->CreationContext();
+ Local<Context> context =
+ object(env()->isolate())->GetCreationContext().ToLocalChecked();
size_t processing_limit;
if (mode == MessageProcessingMode::kNormalOperation) {
@@ -843,7 +844,7 @@ Maybe<bool> MessagePort::PostMessage(Environment* env,
const TransferList& transfer_v) {
Isolate* isolate = env->isolate();
Local<Object> obj = object(isolate);
- Local<Context> context = obj->CreationContext();
+ Local<Context> context = obj->GetCreationContext().ToLocalChecked();
std::shared_ptr<Message> msg = std::make_shared<Message>();
@@ -941,7 +942,7 @@ static Maybe<bool> ReadIterable(Environment* env,
void MessagePort::PostMessage(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
Local<Object> obj = args.This();
- Local<Context> context = obj->CreationContext();
+ Local<Context> context = obj->GetCreationContext().ToLocalChecked();
if (args.Length() == 0) {
return THROW_ERR_MISSING_ARGS(env, "Not enough arguments to "
@@ -1049,9 +1050,9 @@ void MessagePort::ReceiveMessage(const FunctionCallbackInfo<Value>& args) {
return;
}
- MaybeLocal<Value> payload =
- port->ReceiveMessage(port->object()->CreationContext(),
- MessageProcessingMode::kForceReadMessages);
+ MaybeLocal<Value> payload = port->ReceiveMessage(
+ port->object()->GetCreationContext().ToLocalChecked(),
+ MessageProcessingMode::kForceReadMessages);
if (!payload.IsEmpty())
args.GetReturnValue().Set(payload.ToLocalChecked());
}
@@ -1410,7 +1411,7 @@ static void MessageChannel(const FunctionCallbackInfo<Value>& args) {
return;
}
- Local<Context> context = args.This()->CreationContext();
+ Local<Context> context = args.This()->GetCreationContext().ToLocalChecked();
Context::Scope context_scope(context);
MessagePort* port1 = MessagePort::New(env, context);