Index: test/cctest/test-serialize.cc |
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc |
index a5cd0337117d6ebd1ea68f74029e58125bc92968..ba3738e2e7413796c14bd46deea5eaf45be6ac2f 100644 |
--- a/test/cctest/test-serialize.cc |
+++ b/test/cctest/test-serialize.cc |
@@ -321,7 +321,7 @@ UNINITIALIZED_TEST(PartialSerializerObject) { |
{ |
SnapshotData snapshot_data(partial_blob); |
Deserializer deserializer(&snapshot_data); |
- root = deserializer.DeserializePartial(isolate, global_proxy) |
+ root = deserializer.DeserializePartial(isolate, global_proxy, nullptr) |
.ToHandleChecked(); |
CHECK(root->IsString()); |
} |
@@ -330,7 +330,7 @@ UNINITIALIZED_TEST(PartialSerializerObject) { |
{ |
SnapshotData snapshot_data(partial_blob); |
Deserializer deserializer(&snapshot_data); |
- root2 = deserializer.DeserializePartial(isolate, global_proxy) |
+ root2 = deserializer.DeserializePartial(isolate, global_proxy, nullptr) |
.ToHandleChecked(); |
CHECK(root2->IsString()); |
CHECK(root.is_identical_to(root2)); |
@@ -419,7 +419,7 @@ UNINITIALIZED_TEST(PartialSerializerContext) { |
{ |
SnapshotData snapshot_data(partial_blob); |
Deserializer deserializer(&snapshot_data); |
- root = deserializer.DeserializePartial(isolate, global_proxy) |
+ root = deserializer.DeserializePartial(isolate, global_proxy, nullptr) |
.ToHandleChecked(); |
CHECK(root->IsContext()); |
CHECK(Handle<Context>::cast(root)->global_proxy() == *global_proxy); |
@@ -429,7 +429,7 @@ UNINITIALIZED_TEST(PartialSerializerContext) { |
{ |
SnapshotData snapshot_data(partial_blob); |
Deserializer deserializer(&snapshot_data); |
- root2 = deserializer.DeserializePartial(isolate, global_proxy) |
+ root2 = deserializer.DeserializePartial(isolate, global_proxy, nullptr) |
.ToHandleChecked(); |
CHECK(root2->IsContext()); |
CHECK(!root.is_identical_to(root2)); |
@@ -539,7 +539,7 @@ UNINITIALIZED_TEST(PartialSerializerCustomContext) { |
{ |
SnapshotData snapshot_data(partial_blob); |
Deserializer deserializer(&snapshot_data); |
- root = deserializer.DeserializePartial(isolate, global_proxy) |
+ root = deserializer.DeserializePartial(isolate, global_proxy, nullptr) |
.ToHandleChecked(); |
CHECK(root->IsContext()); |
Handle<Context> context = Handle<Context>::cast(root); |
@@ -2203,6 +2203,8 @@ TEST(SnapshotCreatorTemplates) { |
global_template->Set(v8_str("f"), callback); |
v8::Local<v8::Context> context = |
v8::Context::New(isolate, no_extension, global_template); |
+ creator.SetDefaultContext(context); |
+ context = v8::Context::New(isolate, no_extension, global_template); |
v8::Local<v8::ObjectTemplate> object_template = |
v8::ObjectTemplate::New(isolate); |
object_template->SetInternalFieldCount(3); |
@@ -2229,12 +2231,12 @@ TEST(SnapshotCreatorTemplates) { |
c->SetInternalField(2, field_external); |
CHECK(context->Global()->Set(context, v8_str("a"), a).FromJust()); |
- creator.SetDefaultContext(context); |
+ CHECK_EQ(0u, creator.AddContext(context, SerializeInternalFields)); |
CHECK_EQ(0u, creator.AddTemplate(callback)); |
CHECK_EQ(1u, creator.AddTemplate(global_template)); |
} |
- blob = creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear, |
- SerializeInternalFields); |
+ blob = |
+ creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); |
delete a1; |
delete b0; |
@@ -2246,14 +2248,15 @@ TEST(SnapshotCreatorTemplates) { |
params.snapshot_blob = &blob; |
params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
params.external_references = original_external_references; |
- params.deserialize_internal_fields_callback = DeserializeInternalFields; |
v8::Isolate* isolate = v8::Isolate::New(params); |
{ |
v8::Isolate::Scope isolate_scope(isolate); |
{ |
// Create a new context without a new object template. |
v8::HandleScope handle_scope(isolate); |
- v8::Local<v8::Context> context = v8::Context::New(isolate); |
+ v8::Local<v8::Context> context = |
+ v8::Context::FromSnapshot(isolate, 0, DeserializeInternalFields) |
+ .ToLocalChecked(); |
v8::Context::Scope context_scope(context); |
ExpectInt32("f()", 42); |
@@ -2320,26 +2323,6 @@ TEST(SnapshotCreatorTemplates) { |
for (auto data : deserialized_data) delete data; |
deserialized_data.clear(); |
} |
- |
- { |
- // Create a context with a new object template. It is merged into the |
- // deserialized global object. |
- v8::HandleScope handle_scope(isolate); |
- v8::ExtensionConfiguration* no_extension = nullptr; |
- v8::Local<v8::ObjectTemplate> global_template = |
- v8::ObjectTemplate::New(isolate); |
- global_template->Set( |
- v8_str("g"), |
- v8::FunctionTemplate::New(isolate, SerializedCallbackReplacement)); |
- v8::Local<v8::Context> context = |
- v8::Context::New(isolate, no_extension, global_template); |
- v8::Context::Scope context_scope(context); |
- ExpectInt32("g()", 1337); |
- ExpectInt32("f()", 42); |
- |
- for (auto data : deserialized_data) delete data; |
- deserialized_data.clear(); |
- } |
} |
isolate->Dispose(); |
} |
@@ -2425,10 +2408,10 @@ TEST(SnapshotCreatorIncludeGlobalProxy) { |
.ToLocalChecked()) |
.FromJust()); |
- CHECK_EQ(0u, creator.AddContext(context)); |
+ CHECK_EQ(0u, creator.AddContext(context, SerializeInternalFields)); |
} |
- blob = creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear, |
- SerializeInternalFields); |
+ blob = |
+ creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); |
} |
{ |
@@ -2436,7 +2419,6 @@ TEST(SnapshotCreatorIncludeGlobalProxy) { |
params.snapshot_blob = &blob; |
params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
params.external_references = original_external_references; |
- params.deserialize_internal_fields_callback = DeserializeInternalFields; |
v8::Isolate* isolate = v8::Isolate::New(params); |
{ |
v8::Isolate::Scope isolate_scope(isolate); |
@@ -2470,7 +2452,8 @@ TEST(SnapshotCreatorIncludeGlobalProxy) { |
// will use the global object from the snapshot, including interceptor. |
v8::HandleScope handle_scope(isolate); |
v8::Local<v8::Context> context = |
- v8::Context::FromSnapshot(isolate, 0).ToLocalChecked(); |
+ v8::Context::FromSnapshot(isolate, 0, DeserializeInternalFields) |
+ .ToLocalChecked(); |
{ |
v8::Context::Scope context_scope(context); |
ExpectInt32("f()", 42); |
@@ -2497,7 +2480,8 @@ TEST(SnapshotCreatorIncludeGlobalProxy) { |
// New context, but reuse global proxy. |
v8::ExtensionConfiguration* no_extensions = nullptr; |
v8::Local<v8::Context> context2 = |
- v8::Context::FromSnapshot(isolate, 0, no_extensions, global) |
+ v8::Context::FromSnapshot(isolate, 0, DeserializeInternalFields, |
+ no_extensions, global) |
.ToLocalChecked(); |
{ |
v8::Context::Scope context_scope(context2); |