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