js/src/jit-test/tests/debug/Environment-setVariable-11.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-setVariable-11.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,16 @@
     1.4 +// setVariable cannot modify the binding for a FunctionExpression's name.
     1.5 +
     1.6 +load(libdir + "asserts.js");
     1.7 +
     1.8 +var g = newGlobal();
     1.9 +var dbg = Debugger(g);
    1.10 +var hits = 0;
    1.11 +dbg.onDebuggerStatement = function (frame) {
    1.12 +    var env = frame.environment.find("f");
    1.13 +    assertEq(env.getVariable("f"), frame.callee);
    1.14 +    assertThrowsInstanceOf(function () { env.setVariable("f", 0) }, TypeError);
    1.15 +    assertThrowsInstanceOf(function () { env.setVariable("f", frame.callee) }, TypeError);
    1.16 +    hits++;
    1.17 +};
    1.18 +g.eval("(function f() { debugger; })();");
    1.19 +assertEq(hits, 1);

mercurial