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-07-15
8 *
9 * SUMMARY: Testing Number.prototype.toFixed(fractionDigits)
10 * See EMCA 262 Edition 3 Section 15.7.4.5
11 *
12 * Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551
13 *
14 */
15 //-----------------------------------------------------------------------------
16 var UBound = 0;
17 var BUGNUMBER = '(none)';
18 var summary = 'Testing Number.prototype.toFixed(fractionDigits)';
19 var cnIsRangeError = 'instanceof RangeError';
20 var cnNotRangeError = 'NOT instanceof RangeError';
21 var cnNoErrorCaught = 'NO ERROR CAUGHT...';
22 var status = '';
23 var statusitems = [];
24 var actual = '';
25 var actualvalues = [];
26 var expect= '';
27 var expectedvalues = [];
28 var testNum = 234.2040506;
31 status = 'Section A of test: no error intended!';
32 actual = testNum.toFixed(4);
33 expect = '234.2041';
34 captureThis();
37 /////////////////////////// OOPS.... ///////////////////////////////
38 /*************************************************************************
39 * 15.7.4.5 Number.prototype.toFixed(fractionDigits)
40 *
41 * An implementation is permitted to extend the behaviour of toFixed
42 * for values of fractionDigits less than 0 or greater than 20. In this
43 * case toFixed would not necessarily throw RangeError for such values.
45 status = 'Section B of test: expect RangeError because fractionDigits < 0';
46 actual = catchError('testNum.toFixed(-4)');
47 expect = cnIsRangeError;
48 captureThis();
50 status = 'Section C of test: expect RangeError because fractionDigits > 20 ';
51 actual = catchError('testNum.toFixed(21)');
52 expect = cnIsRangeError;
53 captureThis();
54 *************************************************************************/
57 status = 'Section D of test: no error intended!';
58 actual = 0.00001.toFixed(2);
59 expect = '0.00';
60 captureThis();
62 status = 'Section E of test: no error intended!';
63 actual = 0.000000000000000000001.toFixed(20);
64 expect = '0.00000000000000000000';
65 captureThis();
69 //-----------------------------------------------------------------------------
70 test();
71 //-----------------------------------------------------------------------------
74 function captureThis()
75 {
76 statusitems[UBound] = status;
77 actualvalues[UBound] = actual;
78 expectedvalues[UBound] = expect;
79 UBound++;
80 }
83 function test()
84 {
85 enterFunc ('test');
86 printBugNumber(BUGNUMBER);
87 printStatus (summary);
89 for (var i = 0; i < UBound; i++)
90 {
91 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
92 }
94 exitFunc ('test');
95 }
98 function catchError(sEval)
99 {
100 try {eval(sEval);}
101 catch(e) {return isRangeError(e);}
102 return cnNoErrorCaught;
103 }
106 function isRangeError(obj)
107 {
108 if (obj instanceof RangeError)
109 return cnIsRangeError;
110 return cnNotRangeError;
111 }