js/src/tests/js1_2/statements/continue.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:     continue.js
     9    Description:  'Tests the continue 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: continue';
    20 writeHeaderToLog("Executing script: continue.js");
    21 writeHeaderToLog( SECTION + " "+ TITLE);
    23 var i,j;
    25 j = 0;
    26 for (i = 0; i < 200; i++)
    27 {
    28   if (i == 100)
    29     continue;
    30   j++;
    31 }
    33 // '"continue" in a "for" loop'
    34 new TestCase ( SECTION, '"continue" in "for" loop',
    35 	       199, j);
    38 j = 0;
    39 out1:
    40 for (i = 0; i < 1000; i++)
    41 {
    42   if (i == 100)
    43   {
    44   out2:
    45     for (var k = 0; k < 1000; k++)
    46     {
    47       if (k == 500) continue out1;
    48     }
    49     j = 3000;
    50   }
    51   j++;
    52 }
    54 // '"continue" in a "for" loop with a "label"'
    55 new TestCase ( SECTION, '"continue" in "for" loop with a "label"',
    56 	       999, j);
    58 i = 0;
    59 j = 1;
    61 while (i != j)
    62 {
    63   i++;
    64   if (i == 100) continue;
    65   j++;
    66 }
    68 // '"continue" in a "while" loop'
    69 new TestCase ( SECTION, '"continue" in a "while" loop',
    70 	       100, j );
    72 j = 0;
    73 i = 0;
    74 out3:
    75 while (i < 1000)
    76 {
    77   if (i == 100)
    78   {
    79     var k = 0;
    80   out4:
    81     while (k < 1000)
    82     {
    83       if (k == 500)
    84       {
    85 	i++;
    86 	continue out3;
    87       }
    88       k++;
    89     }
    90     j = 3000;
    91   }
    92   j++;
    93   i++;
    94 }
    96 // '"continue" in a "while" loop with a "label"'
    97 new TestCase ( SECTION, '"continue" in a "while" loop with a "label"',
    98 	       999, j);
   100 i = 0;
   101 j = 1;
   103 do
   104 {
   105   i++;
   106   if (i == 100) continue;
   107   j++;
   108 } while (i != j);
   111 // '"continue" in a "do" loop'
   112 new TestCase ( SECTION, '"continue" in a "do" loop',
   113 	       100, j );
   115 j = 0;
   116 i = 0;
   117 out5:
   118 do
   119 {
   120   if (i == 100)
   121   {
   122     var k = 0;
   123   out6:
   124     do
   125     {
   126       if (k == 500)
   127       {
   128 	i++;
   129 	continue out5;
   130       }
   131       k++;
   132     }while (k < 1000);
   133     j = 3000;
   134   }
   135   j++;
   136   i++;
   137 }while (i < 1000);
   139 // '"continue" in a "do" loop with a "label"'
   140 new TestCase ( SECTION, '"continue" in a "do" loop with a "label"',
   141 	       999, j);
   143 test();

mercurial