Commit ecfaa4c3 authored by ggaren's avatar ggaren

Patch by Maks Orlovich, reviewed and landed by me.

        - http://bugzilla.opendarwin.org/show_bug.cgi?id=6267
        Fix Number.prototype.toFixed/toExponential(undefined)

        * kjs/number_object.cpp:
        (NumberProtoFunc::callAsFunction):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11807 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d28fe14b
2005-12-29 Geoffrey Garen <ggaren@apple.com>
Patch by Maks Orlovich, reviewed and landed by me.
- http://bugzilla.opendarwin.org/show_bug.cgi?id=6267
Fix Number.prototype.toFixed/toExponential(undefined)
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction):
2005-12-29 Geoffrey Garen <ggaren@apple.com>
Patch by Maks Orlovich, Reviewed and landed by me.
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=6266
- http://bugzilla.opendarwin.org/show_bug.cgi?id=6266
Minor object naming updates (to match Mozilla, KJS)
* kjs/number_object.cpp:
......
......@@ -160,6 +160,8 @@ JSValue *NumberProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, con
{
JSValue *fractionDigits = args[0];
double df = fractionDigits->toInteger(exec);
if (fractionDigits->isUndefined())
df = 0;
if (!(df >= 0 && df <= 20)) // true for NaN
return throwError(exec, RangeError, "toFixed() digits argument must be between 0 and 20");
int f = (int)df;
......@@ -205,7 +207,7 @@ JSValue *NumberProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, con
JSValue *fractionDigits = args[0];
double df = fractionDigits->toInteger(exec);
if (!(df >= 0 && df <= 20)) // true for NaN
if (!fractionDigits->isUndefined() && !(df >= 0 && df <= 20)) // true for NaN
return throwError(exec, RangeError, "toExponential() argument must between 0 and 20");
int f = (int)df;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment