S11.1.1_A4.1.js (810B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 Being in anonymous code, "this" and eval("this"), called as a function, 7 return the global object 8 es5id: 11.1.1_A4.1 9 description: Creating function with new Function() constructor 10 ---*/ 11 12 //CHECK#1 13 var MyFunction = new Function("return this"); 14 if (MyFunction() !== this) { 15 throw new Test262Error('#1: var MyFunction = new Function("return this"); MyFunction() === this. Actual: ' + (MyFunction())); 16 } 17 18 //CHECK#2 19 MyFunction = new Function("return eval(\'this\')"); 20 if (MyFunction() !== this) { 21 throw new Test262Error('#2: var MyFunction = new Function("return eval(\'this\')"); MyFunction() === this. Actual: ' + (MyFunction())); 22 } 23 24 reportCompare(0, 0);