~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// |jit-test| error: TestComplete
 
2
// onPop can change a normal return into a throw.
 
3
 
 
4
load(libdir + "asserts.js");
 
5
var g = newGlobal('new-compartment');
 
6
var dbg = new Debugger(g);
 
7
 
 
8
function test(type, provocation) {
 
9
    var log;
 
10
 
 
11
    // Help people figure out which 'test' call failed.
 
12
    print("type:        " + uneval(type));
 
13
    print("provocation: " + uneval(provocation));
 
14
 
 
15
    dbg.onDebuggerStatement = function handleDebuggerStatement(f) {
 
16
        log += 'd';
 
17
    };
 
18
 
 
19
    dbg.onEnterFrame = function handleEnterFrame(f) {
 
20
        log += '(';
 
21
        assertEq(f.type, type);
 
22
        f.onPop = function handlePop(c) {
 
23
            log += ')';
 
24
            assertEq(c.return, 'compliment');
 
25
            return { throw: 'snow' };
 
26
        };
 
27
    };
 
28
 
 
29
    log = '';
 
30
    assertThrowsValue(provocation, 'snow');
 
31
    assertEq(log, "(d)");
 
32
 
 
33
    print();
 
34
}
 
35
 
 
36
g.eval("function f() { debugger; return 'compliment'; }");
 
37
test("call", g.f);
 
38
test("call", function () { return new g.f; });
 
39
test("eval", function () { return g.eval("debugger; \'compliment\';"); });
 
40
test("global", function () { return g.evaluate("debugger; \'compliment\';"); });
 
41
throw 'TestComplete';