--- old/modules/web/src/main/native/Source/WTF/wtf/DateMath.cpp 2016-01-13 11:54:35.835573520 +0530 +++ new/modules/web/src/main/native/Source/WTF/wtf/DateMath.cpp 2016-01-13 11:54:35.735573519 +0530 @@ -523,12 +523,10 @@ static inline double ymdhmsToSeconds(int year, long mon, long day, long hour, long minute, double second) { - double days = (day - 32075) - + floor(1461 * (year + 4800.0 + (mon - 14) / 12) / 4) - + 367 * (mon - 2 - (mon - 14) / 12 * 12) / 12 - - floor(3 * ((year + 4900.0 + (mon - 14) / 12) / 100) / 4) - - 2440588; - return ((days * hoursPerDay + hour) * minutesPerHour + minute) * secondsPerMinute + second; + int mday = firstDayOfMonth[isLeapYear(year)][mon - 1]; + double ydays = daysFrom1970ToYear(year); + + return (second + minute * secondsPerMinute + hour * secondsPerHour + (mday + day - 1 + ydays) * secondsPerDay); } // We follow the recommendation of RFC 2822 to consider all --- old/modules/web/src/test/java/test/javafx/scene/web/MiscellaneousTest.java 2016-01-13 11:54:36.155573524 +0530 +++ new/modules/web/src/test/java/test/javafx/scene/web/MiscellaneousTest.java 2016-01-13 11:54:36.035573523 +0530 @@ -103,12 +103,26 @@ @Test public void testRT26306() { loadContent( ""); + "var s = '0123456789abcdef';\n" + + "while (true) {\n" + + " alert(s.length);\n" + + " s = s + s;\n" + + "}\n" + + ""); + } + + @Test public void testJavaScriptDateParser() { + // JDK-8146898 : Date object parsing failure + submit(() -> { + String dateFromString = (String) getEngine(). + executeScript("(new Date('December 31, 2034 23:59:59')).toUTCString()"); + + String dateFromInt = (String) getEngine(). + executeScript("(new Date(2034, 11, 31, 23, 59, 59)).toUTCString()"); + + assertEquals("JavaScript Date object parsing from String and Integer", + true, dateFromString.equalsIgnoreCase(dateFromInt)); + }); } private WebEngine createWebEngine() {