summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-onStep-10.js
blob: 758f64f1a3b4c03524946fda83995b3eab54b77b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Throwing and catching an error in an onStep handler shouldn't interfere
// with throwing and catching in the debuggee.

var g = newGlobal({newCompartment: true});
g.eval("function f() { debugger; throw 'mud'; }");

var dbg = Debugger(g);
var stepped = false;
dbg.onDebuggerStatement = function (frame) {
    frame.older.onStep = function () {
        stepped = true;
        try {
            throw 'snow';
        } catch (x) {
            assertEq(x, 'snow');
        }
    };
};

stepped = false;
g.eval("var caught;\n" +
       "try {\n" +
       "    f();\n" +
       "} catch (x) {\n" +
       "    caught = x;\n" +
       "}\n");
assertEq(stepped, true);
assertEq(g.caught, 'mud');