summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/async-stack.js
blob: 015fc54c78214fb547a60b9c715b988a2ee5149c (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
35
// |jit-test| --async-stacks-capture-debuggee-only

const g = newGlobal({newCompartment: true});

const code = `
var stack = "";

async function Async() {
  await 1;
  stack = new Error().stack;
}

function Sync() {
  Async();
}

Sync();
`;

g.eval(code);
drainJobQueue();
assertEq(g.stack.includes("Sync"), false);

let dbg = new Debugger();
dbg.enableAsyncStack(g);

g.eval(code);
drainJobQueue();
assertEq(g.stack.includes("Sync"), true);

dbg.disableAsyncStack(g);

g.eval(code);
drainJobQueue();
assertEq(g.stack.includes("Sync"), false);