Debian Codegraph @

js/src/jit-test/tests/debug/wasm-responseurls.js

raw
1 // |jit-test| test-also=--wasm-compiler=optimizing; skip-if: !wasmDebuggingEnabled()
2 // Tests that wasm module can accept URL and sourceMapURL from response
3 // when instantiateStreaming is used.
4
5 ignoreUnhandledRejections();
6
7 try {
8 WebAssembly.compileStreaming();
9 // Avoid mixing the test's jobs with the debuggee's, so that
10 // automated checks can make sure AutoSaveJobQueue only
11 // suspends debuggee work.
12 drainJobQueue();
13 } catch (err) {
14 assertEq(String(err).indexOf("not supported with --no-threads") !== -1, true);
15 quit();
16 }
17
18 load(libdir + "asserts.js");
19
20 var g = newGlobal({newCompartment: true});
21
22 var source = new g.Uint8Array(wasmTextToBinary('(module (func unreachable))'));
23 source.url = "http://example.org/test.wasm";
24 source.sourceMappingURL = "http://example.org/test.wasm.map";
25 g.source = source;
26
27 var gotUrl, gotSourceMapURL;
28 var dbg = new Debugger(g);
29 dbg.allowWasmBinarySource = true;
30 dbg.onNewScript = function (s, g) {
31 gotUrl = s.source.url;
32 gotSourceMapURL = s.source.sourceMapURL;
33 };
34
35 g.eval('WebAssembly.instantiateStreaming(source);');
36
37 drainJobQueue();
38
39 assertEq(gotUrl, "http://example.org/test.wasm");
40 assertEq(gotSourceMapURL, "http://example.org/test.wasm.map");