Skip to content

Commit

Permalink
vm: use v8::DeserializeInternalFieldsCallback explicitly
Browse files Browse the repository at this point in the history
To avoid ambiguity in the signature.

PR-URL: #50984
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
  • Loading branch information
joyeecheung committed Dec 14, 2023
1 parent 4b76cce commit 429ec83
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
27 changes: 15 additions & 12 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,24 @@ MaybeLocal<Context> ContextifyContext::CreateV8Context(

Local<Context> 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<Context>();
}
} 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<Context>();
}
Expand Down
9 changes: 7 additions & 2 deletions test/cctest/test_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,13 @@ TEST_F(EnvironmentTest, NestedMicrotaskQueue) {

std::unique_ptr<v8::MicrotaskQueue> queue = v8::MicrotaskQueue::New(
isolate_, v8::MicrotasksPolicy::kExplicit);
v8::Local<v8::Context> context = v8::Context::New(
isolate_, nullptr, {}, {}, {}, queue.get());
v8::Local<v8::Context> context =
v8::Context::New(isolate_,
nullptr,
{},
{},
v8::DeserializeInternalFieldsCallback(),
queue.get());
node::InitializeContext(context);
v8::Context::Scope context_scope(context);

Expand Down

0 comments on commit 429ec83

Please sign in to comment.