Title: [201586] trunk
Revision
201586
Author
[email protected]
Date
2016-06-01 20:34:31 -0700 (Wed, 01 Jun 2016)

Log Message

[JSC] Some setters for components of Date do not timeClip() their result
https://bugs.webkit.org/show_bug.cgi?id=158278
Source/_javascript_Core:

rdar://problem/25131426

Patch by Benjamin Poulain <[email protected]> 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 <[email protected]> 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 <[email protected]> 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (201585 => 201586)


--- trunk/LayoutTests/ChangeLog	2016-06-02 03:19:54 UTC (rev 201585)
+++ trunk/LayoutTests/ChangeLog	2016-06-02 03:34:31 UTC (rev 201586)
@@ -1,3 +1,24 @@
+2016-06-01  Benjamin Poulain  <[email protected]>
+
+        [JSC] Some setters for components of Date do not timeClip() their result
+        https://bugs.webkit.org/show_bug.cgi?id=158278
+        rdar://problem/25131426
+
+        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.
+
 2016-06-01  Chris Fleizach  <[email protected]>
 
         AX: iOS: VoiceOver can't access attachments in mail messages

Added: trunk/LayoutTests/js/date-timeClip-large-values-expected.txt (0 => 201586)


--- trunk/LayoutTests/js/date-timeClip-large-values-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/date-timeClip-large-values-expected.txt	2016-06-02 03:34:31 UTC (rev 201586)
@@ -0,0 +1,105 @@
+Verify that changing a date with a delta that is too large for a date produces an invalid date/NaN
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing date creating at the max boundary
+PASS new Date(0).valueOf() is 0
+PASS new Date(8.64e15) instanceof Date is true
+PASS new Date(8.64e15).valueOf() is 8.64e15
+PASS new Date(8640000000000001) instanceof Date is true
+PASS new Date(8640000000000001).valueOf() is NaN
+PASS new Date(Infinity) instanceof Date is true
+PASS new Date(Infinity).valueOf() is NaN
+PASS new Date(-Infinity) instanceof Date is true
+PASS new Date(-Infinity).valueOf() is NaN
+Testing setMilliseconds()
+PASS new Date(0).setMilliseconds(Infinity).valueOf() is NaN
+PASS new Date(0).setMilliseconds(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setMilliseconds(-1.79769e+308).valueOf() is NaN
+PASS new Date(8.64e15).setMilliseconds(new Date(8.64e15).getMilliseconds()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setMilliseconds(new Date(8.64e15).getMilliseconds() + 1).valueOf() is NaN
+Testing setSeconds()
+PASS new Date(0).setSeconds(Infinity).valueOf() is NaN
+PASS new Date(0).setSeconds(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setSeconds(-1.79769e+308).valueOf() is NaN
+PASS new Date(8.64e15).setSeconds(new Date(8.64e15).getSeconds()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setSeconds(new Date(8.64e15).getSeconds() + 1).valueOf() is NaN
+Testing setMinutes()
+PASS new Date(0).setMinutes(Infinity).valueOf() is NaN
+PASS new Date(0).setMinutes(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setMinutes(-1.79769e+308).valueOf() is NaN
+PASS new Date(8.64e15).setMinutes(new Date(8.64e15).getMinutes()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setMinutes(new Date(8.64e15).getMinutes() + 1).valueOf() is NaN
+Testing setHours()
+PASS new Date(0).setHours(Infinity).valueOf() is NaN
+PASS new Date(0).setHours(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setHours(-1.79769e+308).valueOf() is NaN
+PASS new Date(8.64e15).setHours(new Date(8.64e15).getHours()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setHours(new Date(8.64e15).getHours() + 1).valueOf() is NaN
+Testing setDate()
+PASS new Date(0).setDate(Infinity).valueOf() is NaN
+PASS new Date(0).setDate(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setDate(-1.79769e+308).valueOf() is NaN
+PASS new Date(0).setDate(9e15 / (24 * 60 * 60 * 1000)).valueOf() is NaN
+PASS new Date(8.64e15).setDate(new Date(8.64e15).getDate()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setDate(new Date(8.64e15).getDate() + 1).valueOf() is NaN
+Testing setMonth()
+PASS new Date(0).setMonth(Infinity).valueOf() is NaN
+FAIL new Date(0).setMonth(1.79769e+308).valueOf() should be NaN. Was -28857600000.
+FAIL new Date(0).setMonth(-1.79769e+308).valueOf() should be NaN. Was -28857600000.
+PASS new Date(8.64e15).setMonth(new Date(8.64e15).getMonth()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setMonth(new Date(8.64e15).getMonth() + 1).valueOf() is NaN
+Testing setFullYear()
+PASS new Date(0).setFullYear(Infinity).valueOf() is NaN
+FAIL new Date(0).setFullYear(1.79769e+308).valueOf() should be NaN. Was -62135596800000.
+FAIL new Date(0).setFullYear(-1.79769e+308).valueOf() should be NaN. Was -62135596800000.
+PASS new Date(8.64e15).setFullYear(new Date(8.64e15).getFullYear()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setFullYear(new Date(8.64e15).getFullYear() + 1).valueOf() is NaN
+Testing setUTCMilliseconds()
+PASS new Date(0).setUTCMilliseconds(Infinity).valueOf() is NaN
+PASS new Date(0).setUTCMilliseconds(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setUTCMilliseconds(-1.79769e+308).valueOf() is NaN
+PASS new Date(8.64e15).setUTCMilliseconds(new Date(8.64e15).getUTCMilliseconds()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setUTCMilliseconds(new Date(8.64e15).getUTCMilliseconds() + 1).valueOf() is NaN
+Testing setUTCSeconds()
+PASS new Date(0).setUTCSeconds(Infinity).valueOf() is NaN
+PASS new Date(0).setUTCSeconds(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setUTCSeconds(-1.79769e+308).valueOf() is NaN
+PASS new Date(8.64e15).setUTCSeconds(new Date(8.64e15).getUTCSeconds()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setUTCSeconds(new Date(8.64e15).getUTCSeconds() + 1).valueOf() is NaN
+Testing setUTCMinutes()
+PASS new Date(0).setUTCMinutes(Infinity).valueOf() is NaN
+PASS new Date(0).setUTCMinutes(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setUTCMinutes(-1.79769e+308).valueOf() is NaN
+PASS new Date(8.64e15).setUTCMinutes(new Date(8.64e15).getUTCMinutes()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setUTCMinutes(new Date(8.64e15).getUTCMinutes() + 1).valueOf() is NaN
+Testing setUTCHours()
+PASS new Date(0).setUTCHours(Infinity).valueOf() is NaN
+PASS new Date(0).setUTCHours(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setUTCHours(-1.79769e+308).valueOf() is NaN
+PASS new Date(8.64e15).setUTCHours(new Date(8.64e15).getUTCHours()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setUTCHours(new Date(8.64e15).getUTCHours() + 1).valueOf() is NaN
+Testing setUTCDate()
+PASS new Date(0).setUTCDate(Infinity).valueOf() is NaN
+PASS new Date(0).setUTCDate(1.79769e+308).valueOf() is NaN
+PASS new Date(0).setUTCDate(-1.79769e+308).valueOf() is NaN
+PASS new Date(0).setUTCDate(9e15 / (24 * 60 * 60 * 1000)).valueOf() is NaN
+PASS new Date(8.64e15).setUTCDate(new Date(8.64e15).getUTCDate()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setUTCDate(new Date(8.64e15).getUTCDate() + 1).valueOf() is NaN
+Testing setUTCMonth()
+PASS new Date(0).setUTCMonth(Infinity).valueOf() is NaN
+FAIL new Date(0).setUTCMonth(1.79769e+308).valueOf() should be NaN. Was 0.
+FAIL new Date(0).setUTCMonth(-1.79769e+308).valueOf() should be NaN. Was 0.
+PASS new Date(8.64e15).setUTCMonth(new Date(8.64e15).getUTCMonth()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setUTCMonth(new Date(8.64e15).getUTCMonth() + 1).valueOf() is NaN
+Testing setUTCFullYear()
+PASS new Date(0).setUTCFullYear(Infinity).valueOf() is NaN
+FAIL new Date(0).setUTCFullYear(1.79769e+308).valueOf() should be NaN. Was -62167219200000.
+FAIL new Date(0).setUTCFullYear(-1.79769e+308).valueOf() should be NaN. Was -62167219200000.
+PASS new Date(8.64e15).setUTCFullYear(new Date(8.64e15).getUTCFullYear()).valueOf() is 8.64e15
+PASS new Date(8.64e15).setUTCFullYear(new Date(8.64e15).getUTCFullYear() + 1).valueOf() is NaN
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/date-timeClip-large-values.html (0 => 201586)


--- trunk/LayoutTests/js/date-timeClip-large-values.html	                        (rev 0)
+++ trunk/LayoutTests/js/date-timeClip-large-values.html	2016-06-02 03:34:31 UTC (rev 201586)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/js/script-tests/date-timeClip-large-values.js (0 => 201586)


--- trunk/LayoutTests/js/script-tests/date-timeClip-large-values.js	                        (rev 0)
+++ trunk/LayoutTests/js/script-tests/date-timeClip-large-values.js	2016-06-02 03:34:31 UTC (rev 201586)
@@ -0,0 +1,112 @@
+description("Verify that changing a date with a delta that is too large for a date produces an invalid date/NaN");
+
+debug("Testing date creating at the max boundary");
+shouldBe("new Date(0).valueOf()", "0");
+shouldBe("new Date(8.64e15) instanceof Date", "true");
+shouldBe("new Date(8.64e15).valueOf()", "8.64e15");
+shouldBe("new Date(8640000000000001) instanceof Date", "true");
+shouldBe("new Date(8640000000000001).valueOf()", "NaN");
+shouldBe("new Date(Infinity) instanceof Date", "true");
+shouldBe("new Date(Infinity).valueOf()", "NaN");
+shouldBe("new Date(-Infinity) instanceof Date", "true");
+shouldBe("new Date(-Infinity).valueOf()", "NaN");
+
+debug("Testing setMilliseconds()");
+shouldBe("new Date(0).setMilliseconds(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setMilliseconds(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setMilliseconds(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setMilliseconds(new Date(8.64e15).getMilliseconds()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setMilliseconds(new Date(8.64e15).getMilliseconds() + 1).valueOf()", "NaN");
+
+debug("Testing setSeconds()");
+shouldBe("new Date(0).setSeconds(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setSeconds(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setSeconds(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setSeconds(new Date(8.64e15).getSeconds()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setSeconds(new Date(8.64e15).getSeconds() + 1).valueOf()", "NaN");
+
+debug("Testing setMinutes()");
+shouldBe("new Date(0).setMinutes(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setMinutes(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setMinutes(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setMinutes(new Date(8.64e15).getMinutes()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setMinutes(new Date(8.64e15).getMinutes() + 1).valueOf()", "NaN");
+
+debug("Testing setHours()");
+shouldBe("new Date(0).setHours(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setHours(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setHours(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setHours(new Date(8.64e15).getHours()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setHours(new Date(8.64e15).getHours() + 1).valueOf()", "NaN");
+
+debug("Testing setDate()");
+shouldBe("new Date(0).setDate(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setDate(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setDate(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setDate(9e15 / (24 * 60 * 60 * 1000)).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setDate(new Date(8.64e15).getDate()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setDate(new Date(8.64e15).getDate() + 1).valueOf()", "NaN");
+
+debug("Testing setMonth()");
+shouldBe("new Date(0).setMonth(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setMonth(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setMonth(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setMonth(new Date(8.64e15).getMonth()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setMonth(new Date(8.64e15).getMonth() + 1).valueOf()", "NaN");
+
+debug("Testing setFullYear()");
+shouldBe("new Date(0).setFullYear(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setFullYear(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setFullYear(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setFullYear(new Date(8.64e15).getFullYear()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setFullYear(new Date(8.64e15).getFullYear() + 1).valueOf()", "NaN");
+
+debug("Testing setUTCMilliseconds()");
+shouldBe("new Date(0).setUTCMilliseconds(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCMilliseconds(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCMilliseconds(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setUTCMilliseconds(new Date(8.64e15).getUTCMilliseconds()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setUTCMilliseconds(new Date(8.64e15).getUTCMilliseconds() + 1).valueOf()", "NaN");
+
+debug("Testing setUTCSeconds()");
+shouldBe("new Date(0).setUTCSeconds(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCSeconds(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCSeconds(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setUTCSeconds(new Date(8.64e15).getUTCSeconds()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setUTCSeconds(new Date(8.64e15).getUTCSeconds() + 1).valueOf()", "NaN");
+
+debug("Testing setUTCMinutes()");
+shouldBe("new Date(0).setUTCMinutes(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCMinutes(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCMinutes(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setUTCMinutes(new Date(8.64e15).getUTCMinutes()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setUTCMinutes(new Date(8.64e15).getUTCMinutes() + 1).valueOf()", "NaN");
+
+debug("Testing setUTCHours()");
+shouldBe("new Date(0).setUTCHours(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCHours(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCHours(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setUTCHours(new Date(8.64e15).getUTCHours()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setUTCHours(new Date(8.64e15).getUTCHours() + 1).valueOf()", "NaN");
+
+debug("Testing setUTCDate()");
+shouldBe("new Date(0).setUTCDate(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCDate(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCDate(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCDate(9e15 / (24 * 60 * 60 * 1000)).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setUTCDate(new Date(8.64e15).getUTCDate()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setUTCDate(new Date(8.64e15).getUTCDate() + 1).valueOf()", "NaN");
+
+debug("Testing setUTCMonth()");
+shouldBe("new Date(0).setUTCMonth(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCMonth(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCMonth(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setUTCMonth(new Date(8.64e15).getUTCMonth()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setUTCMonth(new Date(8.64e15).getUTCMonth() + 1).valueOf()", "NaN");
+
+debug("Testing setUTCFullYear()");
+shouldBe("new Date(0).setUTCFullYear(Infinity).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCFullYear(1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(0).setUTCFullYear(-1.79769e+308).valueOf()", "NaN");
+shouldBe("new Date(8.64e15).setUTCFullYear(new Date(8.64e15).getUTCFullYear()).valueOf()", "8.64e15");
+shouldBe("new Date(8.64e15).setUTCFullYear(new Date(8.64e15).getUTCFullYear() + 1).valueOf()", "NaN");

Modified: trunk/Source/_javascript_Core/ChangeLog (201585 => 201586)


--- trunk/Source/_javascript_Core/ChangeLog	2016-06-02 03:19:54 UTC (rev 201585)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-06-02 03:34:31 UTC (rev 201586)
@@ -1,3 +1,21 @@
+2016-06-01  Benjamin Poulain  <[email protected]>
+
+        [JSC] Some setters for components of Date do not timeClip() their result
+        https://bugs.webkit.org/show_bug.cgi?id=158278
+        rdar://problem/25131426
+
+        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):
+
 2016-06-01  Keith Miller  <[email protected]>
 
         canOptimizeStringObjectAccess should use ObjectPropertyConditions rather than structure watchpoints

Modified: trunk/Source/_javascript_Core/runtime/DatePrototype.cpp (201585 => 201586)


--- trunk/Source/_javascript_Core/runtime/DatePrototype.cpp	2016-06-02 03:19:54 UTC (rev 201585)
+++ trunk/Source/_javascript_Core/runtime/DatePrototype.cpp	2016-06-02 03:34:31 UTC (rev 201586)
@@ -918,8 +918,9 @@
         thisDateObj->setInternalValue(vm, result);
         return JSValue::encode(result);
     } 
-    
-    JSValue result = jsNumber(gregorianDateTimeToMS(vm, gregorianDateTime, ms, inputTimeType));
+
+    double newUTCDate = gregorianDateTimeToMS(vm, gregorianDateTime, ms, inputTimeType);
+    JSValue result = jsNumber(timeClip(newUTCDate));
     thisDateObj->setInternalValue(vm, result);
     return JSValue::encode(result);
 }
@@ -959,8 +960,9 @@
         thisDateObj->setInternalValue(vm, result);
         return JSValue::encode(result);
     } 
-           
-    JSValue result = jsNumber(gregorianDateTimeToMS(vm, gregorianDateTime, ms, inputTimeType));
+
+    double newUTCDate = gregorianDateTimeToMS(vm, gregorianDateTime, ms, inputTimeType);
+    JSValue result = jsNumber(timeClip(newUTCDate));
     thisDateObj->setInternalValue(vm, result);
     return JSValue::encode(result);
 }

Modified: trunk/Source/WTF/ChangeLog (201585 => 201586)


--- trunk/Source/WTF/ChangeLog	2016-06-02 03:19:54 UTC (rev 201585)
+++ trunk/Source/WTF/ChangeLog	2016-06-02 03:34:31 UTC (rev 201586)
@@ -1,3 +1,18 @@
+2016-06-01  Benjamin Poulain  <[email protected]>
+
+        [JSC] Some setters for components of Date do not timeClip() their result
+        https://bugs.webkit.org/show_bug.cgi?id=158278
+
+        Unreviewed.
+
+        * 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.
+
 2016-05-31  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r201363 and r201456.

Modified: trunk/Source/WTF/wtf/DateMath.cpp (201585 => 201586)


--- trunk/Source/WTF/wtf/DateMath.cpp	2016-06-02 03:19:54 UTC (rev 201585)
+++ trunk/Source/WTF/wtf/DateMath.cpp	2016-06-02 03:34:31 UTC (rev 201586)
@@ -357,7 +357,6 @@
     int product = (quotient) * 28;
 
     year += product;
-    ASSERT((year >= minYear && year <= maxYear) || (product - year == static_cast<int>(std::numeric_limits<double>::quiet_NaN())));
     return year;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to