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: 04 November 2003
9 * SUMMARY: Testing regexps with various disjunction + character class patterns
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=224676
12 *
13 */
14 //-----------------------------------------------------------------------------
15 var i = 0;
16 var BUGNUMBER = 224676;
17 var summary = 'Regexps with various disjunction + character class patterns';
18 var status = '';
19 var statusmessages = new Array();
20 var pattern = '';
21 var patterns = new Array();
22 var string = '';
23 var strings = new Array();
24 var actualmatch = '';
25 var actualmatches = new Array();
26 var expectedmatch = '';
27 var expectedmatches = new Array();
30 string = 'ZZZxZZZ';
31 status = inSection(1);
32 pattern = /[x]|x/;
33 actualmatch = string.match(pattern);
34 expectedmatch = Array('x');
35 addThis();
37 status = inSection(2);
38 pattern = /x|[x]/;
39 actualmatch = string.match(pattern);
40 expectedmatch = Array('x');
41 addThis();
44 string = 'ZZZxbZZZ';
45 status = inSection(3);
46 pattern = /a|[x]b/;
47 actualmatch = string.match(pattern);
48 expectedmatch = Array('xb');
49 addThis();
51 status = inSection(4);
52 pattern = /[x]b|a/;
53 actualmatch = string.match(pattern);
54 expectedmatch = Array('xb');
55 addThis();
57 status = inSection(5);
58 pattern = /([x]b|a)/;
59 actualmatch = string.match(pattern);
60 expectedmatch = Array('xb', 'xb');
61 addThis();
63 status = inSection(6);
64 pattern = /([x]b|a)|a/;
65 actualmatch = string.match(pattern);
66 expectedmatch = Array('xb', 'xb');
67 addThis();
69 status = inSection(7);
70 pattern = /^[x]b|a/;
71 actualmatch = string.match(pattern);
72 expectedmatch = null;
73 addThis();
76 string = 'xb';
77 status = inSection(8);
78 pattern = /^[x]b|a/;
79 actualmatch = string.match(pattern);
80 expectedmatch = Array('xb');
81 addThis();
84 string = 'ZZZxbZZZ';
85 status = inSection(9);
86 pattern = /([x]b)|a/;
87 actualmatch = string.match(pattern);
88 expectedmatch = Array('xb', 'xb');
89 addThis();
91 status = inSection(10);
92 pattern = /()[x]b|a/;
93 actualmatch = string.match(pattern);
94 expectedmatch = Array('xb', '');
95 addThis();
97 status = inSection(11);
98 pattern = /x[b]|a/;
99 actualmatch = string.match(pattern);
100 expectedmatch = Array('xb');
101 addThis();
103 status = inSection(12);
104 pattern = /[x]{1}b|a/;
105 actualmatch = string.match(pattern);
106 expectedmatch = Array('xb');
107 addThis();
109 status = inSection(13);
110 pattern = /[x]b|a|a/;
111 actualmatch = string.match(pattern);
112 expectedmatch = Array('xb');
113 addThis();
115 status = inSection(14);
116 pattern = /[x]b|[a]/;
117 actualmatch = string.match(pattern);
118 expectedmatch = Array('xb');
119 addThis();
121 status = inSection(15);
122 pattern = /[x]b|a+/;
123 actualmatch = string.match(pattern);
124 expectedmatch = Array('xb');
125 addThis();
127 status = inSection(16);
128 pattern = /[x]b|a{1}/;
129 actualmatch = string.match(pattern);
130 expectedmatch = Array('xb');
131 addThis();
133 status = inSection(17);
134 pattern = /[x]b|(a)/;
135 actualmatch = string.match(pattern);
136 expectedmatch = Array('xb', undefined);
137 addThis();
139 status = inSection(18);
140 pattern = /[x]b|()a/;
141 actualmatch = string.match(pattern);
142 expectedmatch = Array('xb', undefined);
143 addThis();
145 status = inSection(19);
146 pattern = /[x]b|^a/;
147 actualmatch = string.match(pattern);
148 expectedmatch = Array('xb');
149 addThis();
151 status = inSection(20);
152 pattern = /a|[^b]b/;
153 actualmatch = string.match(pattern);
154 expectedmatch = Array('xb');
155 addThis();
157 status = inSection(21);
158 pattern = /a|[^b]{1}b/;
159 actualmatch = string.match(pattern);
160 expectedmatch = Array('xb');
161 addThis();
164 string = 'hallo\";';
165 status = inSection(22);
166 pattern = /^((\\[^\x00-\x1f]|[^\x00-\x1f"\\])*)"/;
167 actualmatch = string.match(pattern);
168 expectedmatch = Array('hallo"', 'hallo', 'o');
169 addThis();
171 //----------------------------------------------------------------------------
172 test();
173 //----------------------------------------------------------------------------
175 function addThis()
176 {
177 statusmessages[i] = status;
178 patterns[i] = pattern;
179 strings[i] = string;
180 actualmatches[i] = actualmatch;
181 expectedmatches[i] = expectedmatch;
182 i++;
183 }
185 function test()
186 {
187 enterFunc ('test');
188 printBugNumber(BUGNUMBER);
189 printStatus (summary);
190 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
191 exitFunc ('test');
192 }