js/src/jit-test/tests/debug/onExceptionUnwind-02.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 // |jit-test| debug
     2 // The onExceptionUnwind hook is called multiple times as the stack unwinds.
     4 var g = newGlobal();
     5 g.debuggeeGlobal = this;
     6 g.dbg = null;
     7 g.eval("(" + function () {
     8         dbg = new Debugger(debuggeeGlobal);
     9         dbg.onExceptionUnwind = function (frame, exc) {
    10             assertEq(frame instanceof Debugger.Frame, true);
    11             assertEq(exc instanceof Debugger.Object, true);
    12             var s = '!';
    13             for (var f = frame; f; f = f.older)
    14                 if (f.type === "call")
    15                     s += f.callee.name;
    16             s += ', ';
    17             debuggeeGlobal.log += s;
    18         };
    19     } + ")();");
    21 var log;
    23 function k() {
    24     throw new Error("oops");  // hook call 1
    25 }
    27 function j() {
    28     k();  // hook call 2
    29     log += 'j-unreached, ';
    30 }
    32 function h() {
    33     j();  // hook call 3
    34     log += 'h-unreached, ';
    35 }
    37 function f() {
    38     try {
    39         h(); // hook call 4
    40     } catch (exc) {
    41         log += 'f-catch';
    42     }
    43 }
    45 log = '';
    46 f();
    47 g.dbg.enabled = false;
    48 assertEq(log, '!kjhf, !jhf, !hf, !f, f-catch');

mercurial