summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-onPop-generator-resumption-01.js
blob: 617baceb7b66b24f2b61df5c4d7d142288d59f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// A generator is left closed after frame.onPop returns a {return:} resumption value.

var g = newGlobal({newCompartment: true});
var dbg = new Debugger;
var gw = dbg.addDebuggee(g);
dbg.onDebuggerStatement = frame => {
    frame.onPop = completion => ({return: "ok"});
};
g.eval("function* g() { for (var i = 0; i < 10; i++) { debugger; yield i; } }");
var it = g.g();
var result = it.next();
assertEq(result.value, "ok");
assertEq(result.done, true);
assertEq(it.next().value, undefined);