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 var UBound = 0;
8 var BUGNUMBER = 188206;
9 var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors';
10 var CHECK_PASSED = 'Should not generate an error';
11 var CHECK_FAILED = 'Generated an error!';
12 var status = '';
13 var statusitems = [];
14 var actual = '';
15 var actualvalues = [];
16 var expect= '';
17 var expectedvalues = [];
20 /*
21 * Misusing the {DecmalDigits} quantifier - according to ECMA,
22 * but not according to Perl.
23 *
24 * ECMA-262 Edition 3 prohibits the use of unescaped braces in
25 * regexp patterns, unless they form part of a quantifier.
26 *
27 * Hovever, Perl does not prohibit this. If not used as part
28 * of a quantifer, Perl treats braces literally.
29 *
30 * We decided to follow Perl on this for backward compatibility.
31 * See http://bugzilla.mozilla.org/show_bug.cgi?id=190685.
32 *
33 * Therefore NONE of the following ECMA violations should generate
34 * a SyntaxError. Note we use checkThis() instead of testThis().
35 */
36 status = inSection(13);
37 checkThis(' /a*{/ ');
39 status = inSection(14);
40 checkThis(' /a{}/ ');
42 status = inSection(15);
43 checkThis(' /{a/ ');
45 status = inSection(16);
46 checkThis(' /}a/ ');
48 status = inSection(17);
49 checkThis(' /x{abc}/ ');
51 status = inSection(18);
52 checkThis(' /{{0}/ ');
54 status = inSection(19);
55 checkThis(' /{{1}/ ');
57 status = inSection(20);
58 checkThis(' /x{{0}/ ');
60 status = inSection(21);
61 checkThis(' /x{{1}/ ');
63 status = inSection(22);
64 checkThis(' /x{{0}}/ ');
66 status = inSection(23);
67 checkThis(' /x{{1}}/ ');
69 status = inSection(24);
70 checkThis(' /x{{0}}/ ');
72 status = inSection(25);
73 checkThis(' /x{{1}}/ ');
75 status = inSection(26);
76 checkThis(' /x{{0}}/ ');
78 status = inSection(27);
79 checkThis(' /x{{1}}/ ');
82 //-----------------------------------------------------------------------------
83 test();
84 //-----------------------------------------------------------------------------
88 /*
89 * Allowed syntax shouldn't generate any errors
90 */
91 function checkThis(sAllowedSyntax)
92 {
93 expect = CHECK_PASSED;
94 actual = CHECK_PASSED;
96 try
97 {
98 eval(sAllowedSyntax);
99 }
100 catch(e)
101 {
102 actual = CHECK_FAILED;
103 }
105 statusitems[UBound] = status;
106 expectedvalues[UBound] = expect;
107 actualvalues[UBound] = actual;
108 UBound++;
109 }
112 function test()
113 {
114 enterFunc('test');
115 printBugNumber(BUGNUMBER);
116 printStatus(summary);
118 for (var i=0; i<UBound; i++)
119 {
120 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
121 }
123 exitFunc ('test');
124 }