js/src/tests/js1_8_5/regress/regress-636364.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_8_5/regress/regress-636364.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,29 @@
     1.4 +/*
     1.5 + * Any copyright is dedicated to the Public Domain.
     1.6 + * http://creativecommons.org/licenses/publicdomain/
     1.7 + * Contributors: Jason Orendorff, Brendan Eich
     1.8 + */
     1.9 +
    1.10 +if (typeof newGlobal == 'function') {
    1.11 +    var gsame = newGlobal('same-compartment');
    1.12 +
    1.13 +    gsame.eval("function f() { return this; }");
    1.14 +    f = gsame.f;
    1.15 +    assertEq(f(), gsame);
    1.16 +
    1.17 +    gsame.eval("function g() { 'use strict'; return this; }");
    1.18 +    g = gsame.g;
    1.19 +    assertEq(g(), undefined);
    1.20 +
    1.21 +    var gnew = newGlobal();
    1.22 +
    1.23 +    gnew.eval("function f() { return this; }");
    1.24 +    f = gnew.f;
    1.25 +    assertEq(f(), gnew);
    1.26 +
    1.27 +    gnew.eval("function g() { 'use strict'; return this; }");
    1.28 +    g = gnew.g;
    1.29 +    assertEq(g(), undefined);
    1.30 +}
    1.31 +
    1.32 +reportCompare(0, 0, "ok");

mercurial