summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-07-14 21:00:54 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:48 -0400
commit076ad08ac6f001626e63bc382d3b3d709f692a68 (patch)
tree2e007cc3dfa6d8a2f275a59c2fe5acb79be6d227
parent221239a77c6d7de58424448de7b83af04c638378 (diff)
downloaduxp-076ad08ac6f001626e63bc382d3b3d709f692a68.tar.gz
1339395 - Part 8: Add separate variables for wasm debugger test.
-rw-r--r--js/src/jit-test/tests/debug/wasm-12.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/wasm-12.js b/js/src/jit-test/tests/debug/wasm-12.js
new file mode 100644
index 0000000000..18d3b574d8
--- /dev/null
+++ b/js/src/jit-test/tests/debug/wasm-12.js
@@ -0,0 +1,26 @@
+// Tests that wasm module scripts have special URLs.
+
+if (!wasmIsSupported())
+ quit();
+
+var g = newGlobal();
+g.eval(`
+function initWasm(s) { return new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(s))); }
+o = initWasm('(module (func) (export "" 0))');
+o2 = initWasm('(module (func) (func) (export "" 1))');
+`);
+
+function isWasm(script) { return script.format === "wasm"; }
+
+function isValidWasmURL(url) {
+ // The URLs will have the following format:
+ // wasm: [<uri-econded-filename-of-host> ":"] <64-bit-hash>
+ return /^wasm:(?:[^:]*:)*?[0-9a-f]{16}$/.test(url);
+}
+
+var dbg = new Debugger(g);
+var foundScripts = dbg.findScripts().filter(isWasm);
+assertEq(foundScripts.length, 2);
+assertEq(isValidWasmURL(foundScripts[0].source.url), true);
+assertEq(isValidWasmURL(foundScripts[1].source.url), true);
+assertEq(foundScripts[0].source.url != foundScripts[1].source.url, true);