js/src/jit-test/tests/debug/Debugger-debuggees-25.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 off global at a time.
michael@0 2
michael@0 3 var g1 = newGlobal();
michael@0 4 var g2 = newGlobal();
michael@0 5 var g3 = newGlobal();
michael@0 6
michael@0 7 g1.eval("" + function f() {
michael@0 8 var name = "f";
michael@0 9 g();
michael@0 10 return name;
michael@0 11 });
michael@0 12 g2.eval("" + function g() {
michael@0 13 var name = "g";
michael@0 14 h();
michael@0 15 return name;
michael@0 16 });
michael@0 17 g3.eval("" + function h() {
michael@0 18 var name = "h";
michael@0 19 toggle();
michael@0 20 return name;
michael@0 21 });
michael@0 22
michael@0 23 g1.g = g2.g;
michael@0 24 g2.h = g3.h;
michael@0 25
michael@0 26 function name(f) {
michael@0 27 return f.environment.getVariable("name");
michael@0 28 }
michael@0 29
michael@0 30 var dbg = new Debugger;
michael@0 31 g3.toggle = function () {
michael@0 32 var frame;
michael@0 33
michael@0 34 // Add all globals.
michael@0 35 dbg.addDebuggee(g1);
michael@0 36 dbg.addDebuggee(g3);
michael@0 37 dbg.addDebuggee(g2);
michael@0 38
michael@0 39 // Remove one at a time.
michael@0 40 dbg.removeDebuggee(g3);
michael@0 41 assertEq(name(dbg.getNewestFrame()), "g");
michael@0 42 dbg.removeDebuggee(g2);
michael@0 43 assertEq(name(dbg.getNewestFrame()), "f");
michael@0 44 dbg.removeDebuggee(g1);
michael@0 45 };
michael@0 46
michael@0 47 g1.eval("(" + function () { f(); } + ")();");
michael@0 48

mercurial