wasm-04.js (961B)
1 // |jit-test| skip-if: !wasmDebuggingEnabled() 2 3 // Tests that wasm module scripts throw for everything except text. 4 5 load(libdir + "asserts.js"); 6 7 var g = newGlobal({newCompartment: true}); 8 var dbg = new Debugger(g); 9 10 var s; 11 dbg.onNewScript = (script) => { 12 s = script; 13 } 14 15 g.eval(`o = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary('(module (func) (export "" (func 0)))')));`); 16 assertEq(s.format, "wasm"); 17 18 assertThrowsInstanceOf(() => s.displayName, Error); 19 assertThrowsInstanceOf(() => s.parameterNames, Error); 20 assertThrowsInstanceOf(() => s.url, Error); 21 assertThrowsInstanceOf(() => s.sourceStart, Error); 22 assertThrowsInstanceOf(() => s.sourceLength, Error); 23 assertThrowsInstanceOf(() => s.global, Error); 24 assertThrowsInstanceOf(() => s.getChildScripts(), Error); 25 assertThrowsInstanceOf(() => s.getAllOffsets(), Error); 26 assertThrowsInstanceOf(() => s.getBreakpoint(0), Error); 27 assertThrowsInstanceOf(() => s.getOffsetsCoverage(), Error);