Fix String.prototype.substring when called with undefined end value
authorSimon Hausmann <simon.hausmann@digia.com>
Tue, 22 Jan 2013 11:28:43 +0000 (12:28 +0100)
committerLars Knoll <lars.knoll@digia.com>
Tue, 22 Jan 2013 14:12:44 +0000 (15:12 +0100)
Change-Id: Id5c9563d492c5a15881cb4190dc9e8cd20284d31
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
qv4stringobject.cpp
tests/TestExpectations

index c2063fc..178c625 100644 (file)
@@ -622,8 +622,9 @@ Value StringPrototype::method_substring(ExecutionContext *ctx)
     if (ctx->argumentCount > 0)
         start = ctx->argument(0).toInteger(ctx);
 
-    if (ctx->argumentCount > 1)
-        end = ctx->argument(1).toInteger(ctx);
+    Value endValue = ctx->argument(1);
+    if (!endValue.isUndefined())
+        end = endValue.toInteger(ctx);
 
     if (std::isnan(start) || start < 0)
         start = 0;
index fe7f7b8..a5a9f02 100644 (file)
@@ -542,10 +542,6 @@ S15.4.4.8_A4_T1 failing
 S15.4.4.8_A4_T2 failing
 S15.5.4.13_A2_T2 failing
 S15.5.4.13_A3_T3 failing
-S15.5.4.15_A1_T2 failing
-S15.5.4.15_A1_T7 failing
-S15.5.4.15_A1_T8 failing
-S15.5.4.15_A1_T9 failing
 15.5.4.20-4-1 failing
 S15.5.4.8_A1_T4 failing
 S15.7.4.5_A1.4_T01 failing
@@ -730,4 +726,4 @@ S15.4.4.4_A1_T2 failing
 
 15.4.4.21-8-b-iii-1-6 failing
 15.12.3_4-1-1
-15.12.3_4-1-3
+15.12.3_4-1-3
\ No newline at end of file