RESOLVED FIXED 70998
Date constructor handles infinite values incorrectly.
https://bugs.webkit.org/show_bug.cgi?id=70998
Summary Date constructor handles infinite values incorrectly.
mstarzinger
Reported 2011-10-27 01:26:04 PDT
For cases in which the time value of a Date object is not a finite number, Date.prototype.toISOString() should throw a RangeError exception. This can either be reproduced by several Test262 test cases (i.e. 15.9.5.43-0-*) or with the following JavaScript snippet. function test() { var date = new Date(Infinity, 1, 70, 0, 0, 0); try { date.toISOString(); return false; } catch (e) { return e instanceof RangeError; } }
Attachments
Alexey Proskuryakov
Comment 1 2011-10-27 10:27:11 PDT
Sounds much like bug 70394, but still happens in ToT.
Sam Weinig
Comment 2 2011-10-27 11:15:57 PDT
(In reply to comment #1) > Sounds much like bug 70394, but still happens in ToT. It is a different code path due to the Data constructor having different defined behavior when passing one argument, and two or more.
Gavin Barraclough
Comment 3 2011-10-31 00:12:42 PDT
To clarify Sam's comment, the issue re RangeErrors was fixed last week, in bug #70394 - the bug here is different. The problem is not in toISOString, but rather in the call to new Date. The test case assumes that the newly constructed Date has a NaN internal value; the bug is that it does not. You can demonstrate that toISOString behaved correctly by changing the arguments to new Date to ("") (which does correctly produce a Date with a NaN internal value). Retitling the bug accordingly.
Gavin Barraclough
Comment 4 2012-01-05 21:29:45 PST
Fixed in r104267
Note You need to log in before you can comment on or make changes to this bug.