js/src/tests/ecma_2/Statements/dowhile-004.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-004
     9  *  ECMA Section:
    10  *  Description:        do...while statements
    11  *
    12  *  Test a labeled do...while.  Break out of the loop with no label
    13  *  should break out of the loop, but not out of the label.
    14  *
    15  *  Author:             christine@netscape.com
    16  *  Date:               11 August 1998
    17  */
    18 var SECTION = "dowhile-004";
    19 var VERSION = "ECMA_2";
    20 var TITLE   = "do...while with a labeled continue statement";
    22 startTest();
    23 writeHeaderToLog( SECTION + " "+ TITLE);
    25 DoWhile( 0, 1 );
    26 DoWhile( 1, 1 );
    27 DoWhile( -1, 1 );
    28 DoWhile( 5, 5 );
    30 test();
    32 function DoWhile( limit, expect ) {
    33   i = 0;
    34   result1 = "pass";
    35   result2 = "failed: broke out of labeled statement unexpectedly";
    37 foo: {
    38     do {
    39       i++;
    40       if ( ! (i < limit) ) {
    41 	break;
    42 	result1 = "fail: evaluated statement after a labeled break";
    43       }
    44     } while ( true );
    46     result2 = "pass";
    47   }
    49   new TestCase(
    50     SECTION,
    51     "do while ( " + i +" < " + limit +" )",
    52     expect,
    53     i );
    55   new TestCase(
    56     SECTION,
    57     "breaking out of a do... while loop",
    58     "pass",
    59     result1 );
    62   new TestCase(
    63     SECTION,
    64     "breaking out of a labeled do...while loop",
    65     "pass",
    66     result2 );
    67 }

mercurial