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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Frame-onStep-10.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +// Throwing and catching an error in an onStep handler shouldn't interfere
     1.5 +// with throwing and catching in the debuggee.
     1.6 +
     1.7 +var g = newGlobal();
     1.8 +g.eval("function f() { debugger; throw 'mud'; }");
     1.9 +
    1.10 +var dbg = Debugger(g);
    1.11 +var stepped = false;
    1.12 +dbg.onDebuggerStatement = function (frame) {
    1.13 +    frame.older.onStep = function () {
    1.14 +        stepped = true;
    1.15 +        try {
    1.16 +            throw 'snow';
    1.17 +        } catch (x) {
    1.18 +            assertEq(x, 'snow');
    1.19 +        }
    1.20 +    };
    1.21 +};
    1.22 +
    1.23 +stepped = false;
    1.24 +g.eval("var caught;\n" +
    1.25 +       "try {\n" +
    1.26 +       "    f();\n" +
    1.27 +       "} catch (x) {\n" +
    1.28 +       "    caught = x;\n" +
    1.29 +       "}\n");
    1.30 +assertEq(stepped, true);
    1.31 +assertEq(g.caught, 'mud');

mercurial