summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-onStep-09.js
blob: 1204ac21a964de68a4b9a5526b20e576a29cc1ea (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
// After an implicit toString call throws an exception, the calling frame's
// onStep hook fires.

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

var dbg = Debugger(g);
dbg.onDebuggerStatement = function (frame) {
    g.log += 'd';
    frame.older.onStep = function () {
        if (!g.log.match(/[sy]$/))
            g.log += 's';
    };
};

g.log = '';
g.eval("try { x + ''; } catch (x) { }\n" +
       "log += 'y';\n");
assertEq(g.log, "dxsy");

g.log = '';
g.eval("try { '' + x; } catch (x) { }\n" +
       "log += 'y';\n");
assertEq(g.log, "dxsy");