michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Being in anonymous code, "this" and eval("this"), called as a function, return the global object michael@0: * michael@0: * @path ch11/11.1/11.1.1/S11.1.1_A4.1.js michael@0: * @description Creating function with new Function() constructor michael@0: */ michael@0: michael@0: //CHECK#1 michael@0: var MyFunction = new Function("return this"); michael@0: if (MyFunction() !== this) { michael@0: $ERROR('#1: var MyFunction = new Function("return this"); MyFunction() === this. Actual: ' + (MyFunction())); michael@0: } michael@0: michael@0: //CHECK#2 michael@0: MyFunction = new Function("return eval(\'this\')"); michael@0: if (MyFunction() !== this) { michael@0: $ERROR('#2: var MyFunction = new Function("return eval(\'this\')"); MyFunction() === this. Actual: ' + (MyFunction())); michael@0: } michael@0: michael@0: michael@0: