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/. */
7 /**
8 Filename: whitespace.js
9 Description: 'Tests regular expressions containing \f\n\r\t\v\s\S\ '
11 Author: Nick Lerissa
12 Date: March 10, 1998
13 */
15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
16 var VERSION = 'no version';
17 startTest();
18 var TITLE = 'RegExp: \\f\\n\\r\\t\\v\\s\\S ';
20 writeHeaderToLog('Executing script: whitespace.js');
21 writeHeaderToLog( SECTION + " "+ TITLE);
24 var non_whitespace = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~`!@#$%^&*()-+={[}]|\\:;'<,>./?1234567890" + '"';
25 var whitespace = "\f\n\r\t\v ";
27 // be sure all whitespace is matched by \s
28 new TestCase ( SECTION,
29 "'" + whitespace + "'.match(new RegExp('\\s+'))",
30 String([whitespace]), String(whitespace.match(new RegExp('\\s+'))));
32 // be sure all non-whitespace is matched by \S
33 new TestCase ( SECTION,
34 "'" + non_whitespace + "'.match(new RegExp('\\S+'))",
35 String([non_whitespace]), String(non_whitespace.match(new RegExp('\\S+'))));
37 // be sure all non-whitespace is not matched by \s
38 new TestCase ( SECTION,
39 "'" + non_whitespace + "'.match(new RegExp('\\s'))",
40 null, non_whitespace.match(new RegExp('\\s')));
42 // be sure all whitespace is not matched by \S
43 new TestCase ( SECTION,
44 "'" + whitespace + "'.match(new RegExp('\\S'))",
45 null, whitespace.match(new RegExp('\\S')));
47 var s = non_whitespace + whitespace;
49 // be sure all digits are matched by \s
50 new TestCase ( SECTION,
51 "'" + s + "'.match(new RegExp('\\s+'))",
52 String([whitespace]), String(s.match(new RegExp('\\s+'))));
54 s = whitespace + non_whitespace;
56 // be sure all non-whitespace are matched by \S
57 new TestCase ( SECTION,
58 "'" + s + "'.match(new RegExp('\\S+'))",
59 String([non_whitespace]), String(s.match(new RegExp('\\S+'))));
61 // '1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))
62 new TestCase ( SECTION, "'1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))",
63 String(["find me"]), String('1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))));
65 var i;
67 // be sure all whitespace characters match individually
68 for (i = 0; i < whitespace.length; ++i)
69 {
70 s = 'ab' + whitespace[i] + 'cd';
71 new TestCase ( SECTION,
72 "'" + s + "'.match(new RegExp('\\\\s'))",
73 String([whitespace[i]]), String(s.match(new RegExp('\\s'))));
74 new TestCase ( SECTION,
75 "'" + s + "'.match(/\s/)",
76 String([whitespace[i]]), String(s.match(/\s/)));
77 }
78 // be sure all non_whitespace characters match individually
79 for (i = 0; i < non_whitespace.length; ++i)
80 {
81 s = ' ' + non_whitespace[i] + ' ';
82 new TestCase ( SECTION,
83 "'" + s + "'.match(new RegExp('\\\\S'))",
84 String([non_whitespace[i]]), String(s.match(new RegExp('\\S'))));
85 new TestCase ( SECTION,
86 "'" + s + "'.match(/\S/)",
87 String([non_whitespace[i]]), String(s.match(/\S/)));
88 }
91 test();