Bug 649575 - Date.prototype.toISOString must throw a RangeError for non-finite dates. r=jwalden
This commit is contained in:
@@ -2047,10 +2047,16 @@ date_utc_format(JSContext *cx, Value *vp,
|
||||
return false;
|
||||
|
||||
char buf[100];
|
||||
if (!JSDOUBLE_IS_FINITE(utctime))
|
||||
if (!JSDOUBLE_IS_FINITE(utctime)) {
|
||||
if (printFunc == print_iso_string) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INVALID_DATE);
|
||||
return false;
|
||||
}
|
||||
|
||||
JS_snprintf(buf, sizeof buf, js_NaN_date_str);
|
||||
else
|
||||
} else {
|
||||
(*printFunc)(buf, sizeof buf, utctime);
|
||||
}
|
||||
|
||||
JSString *str = JS_NewStringCopyZ(cx, buf);
|
||||
if (!str)
|
||||
|
||||
Reference in New Issue
Block a user