js/src/jit-test/tests/debug/Debugger-debuggees-19.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 // removeAllDebuggees removes all the debuggees.
michael@0 2
michael@0 3 var dbg = new Debugger;
michael@0 4
michael@0 5 // If we eval in a debuggee, log which debuggee it was.
michael@0 6 var log;
michael@0 7 dbg.onEnterFrame = function (frame) {
michael@0 8 log += 'e';
michael@0 9 log += frame.environment.object.label;
michael@0 10 };
michael@0 11
michael@0 12 var g1 = newGlobal();
michael@0 13 log = '';
michael@0 14 g1.eval('Math');
michael@0 15 assertEq(log, ''); // not yet a debuggee
michael@0 16
michael@0 17 var g1w = dbg.addDebuggee(g1);
michael@0 18 assertEq(g1w instanceof Debugger.Object, true);
michael@0 19 g1w.label = 'g1';
michael@0 20 log = '';
michael@0 21 g1.eval('Math'); // now a debuggee
michael@0 22 assertEq(log, 'eg1');
michael@0 23
michael@0 24 var g2 = newGlobal();
michael@0 25 log = '';
michael@0 26 g1.eval('Math'); // debuggee
michael@0 27 g2.eval('Math'); // not a debuggee
michael@0 28 assertEq(log, 'eg1');
michael@0 29
michael@0 30 var g2w = dbg.addDebuggee(g2);
michael@0 31 assertEq(g2w instanceof Debugger.Object, true);
michael@0 32 g2w.label = 'g2';
michael@0 33 log = '';
michael@0 34 g1.eval('Math'); // debuggee
michael@0 35 g2.eval('this'); // debuggee
michael@0 36 assertEq(log, 'eg1eg2');
michael@0 37
michael@0 38 var a1 = dbg.getDebuggees();
michael@0 39 assertEq(a1.length, 2);
michael@0 40
michael@0 41 assertEq(dbg.removeAllDebuggees(), undefined);
michael@0 42 var a2 = dbg.getDebuggees();
michael@0 43 assertEq(a2.length, 0);
michael@0 44
michael@0 45 log = '';
michael@0 46 g1.eval('Math'); // no longer a debuggee
michael@0 47 g2.eval('this'); // no longer a debuggee
michael@0 48 assertEq(log, '');

mercurial