summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-eval-stack.js
blob: 71f7c74789bd648c784284ad38daa163a14b14bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var g = newGlobal({newCompartment: true});
var dbg = new Debugger(g);

g.eval("function h() { debugger; }");
g.eval("function g() { h() }");
g.eval("function f() { var blah = 333; g() }");

dbg.onDebuggerStatement = function(frame) {
    frame = frame.older;
    g.trace = frame.older.eval("(new Error()).stack;").return;
}
g.f();

assertEq(typeof g.trace, "string");

var frames = g.trace.split("\n");
assertEq(frames[0].includes("eval code"), true);
assertEq(frames[1].startsWith("f@"), true);
assertEq(frames[2].startsWith("@"), true);