Changeset 217458 in webkit


Ignore:
Timestamp:
May 25, 2017 5:06:44 PM (7 years ago)
Author:
keith_miller@apple.com
Message:

Date should use historical data if it's available.
https://bugs.webkit.org/show_bug.cgi?id=172592

Reviewed by Mark Lam.

JSTests:

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):

Source/WTF:

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.

LayoutTests:

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:
Location:
trunk
Files:
3 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r217438 r217458  
     12017-05-25  Keith Miller  <keith_miller@apple.com>
     2
     3        Date should use historical data if it's available.
     4        https://bugs.webkit.org/show_bug.cgi?id=172592
     5
     6        Reviewed by Mark Lam.
     7
     8        Remove parts of the date tests that rely on the absence of
     9        historical data in Date.
     10
     11        * mozilla/ecma/Date/15.9.5.31-1.js:
     12        (getTestCases):
     13        * mozilla/ecma/Date/15.9.5.35-1.js:
     14        (getTestCases):
     15
    1162017-05-25  Saam Barati  <sbarati@apple.com>
    217
  • trunk/JSTests/mozilla/ecma/Date/15.9.5.31-1.js

    r11995 r217458  
    9090                    LocalDateFromTime(SetUTCHours(28800000,-8670)) );
    9191
     92// This test is commented out because it relies on non-historical data, which is allowed now.
     93/*
    9294    addNewTestCase( 946684800000, 1234567, void 0, void 0, void 0,
    9395                    "TDATE = new Date(946684800000);(TDATE).setUTCHours(1234567);TDATE",
    9496                    UTCDateFromTime(SetUTCHours(946684800000,1234567)),
    9597                    LocalDateFromTime(SetUTCHours(946684800000,1234567)) );
    96 
     98*/
    9799    addNewTestCase( -2208988800000, 59, 999, void 0, void 0,
    98100                    "TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE",
  • trunk/JSTests/mozilla/ecma/Date/15.9.5.35-1.js

    r11995 r217458  
    5959                    LocalDateFromTime(SetUTCMonth(0,11)) );
    6060
     61// This test is commented out because it relies on non-historical data, which is allowed now.
     62/*
    6163    addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(3,4);TDATE",
    6264                    UTCDateFromTime(SetUTCMonth(0,3,4)),
    6365                    LocalDateFromTime(SetUTCMonth(0,3,4)) );
    64 
     66*/
    6567}
    6668
  • trunk/LayoutTests/ChangeLog

    r217445 r217458  
     12017-05-25  Keith Miller  <keith_miller@apple.com>
     2
     3        Date should use historical data if it's available.
     4        https://bugs.webkit.org/show_bug.cgi?id=172592
     5
     6        Reviewed by Mark Lam.
     7
     8        Fix tests to work with historically accurate dates.
     9
     10        * js/dom/date-big-setdate-expected.txt: Removed.
     11        * js/dom/date-big-setdate.html: Removed.
     12        * js/dom/script-tests/date-big-setdate.js: Removed.
     13        * storage/indexeddb/modern/date-basic-expected.txt:
     14        * storage/indexeddb/modern/date-basic-private-expected.txt:
     15        * storage/indexeddb/modern/get-keyrange-expected.txt:
     16        * storage/indexeddb/modern/get-keyrange-private-expected.txt:
     17
    1182017-05-25  Chris Dumez  <cdumez@apple.com>
    219
  • trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt

    r195380 r217458  
    1010Initial upgrade needed: Old version - 0 New version - 1
    1111Initial upgrade versionchange transaction complete
    12 Success getting key 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object, result is 'Flux capacitor' of type string
     12Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object, result is 'Flux capacitor' of type string
    1313Key is a Date object, btw
    1414Success getting key 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object, result is 'Fish under the sea' of type string
     
    1616Success getting key 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object, result is 'Hoverboards' of type string
    1717Key is a Date object, btw
    18 Success getting key 'a' of type string, result is 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object
     18Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object
    1919Result is a Date object, btw
    2020Success getting key 'b' of type string, result is 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object
  • trunk/LayoutTests/storage/indexeddb/modern/date-basic-private-expected.txt

    r195394 r217458  
    1010Initial upgrade needed: Old version - 0 New version - 1
    1111Initial upgrade versionchange transaction complete
    12 Success getting key 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object, result is 'Flux capacitor' of type string
     12Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object, result is 'Flux capacitor' of type string
    1313Key is a Date object, btw
    1414Success getting key 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object, result is 'Fish under the sea' of type string
     
    1616Success getting key 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object, result is 'Hoverboards' of type string
    1717Key is a Date object, btw
    18 Success getting key 'a' of type string, result is 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object
     18Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object
    1919Result is a Date object, btw
    2020Success getting key 'b' of type string, result is 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object
  • trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt

    r195380 r217458  
    124124Success getting keyRange [Infinity (Open), a (Open)]
    125125Result is Flux capacitor
    126 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)]
     126Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
    127127Result is Flux capacitor
    128 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)]
     128Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
    129129Result is Fish under the sea
    130 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)]
     130Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
    131131Result is Flux capacitor
    132 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)]
     132Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
    133133Result is Fish under the sea
    134134readonly transaction complete
  • trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt

    r195394 r217458  
    124124Success getting keyRange [Infinity (Open), a (Open)]
    125125Result is Flux capacitor
    126 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)]
     126Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
    127127Result is Flux capacitor
    128 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)]
     128Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
    129129Result is Fish under the sea
    130 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)]
     130Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
    131131Result is Flux capacitor
    132 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)]
     132Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
    133133Result is Fish under the sea
    134134readonly transaction complete
  • trunk/Source/WTF/ChangeLog

    r217432 r217458  
     12017-05-25  Keith Miller  <keith_miller@apple.com>
     2
     3        Date should use historical data if it's available.
     4        https://bugs.webkit.org/show_bug.cgi?id=172592
     5
     6        Reviewed by Mark Lam.
     7
     8        The spec previously disallowed using historical data for Dates.
     9        This is no longer the case. Additionally, not using historical
     10        data, when available, seems unfortunate for users. This patch
     11        removes the code dropping historical data.
     12
     13        * wtf/DateMath.cpp:
     14        (WTF::calculateLocalTimeOffset):
     15        (WTF::msToMilliseconds): Deleted.
     16
    1172017-05-25  Yusuke Suzuki  <utatane.tea@gmail.com>
    218
  • trunk/Source/WTF/wtf/DateMath.cpp

    r215359 r217458  
    197197}
    198198
    199 static inline double msToMilliseconds(double ms)
    200 {
    201     double result = fmod(ms, msPerDay);
    202     if (result < 0)
    203         result += msPerDay;
    204     return result;
    205 }
    206 
    207199int msToMinutes(double ms)
    208200{
     
    513505    if (inputTimeType == LocalTime)
    514506        ms -= localToUTCTimeOffset;
    515 
    516     // On Mac OS X, the call to localtime (see calculateDSTOffset) will return historically accurate
    517     // DST information (e.g. New Zealand did not have DST from 1946 to 1974) however the JavaScript
    518     // standard explicitly dictates that historical information should not be considered when
    519     // determining DST. For this reason we shift away from years that localtime can handle but would
    520     // return historically accurate information.
    521     int year = msToYear(ms);
    522     int equivalentYear = equivalentYearForDST(year);
    523     if (year != equivalentYear) {
    524         bool leapYear = isLeapYear(year);
    525         int dayInYearLocal = dayInYear(ms, year);
    526         int dayInMonth = dayInMonthFromDayInYear(dayInYearLocal, leapYear);
    527         int month = monthFromDayInYear(dayInYearLocal, leapYear);
    528         double day = dateToDaysFrom1970(equivalentYear, month, dayInMonth);
    529         ms = (day * msPerDay) + msToMilliseconds(ms);
    530     }
    531507
    532508    double localTimeSeconds = ms / msPerSecond;
Note: See TracChangeset for help on using the changeset viewer.