PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/debug/Frame-onStep-10.js

http://github.com/zpao/v8monkey
JavaScript | 28 lines | 23 code | 3 blank | 2 comment | 0 complexity | a4cbc3f293ed54ce0cfa0b21b8f97002 MD5 | raw file
 1// Throwing and catching an error in an onStep handler shouldn't interfere
 2// with throwing and catching in the debuggee.
 3
 4var g = newGlobal('new-compartment');
 5g.eval("function f() { debugger; throw 'mud'; }");
 6
 7var dbg = Debugger(g);
 8var stepped = false;
 9dbg.onDebuggerStatement = function (frame) {
10    frame.older.onStep = function () {
11        stepped = true;
12        try {
13            throw 'snow';
14        } catch (x) {
15            assertEq(x, 'snow');
16        }
17    };
18};
19
20stepped = false;
21g.eval("var caught;\n" +
22       "try {\n" +
23       "    f();\n" +
24       "} catch (x) {\n" +
25       "    caught = x;\n" +
26       "}\n");
27assertEq(stepped, true);
28assertEq(g.caught, 'mud');