Commit ec3cadc4 authored by Kim-Anh Tran's avatar Kim-Anh Tran Committed by Commit Bot

[wasm] Set source url when deserializing wasm module

Bug: v8:1071760
Change-Id: Id2f75aef039574b918768fb323e1a8dbc999606f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2159491Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67300}
parent 8bfd278c
......@@ -638,7 +638,7 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
&export_wrappers);
Handle<Script> script =
wasm_engine->GetOrCreateScript(isolate, shared_native_module);
wasm_engine->GetOrCreateScript(isolate, shared_native_module, source_url);
Handle<WasmModuleObject> module_object = WasmModuleObject::New(
isolate, std::move(shared_native_module), script, export_wrappers);
......
......@@ -69,10 +69,11 @@ class WasmSerializationTest {
base::WriteUnalignedValue<uint32_t>(num_functions_slot, 0);
}
MaybeHandle<WasmModuleObject> Deserialize() {
MaybeHandle<WasmModuleObject> Deserialize(
Vector<const char> source_url = {}) {
return DeserializeNativeModule(CcTest::i_isolate(),
VectorOf(serialized_bytes_),
VectorOf(wire_bytes_), {});
VectorOf(wire_bytes_), source_url);
}
void DeserializeAndRun() {
......@@ -200,6 +201,19 @@ TEST(DeserializeValidModule) {
test.CollectGarbage();
}
TEST(DeserializeWithSourceUrl) {
WasmSerializationTest test;
{
HandleScope scope(CcTest::i_isolate());
const std::string url = "http://example.com/example.wasm";
Handle<WasmModuleObject> module_object;
CHECK(test.Deserialize(VectorOf(url)).ToHandle(&module_object));
String source_url = String::cast(module_object->script().source_url());
CHECK_EQ(url, source_url.ToCString().get());
}
test.CollectGarbage();
}
TEST(DeserializeMismatchingVersion) {
WasmSerializationTest test;
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment