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 <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
  • Loading branch information
joyeecheung authored and RafaelGSS committed Dec 15, 2023
1 parent cc94986 commit e178a43
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 e178a43

Please sign in to comment.