<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[201586] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/201586">201586</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2016-06-01 20:34:31 -0700 (Wed, 01 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[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 &lt;bpoulain@apple.com&gt; 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 &lt;bpoulain@apple.com&gt; 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 &lt;= maxYear).
The weird NaN test is a mystery. The old changelog does not explain it.

LayoutTests:

rdar://problem/25131426

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; 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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeDatePrototypecpp">trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfDateMathcpp">trunk/Source/WTF/wtf/DateMath.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsdatetimeCliplargevaluesexpectedtxt">trunk/LayoutTests/js/date-timeClip-large-values-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdatetimeCliplargevalueshtml">trunk/LayoutTests/js/date-timeClip-large-values.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsdatetimeCliplargevaluesjs">trunk/LayoutTests/js/script-tests/date-timeClip-large-values.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (201585 => 201586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-06-02 03:19:54 UTC (rev 201585)
+++ trunk/LayoutTests/ChangeLog        2016-06-02 03:34:31 UTC (rev 201586)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-06-01  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [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.
+
</ins><span class="cx"> 2016-06-01  Chris Fleizach  &lt;cfleizach@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: iOS: VoiceOver can't access attachments in mail messages
</span></span></pre></div>
<a id="trunkLayoutTestsjsdatetimeCliplargevaluesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/date-timeClip-large-values-expected.txt (0 => 201586)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,105 @@
</span><ins>+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 &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+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
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdatetimeCliplargevalueshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/date-timeClip-large-values.html (0 => 201586)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/date-timeClip-large-values.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsdatetimeCliplargevaluesjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/date-timeClip-large-values.js (0 => 201586)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,112 @@
</span><ins>+description(&quot;Verify that changing a date with a delta that is too large for a date produces an invalid date/NaN&quot;);
+
+debug(&quot;Testing date creating at the max boundary&quot;);
+shouldBe(&quot;new Date(0).valueOf()&quot;, &quot;0&quot;);
+shouldBe(&quot;new Date(8.64e15) instanceof Date&quot;, &quot;true&quot;);
+shouldBe(&quot;new Date(8.64e15).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8640000000000001) instanceof Date&quot;, &quot;true&quot;);
+shouldBe(&quot;new Date(8640000000000001).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(Infinity) instanceof Date&quot;, &quot;true&quot;);
+shouldBe(&quot;new Date(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(-Infinity) instanceof Date&quot;, &quot;true&quot;);
+shouldBe(&quot;new Date(-Infinity).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setMilliseconds()&quot;);
+shouldBe(&quot;new Date(0).setMilliseconds(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setMilliseconds(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setMilliseconds(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setMilliseconds(new Date(8.64e15).getMilliseconds()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setMilliseconds(new Date(8.64e15).getMilliseconds() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setSeconds()&quot;);
+shouldBe(&quot;new Date(0).setSeconds(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setSeconds(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setSeconds(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setSeconds(new Date(8.64e15).getSeconds()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setSeconds(new Date(8.64e15).getSeconds() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setMinutes()&quot;);
+shouldBe(&quot;new Date(0).setMinutes(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setMinutes(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setMinutes(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setMinutes(new Date(8.64e15).getMinutes()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setMinutes(new Date(8.64e15).getMinutes() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setHours()&quot;);
+shouldBe(&quot;new Date(0).setHours(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setHours(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setHours(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setHours(new Date(8.64e15).getHours()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setHours(new Date(8.64e15).getHours() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setDate()&quot;);
+shouldBe(&quot;new Date(0).setDate(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setDate(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setDate(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setDate(9e15 / (24 * 60 * 60 * 1000)).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setDate(new Date(8.64e15).getDate()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setDate(new Date(8.64e15).getDate() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setMonth()&quot;);
+shouldBe(&quot;new Date(0).setMonth(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setMonth(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setMonth(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setMonth(new Date(8.64e15).getMonth()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setMonth(new Date(8.64e15).getMonth() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setFullYear()&quot;);
+shouldBe(&quot;new Date(0).setFullYear(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setFullYear(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setFullYear(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setFullYear(new Date(8.64e15).getFullYear()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setFullYear(new Date(8.64e15).getFullYear() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setUTCMilliseconds()&quot;);
+shouldBe(&quot;new Date(0).setUTCMilliseconds(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCMilliseconds(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCMilliseconds(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCMilliseconds(new Date(8.64e15).getUTCMilliseconds()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCMilliseconds(new Date(8.64e15).getUTCMilliseconds() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setUTCSeconds()&quot;);
+shouldBe(&quot;new Date(0).setUTCSeconds(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCSeconds(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCSeconds(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCSeconds(new Date(8.64e15).getUTCSeconds()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCSeconds(new Date(8.64e15).getUTCSeconds() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setUTCMinutes()&quot;);
+shouldBe(&quot;new Date(0).setUTCMinutes(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCMinutes(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCMinutes(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCMinutes(new Date(8.64e15).getUTCMinutes()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCMinutes(new Date(8.64e15).getUTCMinutes() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setUTCHours()&quot;);
+shouldBe(&quot;new Date(0).setUTCHours(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCHours(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCHours(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCHours(new Date(8.64e15).getUTCHours()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCHours(new Date(8.64e15).getUTCHours() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setUTCDate()&quot;);
+shouldBe(&quot;new Date(0).setUTCDate(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCDate(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCDate(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCDate(9e15 / (24 * 60 * 60 * 1000)).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCDate(new Date(8.64e15).getUTCDate()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCDate(new Date(8.64e15).getUTCDate() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setUTCMonth()&quot;);
+shouldBe(&quot;new Date(0).setUTCMonth(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCMonth(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCMonth(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCMonth(new Date(8.64e15).getUTCMonth()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCMonth(new Date(8.64e15).getUTCMonth() + 1).valueOf()&quot;, &quot;NaN&quot;);
+
+debug(&quot;Testing setUTCFullYear()&quot;);
+shouldBe(&quot;new Date(0).setUTCFullYear(Infinity).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCFullYear(1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(0).setUTCFullYear(-1.79769e+308).valueOf()&quot;, &quot;NaN&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCFullYear(new Date(8.64e15).getUTCFullYear()).valueOf()&quot;, &quot;8.64e15&quot;);
+shouldBe(&quot;new Date(8.64e15).setUTCFullYear(new Date(8.64e15).getUTCFullYear() + 1).valueOf()&quot;, &quot;NaN&quot;);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (201585 => 201586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-06-02 03:19:54 UTC (rev 201585)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-06-02 03:34:31 UTC (rev 201586)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-06-01  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [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):
+
</ins><span class="cx"> 2016-06-01  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         canOptimizeStringObjectAccess should use ObjectPropertyConditions rather than structure watchpoints
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDatePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp (201585 => 201586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp        2016-06-02 03:19:54 UTC (rev 201585)
+++ trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp        2016-06-02 03:34:31 UTC (rev 201586)
</span><span class="lines">@@ -918,8 +918,9 @@
</span><span class="cx">         thisDateObj-&gt;setInternalValue(vm, result);
</span><span class="cx">         return JSValue::encode(result);
</span><span class="cx">     } 
</span><del>-    
-    JSValue result = jsNumber(gregorianDateTimeToMS(vm, gregorianDateTime, ms, inputTimeType));
</del><ins>+
+    double newUTCDate = gregorianDateTimeToMS(vm, gregorianDateTime, ms, inputTimeType);
+    JSValue result = jsNumber(timeClip(newUTCDate));
</ins><span class="cx">     thisDateObj-&gt;setInternalValue(vm, result);
</span><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="lines">@@ -959,8 +960,9 @@
</span><span class="cx">         thisDateObj-&gt;setInternalValue(vm, result);
</span><span class="cx">         return JSValue::encode(result);
</span><span class="cx">     } 
</span><del>-           
-    JSValue result = jsNumber(gregorianDateTimeToMS(vm, gregorianDateTime, ms, inputTimeType));
</del><ins>+
+    double newUTCDate = gregorianDateTimeToMS(vm, gregorianDateTime, ms, inputTimeType);
+    JSValue result = jsNumber(timeClip(newUTCDate));
</ins><span class="cx">     thisDateObj-&gt;setInternalValue(vm, result);
</span><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (201585 => 201586)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-06-01  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [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 &lt;= maxYear).
+        The weird NaN test is a mystery. The old changelog does not explain it.
+
</ins><span class="cx"> 2016-05-31  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r201363 and r201456.
</span></span></pre></div>
<a id="trunkSourceWTFwtfDateMathcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/DateMath.cpp (201585 => 201586)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -357,7 +357,6 @@
</span><span class="cx">     int product = (quotient) * 28;
</span><span class="cx"> 
</span><span class="cx">     year += product;
</span><del>-    ASSERT((year &gt;= minYear &amp;&amp; year &lt;= maxYear) || (product - year == static_cast&lt;int&gt;(std::numeric_limits&lt;double&gt;::quiet_NaN())));
</del><span class="cx">     return year;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>