| Index: test/inspector/debugger/wasm-scripts.js
|
| diff --git a/test/inspector/debugger/wasm-scripts.js b/test/inspector/debugger/wasm-scripts.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..61d7dd9f3cf6d3584d9447994588f365d7dea9e7
|
| --- /dev/null
|
| +++ b/test/inspector/debugger/wasm-scripts.js
|
| @@ -0,0 +1,42 @@
|
| +// Copyright 2016 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Flags: --expose-wasm
|
| +
|
| +load('test/mjsunit/wasm/wasm-constants.js');
|
| +load('test/mjsunit/wasm/wasm-module-builder.js');
|
| +
|
| +// Add two empty functions. Both should be registered as individual scripts.
|
| +var builder = new WasmModuleBuilder();
|
| +builder.addFunction('func0', kSig_v_v).addBody([]);
|
| +builder.addFunction('func1', kSig_v_v).addBody([]).exportAs('main');
|
| +var module_bytes = builder.toArray();
|
| +
|
| +function testFunction(bytes) {
|
| + var buffer = new ArrayBuffer(bytes.length);
|
| + var view = new Uint8Array(buffer);
|
| + for (var i = 0; i < bytes.length; i++) {
|
| + view[i] = bytes[i] | 0;
|
| + }
|
| +
|
| + // Compilation triggers registration of wasm scripts.
|
| + new WebAssembly.Module(buffer);
|
| +}
|
| +
|
| +InspectorTest.addScript(testFunction.toString());
|
| +InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes));
|
| +
|
| +Protocol.Debugger.enable();
|
| +Protocol.Debugger.onScriptParsed(handleScriptParsed);
|
| +InspectorTest.log('Check that inspector gets two wasm scripts');
|
| +Protocol.Runtime.evaluate({'expression': 'testFunction(module_bytes)'})
|
| + .then(InspectorTest.completeTest());
|
| +
|
| +var num_scripts = 0;
|
| +function handleScriptParsed(messageObject)
|
| +{
|
| + var url = messageObject.params.url;
|
| + InspectorTest.log("Script #" + num_scripts + " parsed. URL: " + url);
|
| + ++num_scripts;
|
| +}
|
|
|