js/src/tests/js1_2/statements/break.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:     break.js
     9    Description:  'Tests the break statement'
    11    Author:       Nick Lerissa
    12    Date:         March 18, 1998
    13 */
    15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
    16 var VERSION = 'no version';
    17 startTest();
    18 var TITLE   = 'statements: break';
    20 writeHeaderToLog("Executing script: break.js");
    21 writeHeaderToLog( SECTION + " "+ TITLE);
    23 var i,j;
    25 for (i = 0; i < 1000; i++)
    26 {
    27   if (i == 100) break;
    28 }
    30 // 'breaking out of "for" loop'
    31 new TestCase ( SECTION, 'breaking out of "for" loop',
    32 	       100, i);
    34 j = 2000;
    36 out1:
    37 for (i = 0; i < 1000; i++)
    38 {
    39   if (i == 100)
    40   {
    41   out2:
    42     for (j = 0; j < 1000; j++)
    43     {
    44       if (j == 500) break out1;
    45     }
    46     j = 2001;
    47   }
    48   j = 2002;
    49 }
    51 // 'breaking out of a "for" loop with a "label"'
    52 new TestCase ( SECTION, 'breaking out of a "for" loop with a "label"',
    53 	       500, j);
    55 i = 0;
    57 while (i < 1000)
    58 {
    59   if (i == 100) break;
    60   i++;
    61 }
    63 // 'breaking out of a "while" loop'
    64 new TestCase ( SECTION, 'breaking out of a "while" loop',
    65 	       100, i );
    68 j = 2000;
    69 i = 0;
    71 out3:
    72 while (i < 1000)
    73 {
    74   if (i == 100)
    75   {
    76     j = 0;
    77   out4:
    78     while (j < 1000)
    79     {
    80       if (j == 500) break out3;
    81       j++;
    82     }
    83     j = 2001;
    84   }
    85   j = 2002;
    86   i++;
    87 }
    89 // 'breaking out of a "while" loop with a "label"'
    90 new TestCase ( SECTION, 'breaking out of a "while" loop with a "label"',
    91 	       500, j);
    93 i = 0;
    95 do
    96 {
    97   if (i == 100) break;
    98   i++;
    99 } while (i < 1000);
   101 // 'breaking out of a "do" loop'
   102 new TestCase ( SECTION, 'breaking out of a "do" loop',
   103 	       100, i );
   105 j = 2000;
   106 i = 0;
   108 out5:
   109 do
   110 {
   111   if (i == 100)
   112   {
   113     j = 0;
   114   out6:
   115     do
   116     {
   117       if (j == 500) break out5;
   118       j++;
   119     }while (j < 1000);
   120     j = 2001;
   121   }
   122   j = 2002;
   123   i++;
   124 }while (i < 1000);
   126 // 'breaking out of a "do" loop with a "label"'
   127 new TestCase ( SECTION, 'breaking out of a "do" loop with a "label"',
   128 	       500, j);
   130 test();

mercurial