js/src/jit-test/tests/debug/Frame-onStep-09.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-09.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +// After an implicit toString call throws an exception, the calling frame's
     1.5 +// onStep hook fires.
     1.6 +
     1.7 +var g = newGlobal();
     1.8 +g.eval("var x = {toString: function () { debugger; log += 'x'; throw 'mud'; }};");
     1.9 +
    1.10 +var dbg = Debugger(g);
    1.11 +dbg.onDebuggerStatement = function (frame) {
    1.12 +    g.log += 'd';
    1.13 +    frame.older.onStep = function () {
    1.14 +        if (!g.log.match(/[sy]$/))
    1.15 +            g.log += 's';
    1.16 +    };
    1.17 +};
    1.18 +
    1.19 +g.log = '';
    1.20 +g.eval("try { x + ''; } catch (x) { }\n" +
    1.21 +       "log += 'y';\n");
    1.22 +assertEq(g.log, "dxsy");
    1.23 +
    1.24 +g.log = '';
    1.25 +g.eval("try { '' + x; } catch (x) { }\n" +
    1.26 +       "log += 'y';\n");
    1.27 +assertEq(g.log, "dxsy");

mercurial