js/src/jit-test/tests/debug/Debugger-multi-01.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 // When there are multiple debuggers, their hooks are called in order.
     3 var g = newGlobal();
     4 var log;
     5 var arr = [];
     7 function addDebug(msg) {
     8     var dbg = new Debugger(g);
     9     dbg.onDebuggerStatement = function (stack) { log += msg; };
    10     arr.push(dbg);
    11 }
    13 addDebug('a');
    14 addDebug('b');
    15 addDebug('c');
    17 log = '';
    18 assertEq(g.eval("debugger; 0;"), 0);
    19 assertEq(log, 'abc');
    21 // Calling debugger hooks stops as soon as any hook returns a resumption value
    22 // other than undefined.
    24 arr[0].onDebuggerStatement = function (stack) {
    25     log += 'a';
    26     return {return: 1};
    27 };
    29 log = '';
    30 assertEq(g.eval("debugger; 0;"), 1);
    31 assertEq(log, 'a');

mercurial