js/src/jit-test/tests/debug/Debugger-debuggees-24.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Turning debugger on for a particular global with on-stack scripts shouldn't
michael@0 2 // make other globals' scripts observable.
michael@0 3
michael@0 4 var g1 = newGlobal();
michael@0 5 var g2 = newGlobal();
michael@0 6 var g3 = newGlobal();
michael@0 7
michael@0 8 g1.eval("" + function f() {
michael@0 9 var name = "f";
michael@0 10 g();
michael@0 11 return name;
michael@0 12 });
michael@0 13 g2.eval("" + function g() {
michael@0 14 var name = "g";
michael@0 15 h();
michael@0 16 return name;
michael@0 17 });
michael@0 18 g3.eval("" + function h() {
michael@0 19 var name = "h";
michael@0 20 toggle();
michael@0 21 return name;
michael@0 22 });
michael@0 23
michael@0 24 g1.g = g2.g;
michael@0 25 g2.h = g3.h;
michael@0 26
michael@0 27 function name(f) {
michael@0 28 return f.environment.getVariable("name");
michael@0 29 }
michael@0 30
michael@0 31 var dbg = new Debugger;
michael@0 32 g3.toggle = function () {
michael@0 33 var frame;
michael@0 34
michael@0 35 // Only f should be visible.
michael@0 36 dbg.addDebuggee(g1);
michael@0 37 frame = dbg.getNewestFrame();
michael@0 38 assertEq(name(frame), "f");
michael@0 39
michael@0 40 // Now h should also be visible.
michael@0 41 dbg.addDebuggee(g3);
michael@0 42 frame = dbg.getNewestFrame();
michael@0 43 assertEq(name(frame), "h");
michael@0 44 assertEq(name(frame.older), "f");
michael@0 45
michael@0 46 // Finally everything should be visible.
michael@0 47 dbg.addDebuggee(g2);
michael@0 48 frame = dbg.getNewestFrame();
michael@0 49 assertEq(name(frame), "h");
michael@0 50 assertEq(name(frame.older), "g");
michael@0 51 assertEq(name(frame.older.older), "f");
michael@0 52 };
michael@0 53
michael@0 54 g1.eval("(" + function () { f(); } + ")();");
michael@0 55

mercurial