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 // |reftest| random-if(Android)
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 /**
9 File Name: 15.9.5.28-1.js
10 ECMA Section: 15.9.5.28 Date.prototype.setMinutes(min [, sec [, ms ]] )
11 Description:
12 If sec is not specified, this behaves as if sec were specified with the
13 value getSeconds ( ).
15 If ms is not specified, this behaves as if ms were specified with the
16 value getMilliseconds( ).
18 1. Let t be the result of LocalTime(this time value).
19 2. Call ToNumber(min).
20 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec).
21 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms).
22 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
23 6. Compute UTC(MakeDate(Day(t), Result(5))).
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
29 */
30 var SECTION = "15.9.5.28-1";
31 var VERSION = "ECMA_1";
32 startTest();
34 writeHeaderToLog( SECTION + " Date.prototype.setMinutes(sec [,ms] )");
36 addNewTestCase( 0, 0, void 0, void 0,
37 "TDATE = new Date(0);(TDATE).setMinutes(0);TDATE",
38 UTCDateFromTime(SetMinutes(0,0,0,0)),
39 LocalDateFromTime(SetMinutes(0,0,0,0)) );
41 addNewTestCase( 28800000, 59, 59, void 0,
42 "TDATE = new Date(28800000);(TDATE).setMinutes(59,59);TDATE",
43 UTCDateFromTime(SetMinutes(28800000,59,59)),
44 LocalDateFromTime(SetMinutes(28800000,59,59)) );
46 addNewTestCase( 28800000, 59, 59, 999,
47 "TDATE = new Date(28800000);(TDATE).setMinutes(59,59,999);TDATE",
48 UTCDateFromTime(SetMinutes(28800000,59,59,999)),
49 LocalDateFromTime(SetMinutes(28800000,59,59,999)) );
51 addNewTestCase( 28800000, 59, void 0, void 0,
52 "TDATE = new Date(28800000);(TDATE).setMinutes(59);TDATE",
53 UTCDateFromTime(SetMinutes(28800000,59,0)),
54 LocalDateFromTime(SetMinutes(28800000,59,0)) );
56 addNewTestCase( 28800000, -480, void 0, void 0,
57 "TDATE = new Date(28800000);(TDATE).setMinutes(-480);TDATE",
58 UTCDateFromTime(SetMinutes(28800000,-480)),
59 LocalDateFromTime(SetMinutes(28800000,-480)) );
61 addNewTestCase( 946684800000, 1234567, void 0, void 0,
62 "TDATE = new Date(946684800000);(TDATE).setMinutes(1234567);TDATE",
63 UTCDateFromTime(SetMinutes(946684800000,1234567)),
64 LocalDateFromTime(SetMinutes(946684800000,1234567)) );
66 addNewTestCase( -2208988800000,59, 59, void 0,
67 "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59);TDATE",
68 UTCDateFromTime(SetMinutes(-2208988800000,59,59)),
69 LocalDateFromTime(SetMinutes(-2208988800000,59,59)) );
71 addNewTestCase( -2208988800000, 59, 59, 999,
72 "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59,999);TDATE",
73 UTCDateFromTime(SetMinutes(-2208988800000,59,59,999)),
74 LocalDateFromTime(SetMinutes(-2208988800000,59,59,999)) );
76 test();
78 function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) {
79 DateCase = new Date( time );
81 if ( sec == void 0 ) {
82 DateCase.setMinutes( min );
83 } else {
84 if ( ms == void 0 ) {
85 DateCase.setMinutes( min, sec );
86 } else {
87 DateCase.setMinutes( min, sec, ms );
88 }
89 }
91 new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
92 new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
94 new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
95 new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
96 new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
98 new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
99 new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
100 new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
101 new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
103 new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
104 new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
105 new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
107 new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
108 new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
109 new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
110 new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
112 DateCase.toString = Object.prototype.toString;
114 new TestCase( SECTION,
115 DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
116 "[object Date]",
117 DateCase.toString() );
118 }
120 function MyDate() {
121 this.year = 0;
122 this.month = 0;
123 this.date = 0;
124 this.hours = 0;
125 this.minutes = 0;
126 this.seconds = 0;
127 this.ms = 0;
128 }
129 function LocalDateFromTime(t) {
130 t = LocalTime(t);
131 return ( MyDateFromTime(t) );
132 }
133 function UTCDateFromTime(t) {
134 return ( MyDateFromTime(t) );
135 }
136 function MyDateFromTime( t ) {
137 var d = new MyDate();
138 d.year = YearFromTime(t);
139 d.month = MonthFromTime(t);
140 d.date = DateFromTime(t);
141 d.hours = HourFromTime(t);
142 d.minutes = MinFromTime(t);
143 d.seconds = SecFromTime(t);
144 d.ms = msFromTime(t);
146 d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
147 d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
148 d.day = WeekDay( d.value );
150 return (d);
151 }
153 function SetMinutes( t, min, sec, ms ) {
154 var TIME = LocalTime(t);
155 var MIN = Number(min);
156 var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
157 var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
158 var RESULT5 = MakeTime( HourFromTime( TIME ),
159 MIN,
160 SEC,
161 MS );
162 return ( TimeClip(UTC( MakeDate(Day(TIME),RESULT5))) );
163 }