js/src/jit-test/tests/debug/Frame-onPop-03.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 an exception is propagated out of multiple frames, their onPop
     2 // and onExceptionUnwind handlers are called in the correct order.
     3 var g = newGlobal();
     4 g.eval("function f() { throw 'mud'; }");
     5 g.eval("function g() { f(); }");
     6 g.eval("function h() { g(); }");
     7 g.eval("function i() { h(); }");
     9 var dbg = new Debugger(g);
    10 var log;
    11 function makePopHandler(label) {
    12     return function handlePop(completion) { 
    13         log += label;
    14         assertEq(completion.throw, "mud");
    15     };
    16 }
    17 dbg.onEnterFrame = function handleEnter(f) {
    18     log += "(" + f.callee.name;
    19     f.onPop = makePopHandler(")" + f.callee.name);  
    20 };
    21 dbg.onExceptionUnwind = function handleExceptionUnwind(f, x) {
    22     assertEq(x, 'mud');
    23     log += "u" + f.callee.name;
    24 };
    25 log = '';
    26 try {
    27     g.i();
    28 } catch (x) {
    29     log += 'c';
    30     assertEq(x, "mud");
    31 }
    32 assertEq(log, "(i(h(g(fuf)fug)guh)hui)ic");

mercurial