While the length property was reporting the correct value, the internal array
length was out-of-sync.
Task-number: QTBUG-35979
Change-Id: I68820a349cf1ce88c6aabc6a2301a8a861018a10
Reviewed-by: Liang Qi <liang.qi@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
if (scope.hasException())
return Encode::undefined();
if (instance->isArrayObject())
- instance->setArrayLengthUnchecked(len - 1);
+ instance->setArrayLength(len - 1);
else
instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - 1)));
return result.asReturnedValue();
void threadedEngine();
void functionDeclarationsInConditionals();
+
+ void arrayPop_QTBUG_35979();
};
tst_QJSEngine::tst_QJSEngine()
QCOMPARE(result.toBool(), true);
}
+void tst_QJSEngine::arrayPop_QTBUG_35979()
+{
+ QJSEngine eng;
+ QJSValue result = eng.evaluate(""
+ "var x = [1, 2]\n"
+ "x.pop()\n"
+ "x[1] = 3\n"
+ "x.toString()\n");
+ QCOMPARE(result.toString(), QString("1,3"));
+}
+
QTEST_MAIN(tst_QJSEngine)
#include "tst_qjsengine.moc"