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.5.37-1.js
9 ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
10 Description:
12 If mon is not specified, this behaves as if mon were specified with the
13 value getUTCMonth( ). If date is not specified, this behaves as if date
14 were specified with the value getUTCDate( ).
16 1. Let t be this time value; but if this time value is NaN, let t be +0.
17 2. Call ToNumber(year).
18 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
19 ToNumber(mon).
20 4. If date is not specified, compute DateFromTime(t); otherwise, call
21 ToNumber(date).
22 5. Compute MakeDay(Result(2), Result(3), Result(4)).
23 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
24 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
25 8. Return the value of the [[Value]] property of the this value.
27 Author: christine@netscape.com
28 Date: 12 november 1997
30 Added some Year 2000 test cases.
31 */
32 var SECTION = "15.9.5.37-1";
33 var VERSION = "ECMA_1";
34 startTest();
36 writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
39 // Dates around 1970
41 addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1970);TDATE",
42 UTCDateFromTime(SetUTCFullYear(0,1970)),
43 LocalDateFromTime(SetUTCFullYear(0,1970)) );
45 addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1971);TDATE",
46 UTCDateFromTime(SetUTCFullYear(0,1971)),
47 LocalDateFromTime(SetUTCFullYear(0,1971)) );
49 addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
50 UTCDateFromTime(SetUTCFullYear(0,1972)),
51 LocalDateFromTime(SetUTCFullYear(0,1972)) );
53 addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
54 UTCDateFromTime(SetUTCFullYear(0,1968)),
55 LocalDateFromTime(SetUTCFullYear(0,1968)) );
57 addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
58 UTCDateFromTime(SetUTCFullYear(0,1969)),
59 LocalDateFromTime(SetUTCFullYear(0,1969)) );
61 addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
62 UTCDateFromTime(SetUTCFullYear(0,1969)),
63 LocalDateFromTime(SetUTCFullYear(0,1969)) );
65 test();
67 function addNewTestCase( DateString, UTCDate, LocalDate) {
68 DateCase = eval( DateString );
70 new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
71 new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
73 new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
74 new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
75 new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
76 new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
77 new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
78 new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
79 new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
80 new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
82 new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
83 new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
84 new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
85 new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
86 new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
87 new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
88 new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
89 new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
91 DateCase.toString = Object.prototype.toString;
93 new TestCase( SECTION,
94 DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
95 "[object Date]",
96 DateCase.toString() );
97 }
99 function MyDate() {
100 this.year = 0;
101 this.month = 0;
102 this.date = 0;
103 this.hours = 0;
104 this.minutes = 0;
105 this.seconds = 0;
106 this.ms = 0;
107 }
108 function LocalDateFromTime(t) {
109 t = LocalTime(t);
110 return ( MyDateFromTime(t) );
111 }
112 function UTCDateFromTime(t) {
113 return ( MyDateFromTime(t) );
114 }
115 function MyDateFromTime( t ) {
116 var d = new MyDate();
117 d.year = YearFromTime(t);
118 d.month = MonthFromTime(t);
119 d.date = DateFromTime(t);
120 d.hours = HourFromTime(t);
121 d.minutes = MinFromTime(t);
122 d.seconds = SecFromTime(t);
123 d.ms = msFromTime(t);
125 d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
126 d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
127 d.day = WeekDay( d.value );
129 return (d);
130 }
131 function SetUTCFullYear( t, year, mon, date ) {
132 var T = ( t != t ) ? 0 : t;
133 var YEAR = Number(year);
134 var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
135 var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
136 var DAY = MakeDay( YEAR, MONTH, DATE );
138 return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
139 }