summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/onExceptionUnwind-11.js
blob: f5eb15df70054034824ec991ac8a53efb071098e (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
// Closing legacy generators should not invoke the onExceptionUnwind hook.

var g = newGlobal();
var dbg = Debugger(g);
dbg.onExceptionUnwind = function (frame, exc) {
    log += "ERROR";
    assertEq(0, 1);
};
g.eval(`
var log = "";
function f() {
    function gen() {
        try {
            log += "yield";
            yield 3;
            yield 4;
        } catch(e) {
            log += "catch";
        } finally {
            log += "finally";
        }
    };
    var it = gen();
    assertEq(it.next(), 3);
    it.close();
};
f();
`);
assertEq(g.log, "yieldfinally");