js/src/tests/ecma_2/Statements/forin-002.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial