blob: cacb1b825b8abbf5487e1cf23cd5a6a8c457c61e (
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
|
// When resuming a generator triggers one Debugger's onEnterFrame handler,
// all Debuggers' Debugger.Frames become usable at once.
load(libdir + "asserts.js");
let g = newGlobal({newCompartment: true});
g.eval(`
function* f() {
yield 1;
}
`);
let dbg1 = new Debugger(g);
let dbg2 = new Debugger(g);
let hits = 0;
let savedFrame1;
let savedFrame2;
dbg1.onEnterFrame = frame => {
if (savedFrame1 === undefined) {
savedFrame1 = frame;
savedFrame2 = dbg2.getNewestFrame();
} else {
hits++;
assertEq(savedFrame1, frame);
for (let f of [savedFrame2, savedFrame1]) {
assertEq(f.type, "call");
assertEq(f.callee.name, "f");
}
}
};
let values = [...g.f()];
assertEq(hits, 2);
assertDeepEq(values, [1]);
|