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 November 2003
9 * SUMMARY: Testing regexps with complementary alternatives
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=225289
12 *
13 */
14 //-----------------------------------------------------------------------------
15 var i = 0;
16 var BUGNUMBER = 225289;
17 var summary = 'Testing regexps with complementary alternatives';
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 // this pattern should match any string!
31 pattern = /a|[^a]/;
33 status = inSection(1);
34 string = 'a';
35 actualmatch = string.match(pattern);
36 expectedmatch = Array('a');
37 addThis();
39 status = inSection(2);
40 string = '';
41 actualmatch = string.match(pattern);
42 expectedmatch = null;
43 addThis();
45 status = inSection(3);
46 string = '()';
47 actualmatch = string.match(pattern);
48 expectedmatch = Array('(');
49 addThis();
52 pattern = /(a|[^a])/;
54 status = inSection(4);
55 string = 'a';
56 actualmatch = string.match(pattern);
57 expectedmatch = Array('a', 'a');
58 addThis();
60 status = inSection(5);
61 string = '';
62 actualmatch = string.match(pattern);
63 expectedmatch = null;
64 addThis();
66 status = inSection(6);
67 string = '()';
68 actualmatch = string.match(pattern);
69 expectedmatch = Array('(', '(');
70 addThis();
73 pattern = /(a)|([^a])/;
75 status = inSection(7);
76 string = 'a';
77 actualmatch = string.match(pattern);
78 expectedmatch = Array('a', 'a', undefined);
79 addThis();
81 status = inSection(8);
82 string = '';
83 actualmatch = string.match(pattern);
84 expectedmatch = null;
85 addThis();
87 status = inSection(9);
88 string = '()';
89 actualmatch = string.match(pattern);
90 expectedmatch = Array('(', undefined, '(');
91 addThis();
94 // note this pattern has one non-capturing parens
95 pattern = /((?:a|[^a])*)/g;
97 status = inSection(10);
98 string = 'a';
99 actualmatch = string.match(pattern);
100 expectedmatch = Array('a', ''); // see bug 225289 comment 6
101 addThis();
103 status = inSection(11);
104 string = '';
105 actualmatch = string.match(pattern);
106 expectedmatch = Array(''); // see bug 225289 comment 9
107 addThis();
109 status = inSection(12);
110 string = '()';
111 actualmatch = string.match(pattern);
112 expectedmatch = Array('()', ''); // see bug 225289 comment 6
113 addThis();
118 //-------------------------------------------------------------------------------------------------
119 test();
120 //-------------------------------------------------------------------------------------------------
124 function addThis()
125 {
126 statusmessages[i] = status;
127 patterns[i] = pattern;
128 strings[i] = string;
129 actualmatches[i] = actualmatch;
130 expectedmatches[i] = expectedmatch;
131 i++;
132 }
135 function test()
136 {
137 enterFunc ('test');
138 printBugNumber(BUGNUMBER);
139 printStatus (summary);
140 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
141 exitFunc ('test');
142 }