mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
Fix to bug 17263: toPrecision when called with no arguments. r=shaver
This commit is contained in:
parent
8f84b13eb4
commit
4812888c28
@ -287,14 +287,14 @@ num_to(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval, JSDTo
|
||||
if (!js_ValueToNumber(cx, argv[0], &precision))
|
||||
return JS_FALSE;
|
||||
precision = js_DoubleToInteger(precision);
|
||||
}
|
||||
if (precision < precisionMin || precision > precisionMax) {
|
||||
numStr = JS_dtostr(buf, sizeof buf, DTOSTR_STANDARD, 0, precision);
|
||||
if (!numStr)
|
||||
JS_ReportOutOfMemory(cx);
|
||||
else
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PRECISION_RANGE, numStr);
|
||||
return JS_FALSE;
|
||||
if (precision < precisionMin || precision > precisionMax) {
|
||||
numStr = JS_dtostr(buf, sizeof buf, DTOSTR_STANDARD, 0, precision);
|
||||
if (!numStr)
|
||||
JS_ReportOutOfMemory(cx);
|
||||
else
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PRECISION_RANGE, numStr);
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
numStr = JS_dtostr(buf, sizeof buf, oneArgMode, (jsint)precision + precisionOffset, d);
|
||||
|
Loading…
Reference in New Issue
Block a user