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: 2001-08-27
8 *
9 * SUMMARY: Testing binding of function names
10 *
11 * Brendan:
12 *
13 * "... the question is, does Rhino bind 'sum' in the global object
14 * for the following test? If it does, it's buggy.
15 *
16 * var f = function sum(){};
17 * print(sum); // should fail with 'sum is not defined' "
18 *
19 */
21 //-----------------------------------------------------------------------------
22 var UBound = 0;
23 var BUGNUMBER = '(none)';
24 var summary = 'Testing binding of function names';
25 var ERR_REF_YES = 'ReferenceError';
26 var ERR_REF_NO = 'did NOT generate a ReferenceError';
27 var statusitems = [];
28 var actualvalues = [];
29 var expectedvalues = [];
30 var status = summary;
31 var actual = ERR_REF_NO;
32 var expect= ERR_REF_YES;
35 try
36 {
37 var f = function sum(){};
38 print(sum);
39 }
40 catch (e)
41 {
42 status = 'Section 1 of test';
43 actual = e instanceof ReferenceError;
44 expect = true;
45 addThis();
48 /*
49 * This test is more literal, and one day may not be valid.
50 * Searching for literal string "ReferenceError" in e.toString()
51 */
52 status = 'Section 2 of test';
53 var match = e.toString().search(/ReferenceError/);
54 actual = (match > -1);
55 expect = true;
56 addThis();
57 }
61 //-----------------------------------------------------------------------------
62 test();
63 //-----------------------------------------------------------------------------
66 function addThis()
67 {
68 statusitems[UBound] = status;
69 actualvalues[UBound] = isReferenceError(actual);
70 expectedvalues[UBound] = isReferenceError(expect);
71 UBound++;
72 }
75 function test()
76 {
77 enterFunc ('test');
78 printBugNumber(BUGNUMBER);
79 printStatus (summary);
81 for (var i = 0; i < UBound; i++)
82 {
83 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
84 }
86 exitFunc ('test');
87 }
90 // converts a Boolean result into a textual result -
91 function isReferenceError(bResult)
92 {
93 return bResult? ERR_REF_YES : ERR_REF_NO;
94 }