| 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | |
| 6 | gTestfile = '10.2.3-1.js'; |
| 7 | |
| 8 | /** |
| 9 | File Name: 10.2.3-1.js |
| 10 | ECMA Section: 10.2.3 Function and Anonymous Code |
| 11 | Description: |
| 12 | |
| 13 | The scope chain is initialized to contain the activation object followed |
| 14 | by the global object. Variable instantiation is performed using the |
| 15 | activation by the global object. Variable instantiation is performed using |
| 16 | the activation object as the variable object and using property attributes |
| 17 | { DontDelete }. The caller provides the this value. If the this value |
| 18 | provided by the caller is not an object (including the case where it is |
| 19 | null), then the this value is the global object. |
| 20 | |
| 21 | Author: [email protected] |
| 22 | Date: 12 november 1997 |
| 23 | */ |
| 24 | |
| 25 | var SECTION = "10.2.3-1"; |
| 26 | var VERSION = "ECMA_1"; |
| 27 | startTest(); |
| 28 | var TITLE = "Eval Code"; |
| 29 | |
| 30 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 31 | |
| 32 | var o = new MyObject("hello") |
| 33 | |
| 34 | new TestCase( SECTION, |
| 35 | "var o = new MyObject('hello'); o.THIS == x", |
| 36 | true, |
| 37 | o.THIS == o ); |
| 38 | |
| 39 | var o = MyFunction(); |
| 40 | |
| 41 | new TestCase( SECTION, |
| 42 | "var o = MyFunction(); o == this", |
| 43 | true, |
| 44 | o == this ); |
| 45 | |
| 46 | test(); |
| 47 | |
| 48 | function MyFunction( value ) { |
| 49 | return this; |
| 50 | } |
| 51 | function MyObject( value ) { |
| 52 | this.THIS = this; |
| 53 | } |