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.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 Filename: break.js
michael@0 9 Description: 'Tests the break statement'
michael@0 10
michael@0 11 Author: Nick Lerissa
michael@0 12 Date: March 18, 1998
michael@0 13 */
michael@0 14
michael@0 15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
michael@0 16 var VERSION = 'no version';
michael@0 17 startTest();
michael@0 18 var TITLE = 'statements: break';
michael@0 19
michael@0 20 writeHeaderToLog("Executing script: break.js");
michael@0 21 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 22
michael@0 23 var i,j;
michael@0 24
michael@0 25 for (i = 0; i < 1000; i++)
michael@0 26 {
michael@0 27 if (i == 100) break;
michael@0 28 }
michael@0 29
michael@0 30 // 'breaking out of "for" loop'
michael@0 31 new TestCase ( SECTION, 'breaking out of "for" loop',
michael@0 32 100, i);
michael@0 33
michael@0 34 j = 2000;
michael@0 35
michael@0 36 out1:
michael@0 37 for (i = 0; i < 1000; i++)
michael@0 38 {
michael@0 39 if (i == 100)
michael@0 40 {
michael@0 41 out2:
michael@0 42 for (j = 0; j < 1000; j++)
michael@0 43 {
michael@0 44 if (j == 500) break out1;
michael@0 45 }
michael@0 46 j = 2001;
michael@0 47 }
michael@0 48 j = 2002;
michael@0 49 }
michael@0 50
michael@0 51 // 'breaking out of a "for" loop with a "label"'
michael@0 52 new TestCase ( SECTION, 'breaking out of a "for" loop with a "label"',
michael@0 53 500, j);
michael@0 54
michael@0 55 i = 0;
michael@0 56
michael@0 57 while (i < 1000)
michael@0 58 {
michael@0 59 if (i == 100) break;
michael@0 60 i++;
michael@0 61 }
michael@0 62
michael@0 63 // 'breaking out of a "while" loop'
michael@0 64 new TestCase ( SECTION, 'breaking out of a "while" loop',
michael@0 65 100, i );
michael@0 66
michael@0 67
michael@0 68 j = 2000;
michael@0 69 i = 0;
michael@0 70
michael@0 71 out3:
michael@0 72 while (i < 1000)
michael@0 73 {
michael@0 74 if (i == 100)
michael@0 75 {
michael@0 76 j = 0;
michael@0 77 out4:
michael@0 78 while (j < 1000)
michael@0 79 {
michael@0 80 if (j == 500) break out3;
michael@0 81 j++;
michael@0 82 }
michael@0 83 j = 2001;
michael@0 84 }
michael@0 85 j = 2002;
michael@0 86 i++;
michael@0 87 }
michael@0 88
michael@0 89 // 'breaking out of a "while" loop with a "label"'
michael@0 90 new TestCase ( SECTION, 'breaking out of a "while" loop with a "label"',
michael@0 91 500, j);
michael@0 92
michael@0 93 i = 0;
michael@0 94
michael@0 95 do
michael@0 96 {
michael@0 97 if (i == 100) break;
michael@0 98 i++;
michael@0 99 } while (i < 1000);
michael@0 100
michael@0 101 // 'breaking out of a "do" loop'
michael@0 102 new TestCase ( SECTION, 'breaking out of a "do" loop',
michael@0 103 100, i );
michael@0 104
michael@0 105 j = 2000;
michael@0 106 i = 0;
michael@0 107
michael@0 108 out5:
michael@0 109 do
michael@0 110 {
michael@0 111 if (i == 100)
michael@0 112 {
michael@0 113 j = 0;
michael@0 114 out6:
michael@0 115 do
michael@0 116 {
michael@0 117 if (j == 500) break out5;
michael@0 118 j++;
michael@0 119 }while (j < 1000);
michael@0 120 j = 2001;
michael@0 121 }
michael@0 122 j = 2002;
michael@0 123 i++;
michael@0 124 }while (i < 1000);
michael@0 125
michael@0 126 // 'breaking out of a "do" loop with a "label"'
michael@0 127 new TestCase ( SECTION, 'breaking out of a "do" loop with a "label"',
michael@0 128 500, j);
michael@0 129
michael@0 130 test();

mercurial