mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 16:47:29 +09:00
1339395 - Part 8: Add separate variables for wasm debugger test.
This commit is contained in:
parent
6cff3b755a
commit
3c9c84e2ac
1 changed files with 26 additions and 0 deletions
26
js/src/jit-test/tests/debug/wasm-12.js
Normal file
26
js/src/jit-test/tests/debug/wasm-12.js
Normal file
|
|
@ -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);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue