Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 /**
9 * File Name: forin-002.js
10 * ECMA Section:
11 * Description: The forin-001 statement
12 *
13 * Verify that the property name is assigned to the property on the left
14 * hand side of the for...in expression.
15 *
16 * Author: christine@netscape.com
17 * Date: 28 August 1998
18 */
19 var SECTION = "forin-002";
20 var VERSION = "ECMA_2";
21 var TITLE = "The for...in statement";
23 startTest();
24 writeHeaderToLog( SECTION + " "+ TITLE);
26 function MyObject( value ) {
27 this.value = value;
28 this.valueOf = new Function ( "return this.value" );
29 this.toString = new Function ( "return this.value + \"\"" );
30 this.toNumber = new Function ( "return this.value + 0" );
31 this.toBoolean = new Function ( "return Boolean( this.value )" );
32 }
34 ForIn_1(this);
35 ForIn_2(this);
37 ForIn_1(new MyObject(true));
38 ForIn_2(new MyObject(new Boolean(true)));
40 ForIn_2(3);
42 test();
44 /**
45 * For ... In in a With Block
46 *
47 */
48 function ForIn_1( object) {
49 with ( object ) {
50 for ( property in object ) {
51 new TestCase(
52 SECTION,
53 "with loop in a for...in loop. ("+object+")["+property +"] == "+
54 "eval ( " + property +" )",
55 true,
56 object[property] == eval(property) );
57 }
58 }
59 }
61 /**
62 * With block in a For...In loop
63 *
64 */
65 function ForIn_2(object) {
66 for ( property in object ) {
67 with ( object ) {
68 new TestCase(
69 SECTION,
70 "with loop in a for...in loop. ("+object+")["+property +"] == "+
71 "eval ( " + property +" )",
72 true,
73 object[property] == eval(property) );
74 }
75 }
76 }