js/src/jit-test/tests/debug/Frame-onPop-01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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