summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/regress/regress-636364.js
blob: 02df9878a91ff4e1d84d9ade3f86d3cb5cea6ba8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/licenses/publicdomain/
 * Contributors: Jason Orendorff, Brendan Eich
 */

if (typeof newGlobal == 'function') {
    var gsame = newGlobal('same-compartment');

    gsame.eval("function f() { return this; }");
    f = gsame.f;
    assertEq(f(), gsame);

    gsame.eval("function g() { 'use strict'; return this; }");
    g = gsame.g;
    assertEq(g(), undefined);

    var gnew = newGlobal();

    gnew.eval("function f() { return this; }");
    f = gnew.f;
    assertEq(f(), gnew);

    gnew.eval("function g() { 'use strict'; return this; }");
    g = gnew.g;
    assertEq(g(), undefined);
}

reportCompare(0, 0, "ok");