michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 10.1.5-4.js michael@0: ECMA Section: 10.1.5 Global Object michael@0: Description: michael@0: There is a unique global object which is created before control enters michael@0: any execution context. Initially the global object has the following michael@0: properties: michael@0: michael@0: Built-in objects such as Math, String, Date, parseInt, etc. These have michael@0: attributes { DontEnum }. michael@0: michael@0: Additional host defined properties. This may include a property whose michael@0: value is the global object itself, for example window in HTML. michael@0: michael@0: As control enters execution contexts, and as ECMAScript code is executed, michael@0: additional properties may be added to the global object and the initial michael@0: properties may be changed. michael@0: michael@0: Author: christine@netscape.com michael@0: Date: 12 november 1997 michael@0: */ michael@0: var SECTION = "10.5.1-4"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: michael@0: writeHeaderToLog( SECTION + " Global Object"); michael@0: michael@0: new TestCase( "SECTION", "Anonymous Code check" ); michael@0: michael@0: michael@0: var EVAL_STRING = 'if ( Object == null ) { gTestcases[0].reason += " Object == null" ; }' + michael@0: 'if ( Function == null ) { gTestcases[0].reason += " Function == null"; }' + michael@0: 'if ( String == null ) { gTestcases[0].reason += " String == null"; }' + michael@0: 'if ( Array == null ) { gTestcases[0].reason += " Array == null"; }' + michael@0: 'if ( Number == null ) { gTestcases[0].reason += " Function == null";}' + michael@0: 'if ( Math == null ) { gTestcases[0].reason += " Math == null"; }' + michael@0: 'if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; }' + michael@0: 'if ( Date == null ) { gTestcases[0].reason += " Date == null"; }' + michael@0: 'if ( eval == null ) { gTestcases[0].reason += " eval == null"; }' + michael@0: 'if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; }' ; michael@0: michael@0: var NEW_FUNCTION = new Function( EVAL_STRING ); michael@0: michael@0: if ( gTestcases[0].reason != "" ) { michael@0: gTestcases[0].actual = "fail"; michael@0: } else { michael@0: gTestcases[0].actual = "pass"; michael@0: } michael@0: gTestcases[0].expect = "pass"; michael@0: michael@0: test();