summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-onStep-async-gc-01.js
blob: 6ff59d6ce884f9d6d8e407e5b18741eab500998d (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
// An onStep handler on a suspended async function frame keeps a Debugger alive.

let g = newGlobal({newCompartment: true});
g.eval(`
  async function f() {
    debugger;
    await Promise.resolve(0);
    return 'ok';
  }
`);

let dbg = Debugger(g);
let hit = false;
dbg.onDebuggerStatement = frame => {
    frame.onPop = completion => {
        frame.onStep = () => { hit = true; };
        frame.onPop = undefined;
    };
    dbg.onDebuggerStatement = undefined;
    dbg = null;
};

g.f();
assertEq(dbg, null);
gc();
assertEq(hit, false);
drainJobQueue();
assertEq(hit, true);