diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-01-06 16:25:17 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-01-07 14:11:46 +0100 |
commit | 49cf23bd2a14e2ca7236b261d7960588f07f5a0b (patch) | |
tree | 33cb2040f266d2e72e114e3a08a2ade1d6b4af37 /tests/auto/qml/qjsengine | |
parent | b7ce1395998464b2f27e4973992b5f7447b34a49 (diff) |
QV4: Array.includes: Support large arrays
Creating new ScopedValues in the loop was quite wasteful, and would
trigger a crash. We now simply reuse the ScopedValue.
Fixes: QTBUG-81104
Change-Id: Ie1efd144886861a21c8f6827d7fd23699a1e0dcc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qjsengine')
-rw-r--r-- | tests/auto/qml/qjsengine/tst_qjsengine.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index e59114a327..56d2ce8730 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -257,6 +257,7 @@ private slots: void compileBrokenRegexp(); void tostringRecursionCheck(); + void arrayIncludesWithLargeArray(); public: Q_INVOKABLE QJSValue throwingCppMethod1(); @@ -5042,6 +5043,17 @@ void tst_QJSEngine::tostringRecursionCheck() QCOMPARE(value.toString(), QLatin1String("RangeError: Maximum call stack size exceeded.")); } +void tst_QJSEngine::arrayIncludesWithLargeArray() +{ + QJSEngine engine; + auto value = engine.evaluate(R"js( + let arr = new Array(10000000) + arr.includes(42) + )js"); + QVERIFY(value.isBool()); + QCOMPARE(value.toBool(), false); +} + QTEST_MAIN(tst_QJSEngine) #include "tst_qjsengine.moc" |