Diff
Modified: trunk/JSTests/ChangeLog (217457 => 217458)
--- trunk/JSTests/ChangeLog 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/JSTests/ChangeLog 2017-05-26 00:06:44 UTC (rev 217458)
@@ -1,3 +1,18 @@
+2017-05-25 Keith Miller <[email protected]>
+
+ Date should use historical data if it's available.
+ https://bugs.webkit.org/show_bug.cgi?id=172592
+
+ Reviewed by Mark Lam.
+
+ Remove parts of the date tests that rely on the absence of
+ historical data in Date.
+
+ * mozilla/ecma/Date/15.9.5.31-1.js:
+ (getTestCases):
+ * mozilla/ecma/Date/15.9.5.35-1.js:
+ (getTestCases):
+
2017-05-25 Saam Barati <[email protected]>
Our for-in optimization in the bytecode generator does its static analysis incorrectly
Modified: trunk/JSTests/mozilla/ecma/Date/15.9.5.31-1.js (217457 => 217458)
--- trunk/JSTests/mozilla/ecma/Date/15.9.5.31-1.js 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/JSTests/mozilla/ecma/Date/15.9.5.31-1.js 2017-05-26 00:06:44 UTC (rev 217458)
@@ -89,11 +89,13 @@
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 (217457 => 217458)
--- trunk/JSTests/mozilla/ecma/Date/15.9.5.35-1.js 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/JSTests/mozilla/ecma/Date/15.9.5.35-1.js 2017-05-26 00:06:44 UTC (rev 217458)
@@ -58,10 +58,12 @@
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 (217457 => 217458)
--- trunk/LayoutTests/ChangeLog 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/LayoutTests/ChangeLog 2017-05-26 00:06:44 UTC (rev 217458)
@@ -1,3 +1,20 @@
+2017-05-25 Keith Miller <[email protected]>
+
+ Date should use historical data if it's available.
+ https://bugs.webkit.org/show_bug.cgi?id=172592
+
+ Reviewed by Mark Lam.
+
+ Fix tests to work with historically accurate dates.
+
+ * js/dom/date-big-setdate-expected.txt: Removed.
+ * js/dom/date-big-setdate.html: Removed.
+ * js/dom/script-tests/date-big-setdate.js: Removed.
+ * storage/indexeddb/modern/date-basic-expected.txt:
+ * storage/indexeddb/modern/date-basic-private-expected.txt:
+ * storage/indexeddb/modern/get-keyrange-expected.txt:
+ * storage/indexeddb/modern/get-keyrange-private-expected.txt:
+
2017-05-25 Chris Dumez <[email protected]>
DocumentThreadableLoader::redirectReceived() should not rely on the resource's loader
Deleted: trunk/LayoutTests/js/dom/date-big-setdate-expected.txt (217457 => 217458)
--- trunk/LayoutTests/js/dom/date-big-setdate-expected.txt 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/LayoutTests/js/dom/date-big-setdate-expected.txt 2017-05-26 00:06:44 UTC (rev 217458)
@@ -1,20 +0,0 @@
-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
-
Deleted: trunk/LayoutTests/js/dom/date-big-setdate.html (217457 => 217458)
--- trunk/LayoutTests/js/dom/date-big-setdate.html 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/LayoutTests/js/dom/date-big-setdate.html 2017-05-26 00:06:44 UTC (rev 217458)
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<script src=""
-<script src=""
-</body>
-</html>
Deleted: trunk/LayoutTests/js/dom/script-tests/date-big-setdate.js (217457 => 217458)
--- trunk/LayoutTests/js/dom/script-tests/date-big-setdate.js 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/LayoutTests/js/dom/script-tests/date-big-setdate.js 2017-05-26 00:06:44 UTC (rev 217458)
@@ -1,57 +0,0 @@
-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 (217457 => 217458)
--- trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt 2017-05-26 00:06:44 UTC (rev 217458)
@@ -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 17:00:00 GMT-0700 (PDT)' of type object, result is 'Flux capacitor' of type string
+Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' 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 17:00:00 GMT-0700 (PDT)' of type object
+Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' 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 (217457 => 217458)
--- trunk/LayoutTests/storage/indexeddb/modern/date-basic-private-expected.txt 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/LayoutTests/storage/indexeddb/modern/date-basic-private-expected.txt 2017-05-26 00:06:44 UTC (rev 217458)
@@ -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 17:00:00 GMT-0700 (PDT)' of type object, result is 'Flux capacitor' of type string
+Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' 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 17:00:00 GMT-0700 (PDT)' of type object
+Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' 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 (217457 => 217458)
--- trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt 2017-05-26 00:06:44 UTC (rev 217458)
@@ -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 17:00:00 GMT-0700 (PDT) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+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)]
Result is Flux capacitor
-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)]
+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)]
Result is Fish under the sea
-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)]
+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)]
Result is Flux capacitor
-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)]
+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)]
Result is Fish under the sea
readonly transaction complete
PASS successfullyParsed is true
Modified: trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt (217457 => 217458)
--- trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt 2017-05-26 00:06:44 UTC (rev 217458)
@@ -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 17:00:00 GMT-0700 (PDT) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+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)]
Result is Flux capacitor
-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)]
+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)]
Result is Fish under the sea
-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)]
+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)]
Result is Flux capacitor
-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)]
+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)]
Result is Fish under the sea
readonly transaction complete
PASS successfullyParsed is true
Modified: trunk/Source/WTF/ChangeLog (217457 => 217458)
--- trunk/Source/WTF/ChangeLog 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/Source/WTF/ChangeLog 2017-05-26 00:06:44 UTC (rev 217458)
@@ -1,3 +1,19 @@
+2017-05-25 Keith Miller <[email protected]>
+
+ Date should use historical data if it's available.
+ https://bugs.webkit.org/show_bug.cgi?id=172592
+
+ Reviewed by Mark Lam.
+
+ The spec previously disallowed using historical data for Dates.
+ This is no longer the case. Additionally, not using historical
+ data, when available, seems unfortunate for users. This patch
+ removes the code dropping historical data.
+
+ * wtf/DateMath.cpp:
+ (WTF::calculateLocalTimeOffset):
+ (WTF::msToMilliseconds): Deleted.
+
2017-05-25 Yusuke Suzuki <[email protected]>
[Win] ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key)
Modified: trunk/Source/WTF/wtf/DateMath.cpp (217457 => 217458)
--- trunk/Source/WTF/wtf/DateMath.cpp 2017-05-26 00:03:13 UTC (rev 217457)
+++ trunk/Source/WTF/wtf/DateMath.cpp 2017-05-26 00:06:44 UTC (rev 217458)
@@ -196,14 +196,6 @@
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);
@@ -513,22 +505,6 @@
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;