Sat, 03 Jan 2015 20:18:00 +0100
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: while-004
9 * ECMA Section:
10 * Description: while statement
11 *
12 * Author: christine@netscape.com
13 * Date: 11 August 1998
14 */
15 var SECTION = "while-004";
16 var VERSION = "ECMA_2";
17 var TITLE = "while statement";
18 var BUGNUMBER="316725";
20 startTest();
21 writeHeaderToLog( SECTION + " "+ TITLE);
23 DoWhile_1();
24 DoWhile_2();
25 DoWhile_3();
26 DoWhile_4();
27 DoWhile_5();
29 test();
31 /**
32 * Break out of a while by calling return.
33 *
34 * Tests: 12.6.2 step 6.
35 */
36 function dowhile() {
37 result = "pass";
39 while (true) {
40 return result;
41 result = "fail: hit code after return statement";
42 break;
43 }
44 }
46 function DoWhile_1() {
47 description = "return statement in a while block";
49 result = dowhile();
51 new TestCase(
52 SECTION,
53 "DoWhile_1" + description,
54 "pass",
55 result );
56 }
58 /**
59 * While with a labeled continue statement. Verify that statements
60 * after the continue statement are not evaluated.
61 *
62 * Tests: 12.6.2 step 8.
63 *
64 */
65 function DoWhile_2() {
66 var description = "while with a labeled continue statement";
67 var result1 = "pass";
68 var result2 = "fail: did not execute code after loop, but inside label";
69 var i = 0;
70 var j = 0;
72 theloop:
73 while( i++ < 10 ) {
74 j++;
75 continue theloop;
76 result1 = "failed: hit code after continue statement";
77 }
78 result2 = "pass";
80 new TestCase(
81 SECTION,
82 "DoWhile_2: " +description + " - code inside the loop, before the continue should be executed ("+j+")",
83 true,
84 j == 10 );
86 new TestCase(
87 SECTION,
88 "DoWhile_2: " +description +" - code after labeled continue should not be executed",
89 "pass",
90 result1 );
92 new TestCase(
93 SECTION,
94 "DoWhile_2: " +description +" - code after loop but inside label should be executed",
95 "pass",
96 result2 );
97 }
99 /**
100 * While with a labeled break.
101 *
102 */
103 function DoWhile_3() {
104 var description = "while with a labeled break statement";
105 var result1 = "pass";
106 var result2 = "pass";
107 var result3 = "fail: did not get to code after label";
109 woohoo: {
110 while( true ) {
111 break woohoo;
112 result1 = "fail: got to code after a break";
113 }
114 result2 = "fail: got to code outside of loop but inside label";
115 }
117 result3 = "pass";
119 new TestCase(
120 SECTION,
121 "DoWhile_3: " +description +" - verify break out of loop",
122 "pass",
123 result1 );
126 new TestCase(
127 SECTION,
128 "DoWhile_3: " +description +" - verify break out of label",
129 "pass",
130 result2 );
132 new TestCase(
133 SECTION,
134 "DoWhile_3: " +description + " - verify correct exit from label",
135 "pass",
136 result3 );
137 }
140 /**
141 * Labled while with an unlabeled break
142 *
143 */
144 function DoWhile_4() {
145 var description = "labeled while with an unlabeled break";
146 var result1 = "pass";
147 var result2 = "pass";
148 var result3 = "fail: did not evaluate statement after label";
150 woohooboy: {
151 while( true ) {
152 break woohooboy;
153 result1 = "fail: got to code after the break";
154 }
155 result2 = "fail: broke out of while, but not out of label";
156 }
157 result3 = "pass";
159 new TestCase(
160 SECTION,
161 "DoWhile_4: " +description +" - verify break out of while loop",
162 "pass",
163 result1 );
165 new TestCase(
166 SECTION,
167 "DoWhile_4: " +description + " - verify break out of label",
168 "pass",
169 result2 );
171 new TestCase(
172 SECTION,
173 "DoWhile_4: " +description +" - verify that statements after label are evaluated",
174 "pass",
175 result3 );
176 }
178 /**
179 * in this case, should behave the same way as
180 *
181 *
182 */
183 function DoWhile_5() {
184 var description = "while with a labeled continue statement";
185 var result1 = "pass";
186 var result2 = "fail: did not execute code after loop, but inside label";
187 var i = 0;
188 var j = 0;
190 theloop: {
191 j++;
192 while( i++ < 10 ) {
193 continue;
194 result1 = "failed: hit code after continue statement";
195 }
196 result2 = "pass";
197 }
199 new TestCase(
200 SECTION,
201 "DoWhile_5: " +description + " - continue should not execute statements above the loop",
202 true,
203 ( j == 1 ) );
205 new TestCase(
206 SECTION,
207 "DoWhile_5: " +description +" - code after labeled continue should not be executed",
208 "pass",
209 result1 );
211 new TestCase(
212 SECTION,
213 "DoWhile_5: " +description +" - code after loop but inside label should be executed",
214 "pass",
215 result2 );
216 }