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/. */
6 /*
7 *
8 * Date: 10 October 2001
9 * SUMMARY: Regression test for Bugzilla bug 104077
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=104077
11 * "JS crash: with/finally/return"
12 *
13 * Also http://bugzilla.mozilla.org/show_bug.cgi?id=120571
14 * "JS crash: try/catch/continue."
15 *
16 * SpiderMonkey crashed on this code - it shouldn't.
17 *
18 * NOTE: the finally-blocks below should execute even if their try-blocks
19 * have return or throw statements in them:
20 *
21 * ------- Additional Comment #76 From Mike Shaver 2001-12-07 01:21 -------
22 * finally trumps return, and all other control-flow constructs that cause
23 * program execution to jump out of the try block: throw, break, etc. Once you
24 * enter a try block, you will execute the finally block after leaving the try,
25 * regardless of what happens to make you leave the try.
26 *
27 */
28 //-----------------------------------------------------------------------------
29 var UBound = 0;
30 var BUGNUMBER = 104077;
31 var summary = "Just testing that we don't crash on with/finally/return -";
32 var status = '';
33 var statusitems = [];
34 var actual = '';
35 var actualvalues = [];
36 var expect= '';
37 var expectedvalues = [];
40 function addValues_3(obj)
41 {
42 var sum = 0;
44 with (obj)
45 {
46 try
47 {
48 sum = arg1 + arg2;
49 with (arg3)
50 {
51 while (sum < 10)
52 {
53 try
54 {
55 if (sum > 5)
56 return sum;
57 sum += 1;
58 }
59 catch (e)
60 {
61 sum += 1;
62 }
63 }
64 }
65 }
66 finally
67 {
68 try
69 {
70 sum +=1;
71 print("In finally block of addValues_3() function: sum = " + sum);
72 }
73 catch (e if e == 42)
74 {
75 sum +=1;
76 print('In finally catch block of addValues_3() function: sum = ' + sum + ', e = ' + e);
77 }
78 finally
79 {
80 sum +=1;
81 print("In finally finally block of addValues_3() function: sum = " + sum);
82 return sum;
83 }
84 }
85 }
86 }
88 status = inSection(9);
89 obj = new Object();
90 obj.arg1 = 1;
91 obj.arg2 = 2;
92 obj.arg3 = new Object();
93 obj.arg3.a = 10;
94 obj.arg3.b = 20;
95 actual = addValues_3(obj);
96 expect = 8;
97 captureThis();
102 function addValues_4(obj)
103 {
104 var sum = 0;
106 with (obj)
107 {
108 try
109 {
110 sum = arg1 + arg2;
111 with (arg3)
112 {
113 while (sum < 10)
114 {
115 try
116 {
117 if (sum > 5)
118 return sum;
119 sum += 1;
120 }
121 catch (e)
122 {
123 sum += 1;
124 }
125 }
126 }
127 }
128 finally
129 {
130 try
131 {
132 sum += 1;
133 print("In finally block of addValues_4() function: sum = " + sum);
134 }
135 catch (e if e == 42)
136 {
137 sum += 1;
138 print("In 1st finally catch block of addValues_4() function: sum = " + sum + ", e = " + e);
139 }
140 catch (e if e == 43)
141 {
142 sum += 1;
143 print("In 2nd finally catch block of addValues_4() function: sum = " + sum + ", e = " + e);
144 }
145 finally
146 {
147 sum += 1;
148 print("In finally finally block of addValues_4() function: sum = " + sum);
149 return sum;
150 }
151 }
152 }
153 }
155 status = inSection(10);
156 obj = new Object();
157 obj.arg1 = 1;
158 obj.arg2 = 2;
159 obj.arg3 = new Object();
160 obj.arg3.a = 10;
161 obj.arg3.b = 20;
162 actual = addValues_4(obj);
163 expect = 8;
164 captureThis();
169 //-----------------------------------------------------------------------------
170 test();
171 //-----------------------------------------------------------------------------
175 function captureThis()
176 {
177 statusitems[UBound] = status;
178 actualvalues[UBound] = actual;
179 expectedvalues[UBound] = expect;
180 UBound++;
181 }
184 function test()
185 {
186 enterFunc ('test');
187 printBugNumber(BUGNUMBER);
188 printStatus (summary);
190 for (var i=0; i<UBound; i++)
191 {
192 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
193 }
195 exitFunc ('test');
196 }