js/src/jit-test/tests/debug/Debugger-multi-02.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 // Test adding hooks during dispatch. The behavior is deterministic and "nice",
michael@0 2 // but mainly what we are checking here is that we do not crash due to
michael@0 3 // modifying a data structure while we're iterating over it.
michael@0 4
michael@0 5 var g = newGlobal();
michael@0 6 var n = 0;
michael@0 7 var hits;
michael@0 8
michael@0 9 function addDebugger() {
michael@0 10 var dbg = new Debugger(g);
michael@0 11 dbg.onDebuggerStatement = function (stack) {
michael@0 12 hits++;
michael@0 13 addDebugger();
michael@0 14 };
michael@0 15 }
michael@0 16
michael@0 17 addDebugger(); // now there is one enabled Debugger
michael@0 18 hits = 0;
michael@0 19 g.eval("debugger;"); // after this there are two
michael@0 20 assertEq(hits, 1);
michael@0 21
michael@0 22 hits = 0;
michael@0 23 g.eval("debugger;"); // after this there are four
michael@0 24 assertEq(hits, 2);
michael@0 25
michael@0 26 hits = 0;
michael@0 27 g.eval("debugger;"); // after this there are eight
michael@0 28 assertEq(hits, 4);
michael@0 29
michael@0 30 hits = 0;
michael@0 31 g.eval("debugger;");
michael@0 32 assertEq(hits, 8);

mercurial