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

     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-002
     9  *  ECMA Section:
    10  *  Description:        do...while statements
    11  *
    12  *  Verify that code after a labeled break is not executed.  Verify that
    13  *  a labeled break breaks you out of the whole labeled block, and not
    14  *  just the current iteration statement.
    15  *
    16  *  Author:             christine@netscape.com
    17  *  Date:               11 August 1998
    18  */
    19 var SECTION = "dowhile-002";
    20 var VERSION = "ECMA_2";
    21 var TITLE   = "do...while with a labeled continue statement";
    23 startTest();
    24 writeHeaderToLog( SECTION + " "+ TITLE);
    26 LabeledContinue( 0, 1 );
    27 LabeledContinue( 1, 1 );
    28 LabeledContinue( -1, 1 );
    29 LabeledContinue( 5, 5 );
    31 test();
    33 // The labeled statement contains statements after the labeled break.
    34 // Verify that the statements after the break are not executed.
    36 function LabeledContinue( limit, expect ) {
    37   i = 0;
    38   result1 = "pass";
    39   result2 = "pass";
    41 woohoo: {
    42     do {
    43       i++;
    44       if ( ! (i < limit) ) {
    45 	break woohoo;
    46 	result1 = "fail: evaluated statement after a labeled break";
    47       }
    48     } while ( true );
    50     result2 = "failed:  broke out of loop, but not out of labeled block";
    51   }
    53   new TestCase(
    54     SECTION,
    55     "do while ( " + i +" < " + limit +" )",
    56     expect,
    57     i );
    59   new TestCase(
    60     SECTION,
    61     "breaking out of a do... while loop",
    62     "pass",
    63     result1 );
    66   new TestCase(
    67     SECTION,
    68     "breaking out of a labeled do...while loop",
    69     "pass",
    70     result2 );
    71 }

mercurial