js/src/jit-test/tests/debug/Frame-onPop-13.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 // One can set onPop handlers on some frames but not others.
michael@0 2 var g = newGlobal();
michael@0 3 g.eval("function f(n) { if (n > 0) f(n-1); else debugger; }");
michael@0 4 var dbg = new Debugger(g);
michael@0 5 var log;
michael@0 6
michael@0 7 Debugger.Frame.prototype.nthOlder = function nthOlder(n) {
michael@0 8 var f = this;
michael@0 9 while (n-- > 0)
michael@0 10 f = f.older;
michael@0 11 return f;
michael@0 12 };
michael@0 13
michael@0 14 dbg.onEnterFrame = function handleEnter(f) {
michael@0 15 log += "(" + f.arguments[0];
michael@0 16 };
michael@0 17
michael@0 18 function makePopHandler(n) {
michael@0 19 return function handlePop(c) {
michael@0 20 log += ")" + this.arguments[0];
michael@0 21 assertEq(this.arguments[0], n);
michael@0 22 };
michael@0 23 }
michael@0 24
michael@0 25 dbg.onDebuggerStatement = function handleDebugger(f) {
michael@0 26 // Set onPop handers on some frames, and leave others alone. Vary the
michael@0 27 // spacing.
michael@0 28 f.nthOlder(2).onPop = makePopHandler(2);
michael@0 29 f.nthOlder(3).onPop = makePopHandler(3);
michael@0 30 f.nthOlder(5).onPop = makePopHandler(5);
michael@0 31 f.nthOlder(8).onPop = makePopHandler(8);
michael@0 32 f.nthOlder(13).onPop = makePopHandler(13);
michael@0 33 };
michael@0 34
michael@0 35 log = '';
michael@0 36 g.f(20);
michael@0 37 assertEq(log, "(20(19(18(17(16(15(14(13(12(11(10(9(8(7(6(5(4(3(2(1(0)2)3)5)8)13");

mercurial