summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/profiler/exception-unwind-hook.js
blob: 6b52d1615d23fe0200e9d509fd0c866a1f95f8b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Test interaction between exception handler, debugger's onExceptionUnwind,
// and profiler's frame iterator.

var g = newGlobal({newCompartment: true});
var dbg = new Debugger(g);

g.eval("" + function f() {
    for (var i = 0; i < 120; i++) {
        try { throw 1; } catch {}
    }
});

var count = 0;
dbg.onExceptionUnwind = function() {
    enableGeckoProfiling();
    readGeckoProfilingStack();
    disableGeckoProfiling();
    count++;
};

g.f();
assertEq(count, 120);