js/src/jit-test/tests/debug/Frame-onPop-13.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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