js/src/jit-test/tests/debug/Debugger-multi-02.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial