js/src/tests/ecma_2/Statements/while-003.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.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8  *  File Name:          while-003
     9  *  ECMA Section:
    10  *  Description:        while statement
    11  *
    12  *  The while expression evaluates to true, Statement returns abrupt completion.
    13  *
    14  *  Author:             christine@netscape.com
    15  *  Date:               11 August 1998
    16  */
    17 var SECTION = "while-003";
    18 var VERSION = "ECMA_2";
    19 var TITLE   = "while statement";
    21 startTest();
    22 writeHeaderToLog( SECTION + " "+ TITLE);
    24 DoWhile( new DoWhileObject(
    25 	   "while expression is true",
    26 	   true,
    27 	   "result = \"pass\";" ));
    29 DoWhile( new DoWhileObject(
    30 	   "while expression is 1",
    31 	   1,
    32 	   "result = \"pass\";" ));
    34 DoWhile( new DoWhileObject(
    35 	   "while expression is new Boolean(false)",
    36 	   new Boolean(false),
    37 	   "result = \"pass\";" ));
    39 DoWhile( new DoWhileObject(
    40 	   "while expression is new Object()",
    41 	   new Object(),
    42 	   "result = \"pass\";" ));
    44 DoWhile( new DoWhileObject(
    45 	   "while expression is \"hi\"",
    46 	   "hi",
    47 	   "result = \"pass\";" ));
    48 /*
    49   DoWhile( new DoWhileObject(
    50   "while expression has a continue in it",
    51   "true",
    52   "if ( i == void 0 ) i = 0; result=\"pass\"; if ( ++i == 1 ) {continue;} else {break;} result=\"fail\";"
    53   ));
    54 */
    55 test();
    57 function DoWhileObject( d, e, s ) {
    58   this.description = d;
    59   this.whileExpression = e;
    60   this.statements = s;
    61 }
    63 function DoWhile( object ) {
    64   result = "fail:  statements in while block were not evaluated";
    66   while ( expression = object.whileExpression ) {
    67     eval( object.statements );
    68     break;
    69   }
    71   // verify that the while expression was evaluated
    73   new TestCase(
    74     SECTION,
    75     "verify that while expression was evaluated (should be "+
    76     object.whileExpression +")",
    77     "pass",
    78     (object.whileExpression == expression ||
    79      ( isNaN(object.whileExpression) && isNaN(expression) )
    80       ) ? "pass" : "fail" );
    82   new TestCase(
    83     SECTION,
    84     object.description,
    85     "pass",
    86     result );
    87 }

mercurial