~ubuntu-branches/ubuntu/vivid/mozjs24/vivid

« back to all changes in this revision

Viewing changes to js/src/jit-test/tests/debug/Frame-onPop-03.js

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2014-02-11 21:55:34 UTC
  • Revision ID: package-import@ubuntu.com-20140211215534-m1zyq5aj59md3y07
Tags: upstream-24.2.0
ImportĀ upstreamĀ versionĀ 24.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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('new-compartment');
 
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(); }");
 
8
 
 
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");