bug1502886.js (828B)
1 newGlobal({newCompartment: true}); 2 g = newGlobal({newCompartment: true}); 3 var dbg = Debugger(g); 4 gczeal(2, 100); 5 function f(x, initFunc) { 6 newGlobal({newCompartment: true}); 7 g.eval(` 8 var binary = wasmTextToBinary('${x}'); 9 new WebAssembly.Instance(new WebAssembly.Module(binary)); 10 `); 11 var wasmScript = dbg.findScripts().filter(s => s.format == 'wasm')[0]; 12 var offsets = wasmScript.getPossibleBreakpointOffsets(); 13 initFunc({ 14 wasmScript, 15 breakpoints: offsets 16 }) 17 }; 18 try { 19 f('(module (func nop nop) (export "" (func 0)))', 20 function({ 21 wasmScript, 22 breakpoints 23 }) { 24 breakpoints.forEach(function(offset) { 25 wasmScript.setBreakpoint(offset, s = {}); 26 }); 27 } 28 ); 29 f(); 30 } catch (e) {}