[JSC] Some setters for components of Date do not timeClip() their result
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Jun 2016 03:34:31 +0000 (03:34 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Jun 2016 03:34:31 +0000 (03:34 +0000)
commitedf9316b42b86e263c61073f7f79c52fae81540e
tree5cc1aad32a710f54ceea069c2d97cd94a0bde49a
parent5f4f302a2e5a67b5f80b33eefb15bf2a08b8b96d
[JSC] Some setters for components of Date do not timeClip() their result
https://bugs.webkit.org/show_bug.cgi?id=158278
Source/JavaScriptCore:

rdar://problem/25131426

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-06-01
Reviewed by Geoffrey Garen.

Many of the setters where not doing timeClip() on the computed UTC
time since Epoch.

See http://www.ecma-international.org/ecma-262/6.0/#sec-date.prototype.setdate
and the following sections for the definition.

* runtime/DatePrototype.cpp:
(JSC::setNewValueFromTimeArgs):
(JSC::setNewValueFromDateArgs):

Source/WTF:

Unreviewed.

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-06-01

* wtf/DateMath.cpp:
(WTF::equivalentYearForDST): Deleted.
The assertion is bogus.
As the comments above explains, the function is completely wrong for years
outside [1900-2100].
The tests passing large values for years are failing (year <= maxYear).
The weird NaN test is a mystery. The old changelog does not explain it.

LayoutTests:

rdar://problem/25131426

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-06-01
Reviewed by Geoffrey Garen.

New test coverage for large values.

Note that some of those tests are still failing with this patch.

The reason is our code handling month and years is unable to deal
with values outside int32.
Changing that is a bit more complicated due to the number of users
of DateMath. I leave that for the future.

* js/date-timeClip-large-values-expected.txt: Added.
* js/date-timeClip-large-values.html: Added.
* js/script-tests/date-timeClip-large-values.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/js/date-timeClip-large-values-expected.txt [new file with mode: 0644]
LayoutTests/js/date-timeClip-large-values.html [new file with mode: 0644]
LayoutTests/js/script-tests/date-timeClip-large-values.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/DatePrototype.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/DateMath.cpp