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.7.js
8 ECMA Section: 15.9.5.7 Date.prototype.toLocaleTimeString()
9 Description:
10 This function returns a string value. The contents of the string are
11 implementation dependent, but are intended to represent the "time"
12 portion of the Date in the current time zone in a convenient,
13 human-readable form. We test the content of the string by checking
14 that
16 new Date(d.toDateString() + " " + d.toLocaleTimeString()) == d
18 Author: pschwartau@netscape.com
19 Date: 14 november 2000
20 Revised: 07 january 2002 because of a change in JS Date format:
21 Revised: 21 November 2005 since the string comparison stuff is horked.
22 bclary
24 See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey)
25 See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino)
26 */
27 //-----------------------------------------------------------------------------
28 var SECTION = "15.9.5.7";
29 var VERSION = "ECMA_3";
30 var TITLE = "Date.prototype.toLocaleTimeString()";
32 var status = '';
33 var actual = '';
34 var expect = '';
35 var givenDate;
36 var year = '';
37 var regexp = '';
38 var TimeString = '';
39 var reducedDateString = '';
40 var hopeThisIsLocaleTimeString = '';
41 var cnERR ='OOPS! FATAL ERROR: no regexp match in extractLocaleTimeString()';
43 startTest();
44 writeHeaderToLog( SECTION + " "+ TITLE);
46 // first, a couple generic tests -
48 status = "typeof (now.toLocaleTimeString())";
49 actual = typeof (now.toLocaleTimeString());
50 expect = "string";
51 addTestCase();
53 status = "Date.prototype.toLocaleTimeString.length";
54 actual = Date.prototype.toLocaleTimeString.length;
55 expect = 0;
56 addTestCase();
58 // 1970
59 addDateTestCase(0);
60 addDateTestCase(TZ_ADJUST);
62 // 1900
63 addDateTestCase(TIME_1900);
64 addDateTestCase(TIME_1900 - TZ_ADJUST);
66 // 2000
67 addDateTestCase(TIME_2000);
68 addDateTestCase(TIME_2000 - TZ_ADJUST);
70 // 29 Feb 2000
71 addDateTestCase(UTC_29_FEB_2000);
72 addDateTestCase(UTC_29_FEB_2000 - 1000);
73 addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
75 // Now
76 addDateTestCase( TIME_NOW);
77 addDateTestCase( TIME_NOW - TZ_ADJUST);
79 // 2005
80 addDateTestCase(UTC_1_JAN_2005);
81 addDateTestCase(UTC_1_JAN_2005 - 1000);
82 addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
84 test();
86 function addTestCase()
87 {
88 new TestCase(
89 SECTION,
90 status,
91 expect,
92 actual);
93 }
96 function addDateTestCase(date_given_in_milliseconds)
97 {
98 var s = 'new Date(' + date_given_in_milliseconds + ')';
99 givenDate = new Date(date_given_in_milliseconds);
101 status = 'd = ' + s +
102 '; d == new Date(d.toDateString() + " " + d.toLocaleTimeString())';
103 expect = givenDate.toString();
104 actual = new Date(givenDate.toDateString() +
105 ' ' + givenDate.toLocaleTimeString()).toString();
106 addTestCase();
107 }