js/src/tests/ecma_2/Statements/switch-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:          switch-003.js
     9  *  ECMA Section:
    10  *  Description:        The switch Statement
    11  *
    12  *  Attempt to verify that case statements are evaluated in source order
    13  *
    14  *  Author:             christine@netscape.com
    15  *  Date:               11 August 1998
    16  *
    17  */
    18 var SECTION = "switch-003";
    19 var VERSION = "ECMA_2";
    20 var TITLE   = "The switch statement";
    22 startTest();
    23 writeHeaderToLog( SECTION + " "+ TITLE);
    25 SwitchTest( "a", "abc" );
    26 SwitchTest( "b", "bc" );
    27 SwitchTest( "c", "c" );
    28 SwitchTest( "d", "*abc" );
    29 SwitchTest( "v", "*abc" );
    30 SwitchTest( "w", "w*abc" );
    31 SwitchTest( "x", "xw*abc" );
    32 SwitchTest( "y", "yxw*abc" );
    33 SwitchTest( "z", "zyxw*abc" );
    34 //    SwitchTest( new java.lang.String("z"), "*abc" );
    36 test();
    38 function SwitchTest( input, expect ) {
    39   var result = "";
    41   switch ( input ) {
    42   case "z": result += "z";
    43   case "y": result += "y";
    44   case "x": result += "x";
    45   case "w": result += "w";
    46   default: result += "*";
    47   case "a": result += "a";
    48   case "b": result += "b";
    49   case "c": result += "c";
    50   }
    52   new TestCase(
    53     SECTION,
    54     "switch with no breaks:  input is " + input,
    55     expect,
    56     result );
    57 }

mercurial