Diff
Modified: trunk/JSTests/ChangeLog (217498 => 217499)
--- trunk/JSTests/ChangeLog 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/JSTests/ChangeLog 2017-05-26 19:27:41 UTC (rev 217499)
@@ -1,3 +1,15 @@
+2017-05-26 Ryan Haddad <[email protected]>
+
+ Unreviewed, rolling out r217458.
+
+ This change caused 55 JSC test failures.
+
+ Reverted changeset:
+
+ "Date should use historical data if it's available."
+ https://bugs.webkit.org/show_bug.cgi?id=172592
+ http://trac.webkit.org/changeset/217458
+
2017-05-26 Yusuke Suzuki <[email protected]>
Give ModuleProgram the same treatment that we did for ProgramCode in bug#167725
Modified: trunk/JSTests/mozilla/ecma/Date/15.9.5.31-1.js (217498 => 217499)
--- trunk/JSTests/mozilla/ecma/Date/15.9.5.31-1.js 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/JSTests/mozilla/ecma/Date/15.9.5.31-1.js 2017-05-26 19:27:41 UTC (rev 217499)
@@ -89,13 +89,11 @@
UTCDateFromTime(SetUTCHours(28800000,-8670)),
LocalDateFromTime(SetUTCHours(28800000,-8670)) );
-// This test is commented out because it relies on non-historical data, which is allowed now.
-/*
addNewTestCase( 946684800000, 1234567, void 0, void 0, void 0,
"TDATE = new Date(946684800000);(TDATE).setUTCHours(1234567);TDATE",
UTCDateFromTime(SetUTCHours(946684800000,1234567)),
LocalDateFromTime(SetUTCHours(946684800000,1234567)) );
-*/
+
addNewTestCase( -2208988800000, 59, 999, void 0, void 0,
"TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE",
UTCDateFromTime(SetUTCHours(-2208988800000,59,999)),
Modified: trunk/JSTests/mozilla/ecma/Date/15.9.5.35-1.js (217498 => 217499)
--- trunk/JSTests/mozilla/ecma/Date/15.9.5.35-1.js 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/JSTests/mozilla/ecma/Date/15.9.5.35-1.js 2017-05-26 19:27:41 UTC (rev 217499)
@@ -58,12 +58,10 @@
UTCDateFromTime(SetUTCMonth(0,11)),
LocalDateFromTime(SetUTCMonth(0,11)) );
-// This test is commented out because it relies on non-historical data, which is allowed now.
-/*
addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(3,4);TDATE",
UTCDateFromTime(SetUTCMonth(0,3,4)),
LocalDateFromTime(SetUTCMonth(0,3,4)) );
-*/
+
}
function addNewTestCase( DateString, UTCDate, LocalDate) {
Modified: trunk/LayoutTests/ChangeLog (217498 => 217499)
--- trunk/LayoutTests/ChangeLog 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/LayoutTests/ChangeLog 2017-05-26 19:27:41 UTC (rev 217499)
@@ -1,5 +1,17 @@
2017-05-26 Ryan Haddad <[email protected]>
+ Unreviewed, rolling out r217458.
+
+ This change caused 55 JSC test failures.
+
+ Reverted changeset:
+
+ "Date should use historical data if it's available."
+ https://bugs.webkit.org/show_bug.cgi?id=172592
+ http://trac.webkit.org/changeset/217458
+
+2017-05-26 Ryan Haddad <[email protected]>
+
Rebaseline js/dom/global-constructors-attributes.html.
Unreviewed test gardening.
Added: trunk/LayoutTests/js/dom/date-big-setdate-expected.txt (0 => 217499)
--- trunk/LayoutTests/js/dom/date-big-setdate-expected.txt (rev 0)
+++ trunk/LayoutTests/js/dom/date-big-setdate-expected.txt 2017-05-26 19:27:41 UTC (rev 217499)
@@ -0,0 +1,20 @@
+This test checks for regression against: 3381 Date.prototype.setDate() incorrect for values >=128.
+12975: DST changes in US affect _javascript_ date calculations
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS d.valueOf() - curValue is millisecondsPerDay
+PASS d.valueOf() - curValue is millisecondsPerDay
+PASS d.valueOf() - curValue is millisecondsPerDay
+PASS d.valueOf() - curValue is millisecondsPerDay
+PASS d.valueOf() - curValue is millisecondsPerDay
+PASS d.valueOf() - curValue is millisecondsPerDay
+PASS d.valueOf() - curValue is millisecondsPerDay
+PASS d.valueOf() - curValue is millisecondsPerDay
+PASS d.valueOf() - curValue is millisecondsPerDay
+PASS Passed all tests for DST (or skipped the tests if your timezone isn't PST/PDT)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/js/dom/date-big-setdate.html (0 => 217499)
--- trunk/LayoutTests/js/dom/date-big-setdate.html (rev 0)
+++ trunk/LayoutTests/js/dom/date-big-setdate.html 2017-05-26 19:27:41 UTC (rev 217499)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/js/dom/script-tests/date-big-setdate.js (0 => 217499)
--- trunk/LayoutTests/js/dom/script-tests/date-big-setdate.js (rev 0)
+++ trunk/LayoutTests/js/dom/script-tests/date-big-setdate.js 2017-05-26 19:27:41 UTC (rev 217499)
@@ -0,0 +1,57 @@
+description(
+'This test checks for regression against: <a href="" 3381 Date.prototype.setDate() incorrect for values >=128.</a> <br /> <a href="" DST changes in US affect _javascript_ date calculations</a>'
+);
+
+
+var validVars = false;
+var curValue;
+var success = true;
+var millisecondsPerDay = 1000 * 60 * 60 * 24;
+var millisecondsPerHour = 1000 * 60 * 60;
+
+for (var i = 116; i < 126; i++) {
+ var d = new Date(0);
+ d.setDate(i);
+ if (validVars)
+ shouldBe("d.valueOf() - curValue", "millisecondsPerDay");
+
+ curValue = d.valueOf();
+ validVars = true;
+}
+
+var testCases = [];
+if ((new Date(2009, 9, 1)).toString().match("PDT")) {
+ // Added a special case that should represent a change in DST. DST did not actually
+ // change on this date but because of the wierdness of how _javascript_Dates are
+// expected to interpolate DST as opposed to reflect acurate history, this day
+ // (April 5th 1970) should show a DST change.
+ testCases.push([new Date(0), 97, 98]);
+
+ // Added more special cases. These dates match the recent DST changes in the US.
+ // These tests check that the new changes are correctly propogated to the past and
+ // all of the tests should show DST occurring on the same date.
+ testCases.push([new Date(1970, 0,0,0,0,0,0), 98, 99]);
+ testCases.push([new Date(1998, 0,0,0,0,0,0), 98, 99]);
+ testCases.push([new Date(2026, 0,0,0,0,0,0), 98, 99]);
+ testCases.push([new Date(2054, 0,0,0,0,0,0), 98, 99]);
+}
+
+var errors = [];
+for (var i = 0; i < testCases.length; i++) {
+ var c = testCases[i][0];
+ var d = new Date(c);
+ c.setDate(testCases[i][1]);
+ d.setDate(testCases[i][2]);
+
+ var actual = d.valueOf() - c.valueOf();
+ var expected = millisecondsPerDay - millisecondsPerHour;
+ if (actual != expected) {
+ errors.push("Unexpected difference between two days (expected: " + expected + ", actual: " + actual + ") for " + testCases[i][0]);
+ }
+}
+
+if (errors.length) {
+ testFailed(errors.length + "/" + testCases.length + " tests were failed: " + errors.join(", "));
+} else {
+ testPassed("Passed all tests for DST (or skipped the tests if your timezone isn't PST/PDT)");
+}
Modified: trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt (217498 => 217499)
--- trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt 2017-05-26 19:27:41 UTC (rev 217499)
@@ -9,13 +9,13 @@
indexedDB.open(dbname)
Initial upgrade needed: Old version - 0 New version - 1
Initial upgrade versionchange transaction complete
-Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object, result is 'Flux capacitor' of type string
+Success getting key 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object, result is 'Flux capacitor' of type string
Key is a Date object, btw
Success getting key 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object, result is 'Fish under the sea' of type string
Key is a Date object, btw
Success getting key 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object, result is 'Hoverboards' of type string
Key is a Date object, btw
-Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object
+Success getting key 'a' of type string, result is 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object
Result is a Date object, btw
Success getting key 'b' of type string, result is 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object
Result is a Date object, btw
Modified: trunk/LayoutTests/storage/indexeddb/modern/date-basic-private-expected.txt (217498 => 217499)
--- trunk/LayoutTests/storage/indexeddb/modern/date-basic-private-expected.txt 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/LayoutTests/storage/indexeddb/modern/date-basic-private-expected.txt 2017-05-26 19:27:41 UTC (rev 217499)
@@ -9,13 +9,13 @@
indexedDB.open(dbname)
Initial upgrade needed: Old version - 0 New version - 1
Initial upgrade versionchange transaction complete
-Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object, result is 'Flux capacitor' of type string
+Success getting key 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object, result is 'Flux capacitor' of type string
Key is a Date object, btw
Success getting key 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object, result is 'Fish under the sea' of type string
Key is a Date object, btw
Success getting key 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object, result is 'Hoverboards' of type string
Key is a Date object, btw
-Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object
+Success getting key 'a' of type string, result is 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object
Result is a Date object, btw
Success getting key 'b' of type string, result is 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object
Result is a Date object, btw
Modified: trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt (217498 => 217499)
--- trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt 2017-05-26 19:27:41 UTC (rev 217499)
@@ -123,13 +123,13 @@
Result is PosInf
Success getting keyRange [Infinity (Open), a (Open)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
Result is Fish under the sea
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
Result is Fish under the sea
readonly transaction complete
PASS successfullyParsed is true
Modified: trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt (217498 => 217499)
--- trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt 2017-05-26 19:27:41 UTC (rev 217499)
@@ -123,13 +123,13 @@
Result is PosInf
Success getting keyRange [Infinity (Open), a (Open)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
Result is Fish under the sea
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
Result is Fish under the sea
readonly transaction complete
PASS successfullyParsed is true
Modified: trunk/Source/WTF/ChangeLog (217498 => 217499)
--- trunk/Source/WTF/ChangeLog 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/Source/WTF/ChangeLog 2017-05-26 19:27:41 UTC (rev 217499)
@@ -1,3 +1,15 @@
+2017-05-26 Ryan Haddad <[email protected]>
+
+ Unreviewed, rolling out r217458.
+
+ This change caused 55 JSC test failures.
+
+ Reverted changeset:
+
+ "Date should use historical data if it's available."
+ https://bugs.webkit.org/show_bug.cgi?id=172592
+ http://trac.webkit.org/changeset/217458
+
2017-05-25 Keith Miller <[email protected]>
Date should use historical data if it's available.
Modified: trunk/Source/WTF/wtf/DateMath.cpp (217498 => 217499)
--- trunk/Source/WTF/wtf/DateMath.cpp 2017-05-26 18:45:43 UTC (rev 217498)
+++ trunk/Source/WTF/wtf/DateMath.cpp 2017-05-26 19:27:41 UTC (rev 217499)
@@ -196,6 +196,14 @@
return static_cast<int>(msToDays(ms) - daysFrom1970ToYear(year));
}
+static inline double msToMilliseconds(double ms)
+{
+ double result = fmod(ms, msPerDay);
+ if (result < 0)
+ result += msPerDay;
+ return result;
+}
+
int msToMinutes(double ms)
{
double result = fmod(floor(ms / msPerMinute), minutesPerHour);
@@ -505,6 +513,22 @@
if (inputTimeType == LocalTime)
ms -= localToUTCTimeOffset;
+ // On Mac OS X, the call to localtime (see calculateDSTOffset) will return historically accurate
+ // DST information (e.g. New Zealand did not have DST from 1946 to 1974) however the _javascript_
+ // standard explicitly dictates that historical information should not be considered when
+ // determining DST. For this reason we shift away from years that localtime can handle but would
+ // return historically accurate information.
+ int year = msToYear(ms);
+ int equivalentYear = equivalentYearForDST(year);
+ if (year != equivalentYear) {
+ bool leapYear = isLeapYear(year);
+ int dayInYearLocal = dayInYear(ms, year);
+ int dayInMonth = dayInMonthFromDayInYear(dayInYearLocal, leapYear);
+ int month = monthFromDayInYear(dayInYearLocal, leapYear);
+ double day = dateToDaysFrom1970(equivalentYear, month, dayInMonth);
+ ms = (day * msPerDay) + msToMilliseconds(ms);
+ }
+
double localTimeSeconds = ms / msPerSecond;
if (localTimeSeconds > maxUnixTime)
localTimeSeconds = maxUnixTime;