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 November 2002
9 * SUMMARY: arr.sort() should not output |undefined| when |arr| is empty
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=178722
11 *
12 * ECMA-262 Ed.3: 15.4.4.11 Array.prototype.sort (comparefn)
13 *
14 * 1. Call the [[Get]] method of this object with argument "length".
15 * 2. Call ToUint32(Result(1)).
16 * 3. Perform an implementation-dependent sequence of calls to the [[Get]],
17 * [[Put]], and [[Delete]] methods of this object, etc. etc.
18 * 4. Return this object.
19 *
20 *
21 * Note that sort() is done in-place on |arr|. In other words, sort() is a
22 * "destructive" method rather than a "functional" method. The return value
23 * of |arr.sort()| and |arr| are the same object.
24 *
25 * If |arr| is an empty array, the return value of |arr.sort()| should be
26 * an empty array, not the value |undefined| as was occurring in bug 178722.
27 *
28 */
29 //-----------------------------------------------------------------------------
30 var UBound = 0;
31 var BUGNUMBER = 178722;
32 var summary = 'arr.sort() should not output |undefined| when |arr| is empty';
33 var status = '';
34 var statusitems = [];
35 var actual = '';
36 var actualvalues = [];
37 var expect= '';
38 var expectedvalues = [];
39 var arr;
42 // create empty array or pseudo-array objects in various ways
43 var arr1 = Array();
44 var arr2 = new Array();
45 var arr3 = [];
46 var arr4 = [1];
47 arr4.pop();
50 status = inSection(1);
51 arr = arr1.sort();
52 actual = arr instanceof Array && arr.length === 0 && arr === arr1;
53 expect = true;
54 addThis();
56 status = inSection(2);
57 arr = arr2.sort();
58 actual = arr instanceof Array && arr.length === 0 && arr === arr2;
59 expect = true;
60 addThis();
62 status = inSection(3);
63 arr = arr3.sort();
64 actual = arr instanceof Array && arr.length === 0 && arr === arr3;
65 expect = true;
66 addThis();
68 status = inSection(4);
69 arr = arr4.sort();
70 actual = arr instanceof Array && arr.length === 0 && arr === arr4;
71 expect = true;
72 addThis();
74 // now do the same thing, with non-default sorting:
75 function g() {return 1;}
77 status = inSection('1a');
78 arr = arr1.sort(g);
79 actual = arr instanceof Array && arr.length === 0 && arr === arr1;
80 expect = true;
81 addThis();
83 status = inSection('2a');
84 arr = arr2.sort(g);
85 actual = arr instanceof Array && arr.length === 0 && arr === arr2;
86 expect = true;
87 addThis();
89 status = inSection('3a');
90 arr = arr3.sort(g);
91 actual = arr instanceof Array && arr.length === 0 && arr === arr3;
92 expect = true;
93 addThis();
95 status = inSection('4a');
96 arr = arr4.sort(g);
97 actual = arr instanceof Array && arr.length === 0 && arr === arr4;
98 expect = true;
99 addThis();
103 //-----------------------------------------------------------------------------
104 test();
105 //-----------------------------------------------------------------------------
109 function addThis()
110 {
111 statusitems[UBound] = status;
112 actualvalues[UBound] = actual;
113 expectedvalues[UBound] = expect;
114 UBound++;
115 }
118 function test()
119 {
120 enterFunc('test');
121 printBugNumber(BUGNUMBER);
122 printStatus(summary);
124 for (var i=0; i<UBound; i++)
125 {
126 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
127 }
129 exitFunc ('test');
130 }