keith_miller@apple.com | bcc77f2 | 2016-07-15 06:03:25 +0000 | [diff] [blame] | 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 MyFunction() {return this} |
| 15 | if (MyFunction() !== this) { |
| 16 | $ERROR('#1: function MyFunction() {return this} MyFunction() === this. Actual: ' + (MyFunction())); |
| 17 | } |
| 18 | |
| 19 | //CHECK#2 |
| 20 | function MyFunction() {return eval("this")} |
| 21 | if (MyFunction() !== this) { |
| 22 | $ERROR('#2: function MyFunction() {return eval("this")} MyFunction() === this. Actual: ' + (MyFunction())); |
| 23 | } |