From 07fc077c5d83ab4337c4f4fd76ebfea0815ff4b3 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 6 Sep 2023 15:03:35 +0200 Subject: [PATCH] vm: use v8::DeserializeInternalFieldsCallback explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid ambiguity in the signature. PR-URL: https://github.com/nodejs/node/pull/50984 Reviewed-By: Yagiz Nizipli Reviewed-By: Tobias Nießen Reviewed-By: Daeyeon Jeong Reviewed-By: James M Snell Reviewed-By: Chengzhong Wu --- src/node_contextify.cc | 27 +++++++++++++++------------ test/cctest/test_environment.cc | 9 +++++++-- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index ac159bee1473e8..f5c692dd0855ee 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -208,21 +208,24 @@ MaybeLocal ContextifyContext::CreateV8Context( Local ctx; if (snapshot_data == nullptr) { - ctx = Context::New(isolate, - nullptr, // extensions - object_template, - {}, // global object - {}, // deserialization callback - queue); + ctx = Context::New( + isolate, + nullptr, // extensions + object_template, + {}, // global object + v8::DeserializeInternalFieldsCallback(), // deserialization callback + queue); if (ctx.IsEmpty() || InitializeBaseContextForSnapshot(ctx).IsNothing()) { return MaybeLocal(); } - } else if (!Context::FromSnapshot(isolate, - SnapshotData::kNodeVMContextIndex, - {}, // deserialization callback - nullptr, // extensions - {}, // global object - queue) + } else if (!Context::FromSnapshot( + isolate, + SnapshotData::kNodeVMContextIndex, + v8::DeserializeInternalFieldsCallback(), // deserialization + // callback + nullptr, // extensions + {}, // global object + queue) .ToLocal(&ctx)) { return MaybeLocal(); } diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc index 2e747c7be58922..9b812408154287 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -686,8 +686,13 @@ TEST_F(EnvironmentTest, NestedMicrotaskQueue) { std::unique_ptr queue = v8::MicrotaskQueue::New( isolate_, v8::MicrotasksPolicy::kExplicit); - v8::Local context = v8::Context::New( - isolate_, nullptr, {}, {}, {}, queue.get()); + v8::Local context = + v8::Context::New(isolate_, + nullptr, + {}, + {}, + v8::DeserializeInternalFieldsCallback(), + queue.get()); node::InitializeContext(context); v8::Context::Scope context_scope(context);