Fix a few bugs in Number.prototype
authorLars Knoll <lars.knoll@digia.com>
Mon, 21 Jan 2013 21:34:02 +0000 (22:34 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Mon, 21 Jan 2013 21:57:32 +0000 (22:57 +0100)
Change-Id: I1ab95c019b628c3e298f88ea8d5b7f8b4d560aee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
qv4numberobject.cpp
tests/TestExpectations

index 1926e5a..10ab037 100644 (file)
@@ -87,7 +87,7 @@ void NumberPrototype::init(ExecutionContext *ctx, const Value &ctor)
 
     defineDefaultProperty(ctx, QStringLiteral("constructor"), ctor);
     defineDefaultProperty(ctx, QStringLiteral("toString"), method_toString);
-    defineDefaultProperty(ctx, QStringLiteral("toLocalString"), method_toLocaleString);
+    defineDefaultProperty(ctx, QStringLiteral("toLocaleString"), method_toLocaleString);
     defineDefaultProperty(ctx, QStringLiteral("valueOf"), method_valueOf);
     defineDefaultProperty(ctx, QStringLiteral("toFixed"), method_toFixed, 1);
     defineDefaultProperty(ctx, QStringLiteral("toExponential"), method_toExponential);
@@ -185,6 +185,9 @@ Value NumberPrototype::method_toFixed(ExecutionContext *ctx)
     if (std::isnan(fdigits))
         fdigits = 0;
 
+    if (fdigits < 0 || fdigits > 20)
+        ctx->throwRangeError(ctx->thisObject);
+
     double v = thisObject->value.asDouble();
     QString str;
     if (std::isnan(v))
index 8143b46..e7c2e66 100644 (file)
@@ -516,7 +516,6 @@ S15.1.3.2_A5.3 failing
 15.2.3.3-4-13 failing
 15.2.3.3-4-51 failing
 15.2.3.3-4-9 failing
-15.2.3.3-4-90 failing
 15.2.3.6-2-17-1 failing
 15.2.3.5-4-315 failing
 15.2.3.6-4-291-1 failing
@@ -745,9 +744,6 @@ S15.5.4.15_A1_T9 failing
 S15.5.4.7_A1_T11 failing
 S15.5.4.8_A1_T12 failing
 S15.5.4.8_A1_T4 failing
-S15.7.4_A3.3 failing
-S15.7.4.5_A1.3_T01 failing
-S15.7.4.5_A1.3_T02 failing
 S15.7.4.5_A1.4_T01 failing
 6.4_c failing
 8.0_L15 failing
@@ -862,7 +858,6 @@ S15.7.4.5_A1.4_T01 failing
 12.4_a failing
 13.1.1_6 failing
 13.1.1_7 failing
-13.2.1_1 failing
 13.2.1_4 failing
 13.2.1_5 failing
 13.3.0_2 failing