michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: * Contributors: Jason Orendorff, Brendan Eich michael@0: */ michael@0: michael@0: if (typeof newGlobal == 'function') { michael@0: var gsame = newGlobal('same-compartment'); michael@0: michael@0: gsame.eval("function f() { return this; }"); michael@0: f = gsame.f; michael@0: assertEq(f(), gsame); michael@0: michael@0: gsame.eval("function g() { 'use strict'; return this; }"); michael@0: g = gsame.g; michael@0: assertEq(g(), undefined); michael@0: michael@0: var gnew = newGlobal(); michael@0: michael@0: gnew.eval("function f() { return this; }"); michael@0: f = gnew.f; michael@0: assertEq(f(), gnew); michael@0: michael@0: gnew.eval("function g() { 'use strict'; return this; }"); michael@0: g = gnew.g; michael@0: assertEq(g(), undefined); michael@0: } michael@0: michael@0: reportCompare(0, 0, "ok");