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 File Name: 15.9.5.3.js
8 ECMA Section: 15.9.5.3 Date.prototype.toDateString()
9 Description:
10 This function returns a string value. The contents of the string are
11 implementation dependent, but are intended to represent the "date"
12 portion of the Date in the current time zone in a convenient,
13 human-readable form. We can't test the content of the string,
14 but can verify that the string is parsable by Date.parse
16 The toDateString function is not generic; it generates a runtime error
17 if its 'this' value is not a Date object. Therefore it cannot be transferred
18 to other kinds of objects for use as a method.
20 Author: pschwartau@netscape.com
21 Date: 14 november 2000 (adapted from ecma/Date/15.9.5.2.js)
22 */
24 var SECTION = "15.9.5.3";
25 var VERSION = "ECMA_3";
26 var TITLE = "Date.prototype.toDateString()";
28 var status = '';
29 var actual = '';
30 var expect = '';
33 startTest();
34 writeHeaderToLog( SECTION + " "+ TITLE);
36 // first, some generic tests -
38 status = "typeof (now.toDateString())";
39 actual = typeof (now.toDateString());
40 expect = "string";
41 addTestCase();
43 status = "Date.prototype.toDateString.length";
44 actual = Date.prototype.toDateString.length;
45 expect = 0;
46 addTestCase();
48 /*
49 * Date.parse is accurate to the second; valueOf() to the millisecond.
50 * Here we expect them to coincide, as we expect a time of exactly
51 * midnight -
52 */
53 status = "(Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0";
54 actual = (Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0;
55 expect = true;
56 addTestCase();
60 // 1970
61 addDateTestCase(0);
62 addDateTestCase(TZ_ADJUST);
65 // 1900
66 addDateTestCase(TIME_1900);
67 addDateTestCase(TIME_1900 - TZ_ADJUST);
70 // 2000
71 addDateTestCase(TIME_2000);
72 addDateTestCase(TIME_2000 - TZ_ADJUST);
75 // 29 Feb 2000
76 addDateTestCase(UTC_29_FEB_2000);
77 addDateTestCase(UTC_29_FEB_2000 - 1000);
78 addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
81 // 2005
82 addDateTestCase(UTC_1_JAN_2005);
83 addDateTestCase(UTC_1_JAN_2005 - 1000);
84 addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
88 //-----------------------------------------------------------------------------
89 test();
90 //-----------------------------------------------------------------------------
93 function addTestCase()
94 {
95 new TestCase(
96 SECTION,
97 status,
98 expect,
99 actual);
100 }
102 function addDateTestCase(date_given_in_milliseconds)
103 {
104 var givenDate = new Date(date_given_in_milliseconds);
106 status = 'Date.parse(' + givenDate + ').toDateString())';
107 actual = Date.parse(givenDate.toDateString());
108 expect = Date.parse(midnight(givenDate));
109 addTestCase();
110 }
113 function midnight(givenDate)
114 {
115 // midnight on the given date -
116 return new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.getDate());
117 }