js/src/jit-test/tests/debug/Environment-getVariable-WouldRun.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/Environment-getVariable-WouldRun.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +// getVariable that would trigger a getter does not crash or explode.
     1.5 +// It should throw WouldRunDebuggee, but that isn't implemented yet.
     1.6 +
     1.7 +load(libdir + "asserts.js");
     1.8 +
     1.9 +var g = newGlobal();
    1.10 +var dbg = Debugger(g);
    1.11 +var hits = 0;
    1.12 +dbg.onDebuggerStatement = function (frame) {
    1.13 +    assertThrowsInstanceOf(function () {
    1.14 +        frame.environment.getVariable("x");
    1.15 +    }, Error);
    1.16 +    hits++;
    1.17 +};
    1.18 +g.eval("Object.defineProperty(this, 'x', {get: function () { throw new Error('fail'); }});\n" +
    1.19 +       "debugger;");
    1.20 +assertEq(hits, 1);

mercurial