Skip to content

Commit

Permalink
contextify: use v8::DeserializeInternalFieldsCallback explicitly
Browse files Browse the repository at this point in the history
To avoid ambiguity in the signature.
  • Loading branch information
joyeecheung committed Nov 30, 2023
1 parent a3ee187 commit db7c4ea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 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
7 changes: 6 additions & 1 deletion test/cctest/test_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,12 @@ 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());
isolate_,
nullptr,
{},
{},
v8::DeserializeInternalFieldsCallback(),
queue.get());
node::InitializeContext(context);
v8::Context::Scope context_scope(context);

Expand Down

0 comments on commit db7c4ea

Please sign in to comment.