summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/regress/debug-clone-segment.js
blob: f91f62df32f333ad33cf3d432e4e31c312185220 (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
34
35
36
// |jit-test| skip-if: !wasmDebuggingEnabled()
//
var mod = new WebAssembly.Module(wasmTextToBinary(`
    (module
        (func (export "func_0") (result i32)
         call 0
        )
    )
`));

var g = newGlobal({newCompartment: true});
g.parent = this;
g.eval("(" + function() {
    var dbg = Debugger(parent);
    dbg.onEnterFrame = function(frame) {}
} + ")()");

processModule(mod);
processModule(mod);
processModule(mod);
processModule(mod);

mod = new WebAssembly.Module(wasmTextToBinary(`
(module (export "func_0" (func $func1)) (func $func1))
`));

processModule(mod);
processModule(mod);
processModule(mod);
processModule(mod);

function processModule(module) {
    try {
        new WebAssembly.Instance(module).exports.func_0();
    } catch(ex) {}
}