blob: 13e1d3fddef3022d66afb0aee2882baea64fb168 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright 2009 the Sputnik authors. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3
4/*---
5info: >
6 Being in function code, "this" and eval("this"), called as a functions,
7 return the global object
8es5id: 11.1.1_A3.1
9description: Creating function which returns "this" or eval("this")
10flags: [noStrict]
11---*/
12
13//CHECK#1
14function MyFunction() {return this}
15if (MyFunction() !== this) {
16 $ERROR('#1: function MyFunction() {return this} MyFunction() === this. Actual: ' + (MyFunction()));
17}
18
19//CHECK#2
20function MyFunction() {return eval("this")}
21if (MyFunction() !== this) {
22 $ERROR('#2: function MyFunction() {return eval("this")} MyFunction() === this. Actual: ' + (MyFunction()));
23}