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 function f () {return arguments};
44 var arr5 = f();
45 arr5.__proto__ = Array.prototype;
48 status = inSection(5);
49 arr = arr5.sort();
50 actual = arr instanceof Array && arr.length === 0 && arr === arr5;
51 expect = true;
52 addThis();
55 // now do the same thing, with non-default sorting:
56 function g() {return 1;}
58 status = inSection('5a');
59 arr = arr5.sort(g);
60 actual = arr instanceof Array && arr.length === 0 && arr === arr5;
61 expect = true;
62 addThis();
66 //-----------------------------------------------------------------------------
67 test();
68 //-----------------------------------------------------------------------------
72 function addThis()
73 {
74 statusitems[UBound] = status;
75 actualvalues[UBound] = actual;
76 expectedvalues[UBound] = expect;
77 UBound++;
78 }
81 function test()
82 {
83 enterFunc('test');
84 printBugNumber(BUGNUMBER);
85 printStatus(summary);
87 for (var i=0; i<UBound; i++)
88 {
89 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
90 }
92 exitFunc ('test');
93 }