summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-onPop-generators-06.js
blob: 993e2e11bbcab53d9bd01279bea5e432cdb502b4 (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
load(libdir + "asserts.js");
load(libdir + 'match.js');
load(libdir + 'match-debugger.js');
const { Pattern } = Match;
const { OBJECT_WITH_EXACTLY: EXACT } = Pattern;

let g = newGlobal({newCompartment: true});
let dbg = Debugger(g);
const log = [];
g.capture = function () {
  dbg.getNewestFrame().onPop = completion => {
    log.push(completion);
  };
};

g.eval(`
    function* f() {
        capture();
        yield 3;
        return "ok";
    }
`);

assertDeepEq([... g.f()], [3]);
Pattern([
  EXACT({ return: new DebuggerObjectPattern("Object", { value: 3, done: false }), yield: true }),
  EXACT({ return: new DebuggerObjectPattern("Object", { value: "ok", done: true }) }),
]).assert(log);