summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Script-getChildScripts-03.js
blob: 09e5cba32cb0928e8cd91dbef400a36a137bbec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// getChildScripts on a direct eval script returns the right scripts.
// (A bug had it also returning the script for the calling function.)

var g = newGlobal({newCompartment: true});
var dbg = Debugger(g);
var hits = 0;
dbg.onDebuggerStatement = function (frame) {
    var arr = frame.script.getChildScripts();
    assertEq(arr.length, 1);
    assertEq(arr[0], frame.eval("h").return.script);
    hits++;
};

g.eval("function f(s) { eval(s); }");
g.f("debugger; function h(a) { return a + 1; }");
assertEq(hits, 1);