aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 296471692c..d4829e587e 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -308,7 +308,7 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
return Encode(newLen);
}
- if (!instance->protoHasArray() && instance->arrayDataLen <= len) {
+ if (!instance->protoHasArray() && instance->arrayDataLen <= len && (instance->flags & SimpleArray)) {
for (int i = 0; i < ctx->callData->argc; ++i) {
if (!instance->sparseArray) {
if (len >= instance->arrayAlloc)
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
index 8d08cc5559..8847055a70 100644
--- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
@@ -141,6 +141,15 @@ Item {
expected = 7;
if (poppedVal != expected) success = false;
+ // push
+ msco.stringListProperty = [ "one", "two" ]
+ msco.stringListProperty.push("three")
+ expected = [ "one", "two", "three" ]
+ if (msco.stringListProperty.toString() != expected.toString()) success = false;
+ msco.stringListProperty.push("four", "five")
+ expected = [ "one", "two", "three", "four", "five" ]
+ if (msco.stringListProperty.toString() != expected.toString()) success = false;
+
// concat
msco.stringListProperty = [ "one", "two" ]
stringList = [ "hello", "world" ]