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 * Date: 06 February 2001
8 *
9 * SUMMARY: Arose from Bugzilla bug 78156:
10 * "m flag of regular expression does not work with $"
11 *
12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=78156
13 *
14 * The m flag means a regular expression should search strings
15 * across multiple lines, i.e. across '\n', '\r'.
16 */
17 //-----------------------------------------------------------------------------
18 var i = 0;
19 var BUGNUMBER = 78156;
20 var summary = 'Testing regular expressions with ^, $, and the m flag -';
21 var status = '';
22 var statusmessages = new Array();
23 var pattern = '';
24 var patterns = new Array();
25 var string = '';
26 var strings = new Array();
27 var actualmatch = '';
28 var actualmatches = new Array();
29 var expectedmatch = '';
30 var expectedmatches = new Array();
32 /*
33 * All patterns have an m flag; all strings are multiline.
34 * Looking for digit characters at beginning/end of lines.
35 */
37 string = 'aaa\n789\r\nccc\r\n345';
38 status = inSection(1);
39 pattern = /^\d/gm;
40 actualmatch = string.match(pattern);
41 expectedmatch = ['7','3'];
42 addThis();
44 status = inSection(2);
45 pattern = /\d$/gm;
46 actualmatch = string.match(pattern);
47 expectedmatch = ['9','5'];
48 addThis();
50 string = 'aaa\n789\r\nccc\r\nddd';
51 status = inSection(3);
52 pattern = /^\d/gm;
53 actualmatch = string.match(pattern);
54 expectedmatch = ['7'];
55 addThis();
57 status = inSection(4);
58 pattern = /\d$/gm;
59 actualmatch = string.match(pattern);
60 expectedmatch = ['9'];
61 addThis();
65 //-------------------------------------------------------------------------------------------------
66 test();
67 //-------------------------------------------------------------------------------------------------
71 function addThis()
72 {
73 statusmessages[i] = status;
74 patterns[i] = pattern;
75 strings[i] = string;
76 actualmatches[i] = actualmatch;
77 expectedmatches[i] = expectedmatch;
78 i++;
79 }
82 function test()
83 {
84 enterFunc ('test');
85 printBugNumber(BUGNUMBER);
86 printStatus (summary);
87 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
88 exitFunc ('test');
89 }