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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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