js/src/jit-test/tests/debug/Frame-onPop-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 multiple frames have onPop handlers, they are called in the correct order.
     2 var g = newGlobal();
     3 g.eval("function f() { debugger; }");
     4 g.eval("function g() { f(); }");
     5 g.eval("function h() { g(); }");
     6 g.eval("function i() { h(); }");
     8 var dbg = new Debugger(g);
     9 var log;
    10 function logger(frame, mark) { 
    11     return function (completion) {
    12         assertEq(this, frame);
    13         assertEq('return' in completion, true);
    14         log += mark;
    15     };
    16 }
    17 dbg.onEnterFrame = function handleEnter(f) {
    18     log += "(" + f.callee.name;
    19     // Note that this establishes a distinct function object as each
    20     // frame's onPop handler. Thus, a pass proves that each frame is
    21     // remembering its handler separately.
    22     f.onPop = logger(f, f.callee.name + ")");  
    23 };
    24 dbg.onDebuggerStatement = function handleDebugger(f) {
    25     log += 'd';
    26 };
    27 log = '';
    28 g.i();
    29 assertEq(log, "(i(h(g(fdf)g)h)i)");

mercurial