js/src/tests/ecma_2/Statements/dowhile-007.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:          dowhile-007
     9  *  ECMA Section:
    10  *  Description:        do...while statements
    11  *
    12  *  A general do...while test.
    13  *
    14  *  Author:             christine@netscape.com
    15  *  Date:               26 August 1998
    16  */
    17 var SECTION = "dowhile-007";
    18 var VERSION = "ECMA_2";
    19 var TITLE   = "do...while";
    21 startTest();
    22 writeHeaderToLog( SECTION + " "+ TITLE);
    24 DoWhile( new DoWhileObject( false, false, false, false ));
    25 DoWhile( new DoWhileObject( true, false, false, false ));
    26 DoWhile( new DoWhileObject( true, true, false, false ));
    27 DoWhile( new DoWhileObject( true, true, true, false ));
    28 DoWhile( new DoWhileObject( true, true, true, true ));
    29 DoWhile( new DoWhileObject( false, false, false, true ));
    30 DoWhile( new DoWhileObject( false, false, true, true ));
    31 DoWhile( new DoWhileObject( false, true, true, true ));
    32 DoWhile( new DoWhileObject( false, false, true, false ));
    34 test();
    36 function DoWhileObject( out1, out2, out3, in1 ) {
    37   this.breakOutOne = out1;
    38   this.breakOutTwo = out2;
    39   this.breakOutThree = out3;
    40   this.breakIn = in1;
    41 }
    42 function DoWhile( object ) {
    43   result1 = false;
    44   result2 = false;
    45   result3 = false;
    46   result4 = false;
    48 outie:
    49   do {
    50     if ( object.breakOutOne ) {
    51       break outie;
    52     }
    53     result1 = true;
    55   innie:
    56     do {
    57       if ( object.breakOutTwo ) {
    58 	break outie;
    59       }
    60       result2 = true;
    62       if ( object.breakIn ) {
    63 	break innie;
    64       }
    65       result3 = true;
    67     } while ( false );
    68     if ( object.breakOutThree ) {
    69       break outie;
    70     }
    71     result4 = true;
    72   } while ( false );
    74   new TestCase(
    75     SECTION,
    76     "break one: ",
    77     (object.breakOutOne) ? false : true,
    78     result1 );
    80   new TestCase(
    81     SECTION,
    82     "break two: ",
    83     (object.breakOutOne||object.breakOutTwo) ? false : true,
    84     result2 );
    86   new TestCase(
    87     SECTION,
    88     "break three: ",
    89     (object.breakOutOne||object.breakOutTwo||object.breakIn) ? false : true,
    90     result3 );
    92   new TestCase(
    93     SECTION,
    94     "break four: ",
    95     (object.breakOutOne||object.breakOutTwo||object.breakOutThree) ? false: true,
    96     result4 );
    97 }

mercurial