blob: cf554c16a05b3d6c9d1ffc2caab9977b891bd0ac (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Turning debugger on for a particular global with on-stack scripts shouldn't
// make other globals' scripts observable.
var g1 = newGlobal();
var g2 = newGlobal();
var g3 = newGlobal();
g1.eval("" + function f() {
var name = "f";
g();
return name;
});
g2.eval("" + function g() {
var name = "g";
h();
return name;
});
g3.eval("" + function h() {
var name = "h";
toggle();
return name;
});
g1.g = g2.g;
g2.h = g3.h;
function name(f) {
return f.environment.getVariable("name");
}
var dbg = new Debugger;
g3.toggle = function () {
var frame;
// Only f should be visible.
dbg.addDebuggee(g1);
frame = dbg.getNewestFrame();
assertEq(name(frame), "f");
// Now h should also be visible.
dbg.addDebuggee(g3);
frame = dbg.getNewestFrame();
assertEq(name(frame), "h");
assertEq(name(frame.older), "f");
// Finally everything should be visible.
dbg.addDebuggee(g2);
frame = dbg.getNewestFrame();
assertEq(name(frame), "h");
assertEq(name(frame.older), "g");
assertEq(name(frame.older.older), "f");
};
g1.eval("(" + function () { f(); } + ")();");
|