js/src/tests/js1_2/statements/switch.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    Filename:     switch.js
     9    Description:  'Tests the switch statement'
    11    http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696
    13    Author:       Nick Lerissa
    14    Date:         March 19, 1998
    15 */
    17 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
    18 var VERSION = 'no version';
    19 var TITLE   = 'statements: switch';
    20 var BUGNUMBER="323696";
    22 startTest();
    23 writeHeaderToLog("Executing script: switch.js");
    24 writeHeaderToLog( SECTION + " "+ TITLE);
    27 var var1 = "match string";
    28 var match1 = false;
    29 var match2 = false;
    30 var match3 = false;
    32 switch (var1)
    33 {
    34 case "match string":
    35   match1 = true;
    36 case "bad string 1":
    37   match2 = true;
    38   break;
    39 case "bad string 2":
    40   match3 = true;
    41 }
    43 new TestCase ( SECTION, 'switch statement',
    44 	       true, match1);
    46 new TestCase ( SECTION, 'switch statement',
    47 	       true, match2);
    49 new TestCase ( SECTION, 'switch statement',
    50 	       false, match3);
    52 var var2 = 3;
    54 var match1 = false;
    55 var match2 = false;
    56 var match3 = false;
    57 var match4 = false;
    58 var match5 = false;
    60 switch (var2)
    61 {
    62 case 1:
    63 /*	        switch (var1)
    64   {
    65   case "foo":
    66   match1 = true;
    67   break;
    68   case 3:
    69   match2 = true;
    70   break;
    71   }*/
    72   match3 = true;
    73   break;
    74 case 2:
    75   match4 = true;
    76   break;
    77 case 3:
    78   match5 = true;
    79   break;
    80 }
    81 new TestCase ( SECTION, 'switch statement',
    82 	       false, match1);
    84 new TestCase ( SECTION, 'switch statement',
    85 	       false, match2);
    87 new TestCase ( SECTION, 'switch statement',
    88 	       false, match3);
    90 new TestCase ( SECTION, 'switch statement',
    91 	       false, match4);
    93 new TestCase ( SECTION, 'switch statement',
    94 	       true, match5);
    96 test();

mercurial