1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma/ExecutionContexts/10.2.3-1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + File Name: 10.2.3-1.js 1.12 + ECMA Section: 10.2.3 Function and Anonymous Code 1.13 + Description: 1.14 + 1.15 + The scope chain is initialized to contain the activation object followed 1.16 + by the global object. Variable instantiation is performed using the 1.17 + activation by the global object. Variable instantiation is performed using 1.18 + the activation object as the variable object and using property attributes 1.19 + { DontDelete }. The caller provides the this value. If the this value 1.20 + provided by the caller is not an object (including the case where it is 1.21 + null), then the this value is the global object. 1.22 + 1.23 + Author: christine@netscape.com 1.24 + Date: 12 november 1997 1.25 +*/ 1.26 + 1.27 +var SECTION = "10.2.3-1"; 1.28 +var VERSION = "ECMA_1"; 1.29 +startTest(); 1.30 +var TITLE = "Eval Code"; 1.31 + 1.32 +writeHeaderToLog( SECTION + " "+ TITLE); 1.33 + 1.34 +var o = new MyObject("hello") 1.35 + 1.36 + new TestCase( SECTION, 1.37 + "var o = new MyObject('hello'); o.THIS == x", 1.38 + true, 1.39 + o.THIS == o ); 1.40 + 1.41 +var o = MyFunction(); 1.42 + 1.43 +new TestCase( SECTION, 1.44 + "var o = MyFunction(); o == this", 1.45 + true, 1.46 + o == this ); 1.47 + 1.48 +test(); 1.49 + 1.50 +function MyFunction( value ) { 1.51 + return this; 1.52 +} 1.53 +function MyObject( value ) { 1.54 + this.THIS = this; 1.55 +}