Commit 64820086 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm] Add test for wasm streaming compilation URL

Test that the script URL reported by the debugger is the same as the
Response URL passed to the streaming compilation API.

R=bmeurer@chromium.org

Bug: v8:10172
Change-Id: Ifaf8bcdd91df4104527e61b8c7e7b40bfe9eb63b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2064388
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: default avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743090}
parent ec597c36
Test script URL for wasm streaming compilation.
Did enable debugger
Instantiating.
Waiting for wasm script
URL is preserved: true
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function instantiate() {
const magicModuleHeader = [0x00, 0x61, 0x73, 0x6d], moduleVersion = [0x01, 0x00, 0x00, 0x00];
const wasm = Uint8Array.from([...magicModuleHeader, ...moduleVersion]);
let b = new Blob([wasm.buffer], {type: 'application/wasm'});
let bURL = URL.createObjectURL(b);
fetch(bURL)
.then(WebAssembly.instantiateStreaming)
.catch(console.error);
return bURL.toString();
}
(async function(testRunner) {
const {page, session, dp} = await testRunner.startBlank(
'Test script URL for wasm streaming compilation.');
await dp.Debugger.enable();
testRunner.log('Did enable debugger');
testRunner.log('Instantiating.');
var response = await dp.Runtime
.evaluate({expression: '(' + instantiate + ')()'});
testRunner.log('Waiting for wasm script');
const {params: wasm_script} = await dp.Debugger.onceScriptParsed();
testRunner.log('URL is preserved: ' + (wasm_script.url == response.result.result.value));
testRunner.completeTest();
})
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