S11.1.1_A3.1.js (813B)
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 function code, "this" and eval("this"), called as a functions, 7 return the global object 8 es5id: 11.1.1_A3.1 9 description: Creating function which returns "this" or eval("this") 10 flags: [noStrict] 11 ---*/ 12 13 //CHECK#1 14 function ReturnThis() {return this} 15 if (ReturnThis() !== this) { 16 throw new Test262Error('#1: function ReturnThis() {return this} ReturnThis() === this. Actual: ' + (ReturnThis())); 17 } 18 19 //CHECK#2 20 function ReturnEvalThis() {return eval("this")} 21 if (ReturnEvalThis() !== this) { 22 throw new Test262Error('#2: function ReturnEvalThis() {return eval("this")} ReturnEvalThis() === this. Actual: ' + (ReturnEvalThis())); 23 } 24 25 reportCompare(0, 0);