michael@0: // |reftest| skip-if(!xulRuntime.shell) -- needs newGlobal() michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 608473; michael@0: var summary = michael@0: '|var eval = otherWindow.eval; eval(...)| should behave like indirectly ' + michael@0: 'calling that eval from a script in that other window'; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: var originalEval = eval; michael@0: var res; michael@0: michael@0: function f() michael@0: { michael@0: return [this, eval("this")]; michael@0: } michael@0: michael@0: var otherGlobalSameCompartment = newGlobal("same-compartment"); michael@0: michael@0: eval = otherGlobalSameCompartment.eval; michael@0: res = new f(); michael@0: assertEq(res[0] !== res[1], true); michael@0: assertEq(res[0] !== this, true); michael@0: assertEq(res[0] instanceof f, true); michael@0: assertEq(res[1], otherGlobalSameCompartment); michael@0: michael@0: res = f(); michael@0: assertEq(res[0] !== res[1], true); michael@0: assertEq(res[0], this); michael@0: assertEq(res[1], otherGlobalSameCompartment); michael@0: michael@0: var otherGlobalDifferentCompartment = newGlobal(); michael@0: michael@0: eval = otherGlobalDifferentCompartment.eval; michael@0: res = new f(); michael@0: assertEq(res[0] !== res[1], true); michael@0: assertEq(res[0] !== this, true); michael@0: assertEq(res[0] instanceof f, true); michael@0: assertEq(res[1], otherGlobalDifferentCompartment); michael@0: michael@0: res = f(); michael@0: assertEq(res[0] !== res[1], true); michael@0: assertEq(res[0], this); michael@0: assertEq(res[1], otherGlobalDifferentCompartment); michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("All tests passed!");