js/src/jit-test/tests/debug/Frame-this-01.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-this-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,22 @@
     1.4 +// Frame.prototype.this in strict-mode functions, with primitive values
     1.5 +
     1.6 +var g = newGlobal();
     1.7 +var dbg = new Debugger(g);
     1.8 +var hits = 0;
     1.9 +dbg.onDebuggerStatement = function (frame) {
    1.10 +    hits++;
    1.11 +    assertEq(frame.this, g.v);
    1.12 +};
    1.13 +
    1.14 +g.eval("function f() { 'use strict'; debugger; }");
    1.15 +
    1.16 +g.eval("Boolean.prototype.f = f; v = true; v.f();");
    1.17 +g.eval("f.call(v);");
    1.18 +g.eval("Number.prototype.f = f; v = 3.14; v.f();");
    1.19 +g.eval("f.call(v);");
    1.20 +g.eval("String.prototype.f = f; v = 'hello'; v.f();");
    1.21 +g.eval("f.call(v);");
    1.22 +g.eval("v = undefined; f.call(v);");
    1.23 +g.eval("v = null; f.call(v);");
    1.24 +
    1.25 +assertEq(hits, 8);

mercurial