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/. */
7 /**
8 File Name: 15.9.3.1.js
9 ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
10 Description: The [[Prototype]] property of the newly constructed
11 object is set to the original Date prototype object,
12 the one that is the initial value of Date.prototype.
14 The [[Class]] property of the newly constructed object
15 is set as follows:
16 1. Call ToNumber(year)
17 2. Call ToNumber(month)
18 3. Call ToNumber(date)
19 4. Call ToNumber(hours)
20 5. Call ToNumber(minutes)
21 6. Call ToNumber(seconds)
22 7. Call ToNumber(ms)
23 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
24 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
25 Result(8) is Result(1)
26 9. Compute MakeDay(Result(8), Result(2), Result(3)
27 10. Compute MakeTime(Result(4), Result(5), Result(6),
28 Result(7)
29 11. Compute MakeDate(Result(9), Result(10))
30 12. Set the [[Value]] property of the newly constructed
31 object to TimeClip(UTC(Result(11))).
34 This tests the returned value of a newly constructed
35 Date object.
37 Author: christine@netscape.com
38 Date: 7 july 1997
39 */
41 var TIME = 0;
42 var UTC_YEAR = 1;
43 var UTC_MONTH = 2;
44 var UTC_DATE = 3;
45 var UTC_DAY = 4;
46 var UTC_HOURS = 5;
47 var UTC_MINUTES = 6;
48 var UTC_SECONDS = 7;
49 var UTC_MS = 8;
51 var YEAR = 9;
52 var MONTH = 10;
53 var DATE = 11;
54 var DAY = 12;
55 var HOURS = 13;
56 var MINUTES = 14;
57 var SECONDS = 15;
58 var MS = 16;
60 // for TCMS, the gTestcases array must be global.
61 var SECTION = "15.9.3.1";
62 var TITLE = "Date( year, month, date, hours, minutes, seconds )";
64 writeHeaderToLog( SECTION+" " +TITLE );
66 var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
68 // Dates around Feb 29, 2000
69 addNewTestCase( new Date(2000,1,28,16,0,0,0),
70 "new Date(2000,1,28,16,0,0,0)",
71 [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
73 addNewTestCase( new Date(2000,1,29,0,0,0,0),
74 "new Date(2000,1,29,0,0,0,0)",
75 [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
77 addNewTestCase( new Date(2000,1,29,24,0,0,0),
78 "new Date(2000,1,29,24,0,0,0)",
79 [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
81 test();
83 function addNewTestCase( DateCase, DateString, ResultArray ) {
84 //adjust hard-coded ResultArray for tester's timezone instead of PST
85 adjustResultArray(ResultArray);
87 new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
88 new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
90 new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
91 new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
92 new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
93 new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
94 new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
95 new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
96 new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
97 new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
99 new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
100 new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
101 new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
102 new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
103 new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
104 new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
105 new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
106 new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
108 }