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: 03 December 2000
8 *
9 *
10 * SUMMARY: This test arose from Bugzilla bug 57043:
11 * "Negative integers as object properties: strange behavior!"
12 *
13 * We check that object properties may be indexed by signed
14 * numeric literals, as in assignments like obj[-1] = 'Hello'
15 *
16 * NOTE: it should not matter whether we provide the literal with
17 * quotes around it or not; e.g. these should be equivalent:
18 *
19 * obj[-1] = 'Hello'
20 * obj['-1'] = 'Hello'
21 */
22 //-----------------------------------------------------------------------------
23 var BUGNUMBER = 57043;
24 var summary = 'Indexing object properties by signed numerical literals -'
25 var statprefix = 'Adding a property to test object with an index of ';
26 var statsuffix = ', testing it now -';
27 var propprefix = 'This is property ';
28 var obj = new Object();
29 var status = ''; var actual = ''; var expect = ''; var value = '';
32 // various indices to try -
33 var index =
34 [-1073741825, -1073741824, -1073741823, -5000, -507, -3, -2, -1, -0, 0, 1, 2, 3, 1073741823, 1073741824, 1073741825];
37 //-------------------------------------------------------------------------------------------------
38 test();
39 //-------------------------------------------------------------------------------------------------
42 function test()
43 {
44 enterFunc ('test');
45 printBugNumber(BUGNUMBER);
46 printStatus (summary);
48 for (var j in index) {testProperty(index[j]);}
50 exitFunc ('test');
51 }
54 function testProperty(i)
55 {
56 status = getStatus(i);
58 // try to assign a property using the given index -
59 obj[i] = value = (propprefix + i);
61 // try to read the property back via the index (as number) -
62 expect = value;
63 actual = obj[i];
64 reportCompare(expect, actual, status);
66 // try to read the property back via the index as string -
67 expect = value;
68 actual = obj[String(i)];
69 reportCompare(expect, actual, status);
70 }
72 function positive(n) { return 1 / n > 0; }
74 function getStatus(i)
75 {
76 return statprefix +
77 (positive(i) ? i : "-" + -i) +
78 statsuffix;
79 }