PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/js/src/jit-test/tests/debug/uncaughtExceptionHook-resumption-02.js

http://github.com/zpao/v8monkey
JavaScript | 25 lines | 19 code | 4 blank | 2 comment | 2 complexity | 40a74d41cf920b7fdd57b07d79e93994 MD5 | raw file
 1// uncaughtExceptionHook resumption value other than undefined causes further
 2// hooks to be skipped.
 3
 4var g = newGlobal('new-compartment');
 5var log;
 6
 7function makeDebug(g, name) {
 8    var dbg = new Debugger(g);
 9    dbg.onDebuggerStatement = function (frame) {
10        log += name;
11        throw new Error(name);
12    };
13    dbg.uncaughtExceptionHook = function (exc) {
14        assertEq(exc.message, name);
15        return name == "2" ? {return: 42} : undefined;
16    };
17}
18
19var arr = [];
20for (var i = 0; i < 6; i++)
21    arr[i] = makeDebug(g, "" + i);
22
23log = '';
24assertEq(g.eval("debugger;"), 42);
25assertEq(log, "012");