michael@0: // |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android 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: forin-002.js michael@0: * ECMA Section: michael@0: * Description: The forin-001 statement michael@0: * michael@0: * Verify that the property name is assigned to the property on the left michael@0: * hand side of the for...in expression. michael@0: * michael@0: * Author: christine@netscape.com michael@0: * Date: 28 August 1998 michael@0: */ michael@0: var SECTION = "forin-002"; michael@0: var VERSION = "ECMA_2"; michael@0: var TITLE = "The for...in statement"; michael@0: michael@0: startTest(); michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: function MyObject( value ) { michael@0: this.value = value; michael@0: this.valueOf = new Function ( "return this.value" ); michael@0: this.toString = new Function ( "return this.value + \"\"" ); michael@0: this.toNumber = new Function ( "return this.value + 0" ); michael@0: this.toBoolean = new Function ( "return Boolean( this.value )" ); michael@0: } michael@0: michael@0: ForIn_1(this); michael@0: ForIn_2(this); michael@0: michael@0: ForIn_1(new MyObject(true)); michael@0: ForIn_2(new MyObject(new Boolean(true))); michael@0: michael@0: ForIn_2(3); michael@0: michael@0: test(); michael@0: michael@0: /** michael@0: * For ... In in a With Block michael@0: * michael@0: */ michael@0: function ForIn_1( object) { michael@0: with ( object ) { michael@0: for ( property in object ) { michael@0: new TestCase( michael@0: SECTION, michael@0: "with loop in a for...in loop. ("+object+")["+property +"] == "+ michael@0: "eval ( " + property +" )", michael@0: true, michael@0: object[property] == eval(property) ); michael@0: } michael@0: } michael@0: } michael@0: michael@0: /** michael@0: * With block in a For...In loop michael@0: * michael@0: */ michael@0: function ForIn_2(object) { michael@0: for ( property in object ) { michael@0: with ( object ) { michael@0: new TestCase( michael@0: SECTION, michael@0: "with loop in a for...in loop. ("+object+")["+property +"] == "+ michael@0: "eval ( " + property +" )", michael@0: true, michael@0: object[property] == eval(property) ); michael@0: } michael@0: } michael@0: } michael@0: