Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: test/inspector/debugger/wasm-scripts.js

Issue 2531163010: [inspector] Introduce debug::WasmScript (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --expose-wasm
6
7 load('test/mjsunit/wasm/wasm-constants.js');
8 load('test/mjsunit/wasm/wasm-module-builder.js');
9
10 // Add two empty functions. Both should be registered as individual scripts.
11 var builder = new WasmModuleBuilder();
12 builder.addFunction('func0', kSig_v_v).addBody([]);
13 builder.addFunction('func1', kSig_v_v).addBody([]).exportAs('main');
14 var module_bytes = builder.toArray();
15
16 function testFunction(bytes) {
17 var buffer = new ArrayBuffer(bytes.length);
18 var view = new Uint8Array(buffer);
19 for (var i = 0; i < bytes.length; i++) {
20 view[i] = bytes[i] | 0;
21 }
22
23 // Compilation triggers registration of wasm scripts.
24 new WebAssembly.Module(buffer);
25 }
26
27 InspectorTest.addScript(testFunction.toString());
28 InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes));
29
30 Protocol.Debugger.enable();
31 Protocol.Debugger.onScriptParsed(handleScriptParsed);
32 InspectorTest.log('Check that inspector gets two wasm scripts');
33 Protocol.Runtime.evaluate({'expression': 'testFunction(module_bytes)'})
34 .then(InspectorTest.completeTest());
35
36 var num_scripts = 0;
37 function handleScriptParsed(messageObject)
38 {
39 var url = messageObject.params.url;
40 InspectorTest.log("Script #" + num_scripts + " parsed. URL: " + url);
41 ++num_scripts;
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698