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: 12 October 2001
8 *
9 * SUMMARY: Regression test for string.replace bug 104375
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=104375
11 */
12 //-----------------------------------------------------------------------------
13 var UBound = 0;
14 var BUGNUMBER = 104375;
15 var summary = 'Testing string.replace() with backreferences';
16 var status = '';
17 var statusitems = [];
18 var actual = '';
19 var actualvalues = [];
20 var expect= '';
21 var expectedvalues = [];
24 /*
25 * Use the regexp to replace 'uid=31' with 'uid=15'
26 *
27 * In the second parameter of string.replace() method,
28 * "$1" refers to the first backreference: 'uid='
29 */
30 var str = 'uid=31';
31 var re = /(uid=)(\d+)/;
33 // try the numeric literal 15
34 status = inSection(1);
35 actual = str.replace (re, "$1" + 15);
36 expect = 'uid=15';
37 addThis();
39 // try the string literal '15'
40 status = inSection(2);
41 actual = str.replace (re, "$1" + '15');
42 expect = 'uid=15';
43 addThis();
45 // try a letter before the '15'
46 status = inSection(3);
47 actual = str.replace (re, "$1" + 'A15');
48 expect = 'uid=A15';
49 addThis();
53 //-----------------------------------------------------------------------------
54 test();
55 //-----------------------------------------------------------------------------
59 function addThis()
60 {
61 statusitems[UBound] = status;
62 actualvalues[UBound] = actual;
63 expectedvalues[UBound] = expect;
64 UBound++;
65 }
68 function test()
69 {
70 enterFunc ('test');
71 printBugNumber(BUGNUMBER);
72 printStatus (summary);
74 for (var i=0; i<UBound; i++)
75 {
76 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
77 }
79 exitFunc ('test');
80 }