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: 06 January 2003
9 * SUMMARY: RegExp conformance test
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=187133
11 *
12 * The tests here employ the regular expression construct:
13 *
14 * (?!pattern)
15 *
16 * This is a "zero-width lookahead negative assertion".
17 * From the Perl documentation:
18 *
19 * For example, /foo(?!bar)/ matches any occurrence
20 * of 'foo' that isn't followed by 'bar'.
21 *
22 * It is "zero-width" means that it does not consume any characters and that
23 * the parens are non-capturing. A non-null match array in the example above
24 * will have only have length 1, not 2.
25 *
26 */
27 //-----------------------------------------------------------------------------
28 var i = 0;
29 var BUGNUMBER = 187133;
30 var summary = 'RegExp conformance test';
31 var status = '';
32 var statusmessages = new Array();
33 var pattern = '';
34 var patterns = new Array();
35 var string = '';
36 var strings = new Array();
37 var actualmatch = '';
38 var actualmatches = new Array();
39 var expectedmatch = '';
40 var expectedmatches = new Array();
43 pattern = /(\.(?!com|org)|\/)/;
44 status = inSection(1);
45 string = 'ah.info';
46 actualmatch = string.match(pattern);
47 expectedmatch = ['.', '.'];
48 addThis();
50 status = inSection(2);
51 string = 'ah/info';
52 actualmatch = string.match(pattern);
53 expectedmatch = ['/', '/'];
54 addThis();
56 status = inSection(3);
57 string = 'ah.com';
58 actualmatch = string.match(pattern);
59 expectedmatch = null;
60 addThis();
63 pattern = /(?!a|b)|c/;
64 status = inSection(4);
65 string = '';
66 actualmatch = string.match(pattern);
67 expectedmatch = [''];
68 addThis();
70 status = inSection(5);
71 string = 'bc';
72 actualmatch = string.match(pattern);
73 expectedmatch = [''];
74 addThis();
76 status = inSection(6);
77 string = 'd';
78 actualmatch = string.match(pattern);
79 expectedmatch = [''];
80 addThis();
85 //-------------------------------------------------------------------------------------------------
86 test();
87 //-------------------------------------------------------------------------------------------------
90 function addThis()
91 {
92 statusmessages[i] = status;
93 patterns[i] = pattern;
94 strings[i] = string;
95 actualmatches[i] = actualmatch;
96 expectedmatches[i] = expectedmatch;
97 i++;
98 }
101 function test()
102 {
103 enterFunc ('test');
104 printBugNumber(BUGNUMBER);
105 printStatus (summary);
106 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
107 exitFunc ('test');
108 }