aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsengine
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-06-14 01:01:31 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-06-14 09:50:21 +0200
commit82ca44ca1a4abb2bcfee5f8ff41df72d02cf4491 (patch)
tree1795638fbf3ad02c16a69dd69efb8738976f7a07 /tests/auto/qml/qjsengine
parent6d5a0a55d862c78b185a077171a0b46a94d5a599 (diff)
parent15b90204fa5126f339db551cf7429534f1359322 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: tests/auto/qml/qjsengine/tst_qjsengine.cpp Change-Id: I34df194046a91ee8a076ce28022eb99d68e7f362
Diffstat (limited to 'tests/auto/qml/qjsengine')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index c2459955b2..e08a1cc37e 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -244,6 +244,7 @@ private slots:
void equality();
void aggressiveGc();
+ void noAccumulatorInTemplateLiteral();
void interrupt_data();
void interrupt();
@@ -4840,6 +4841,23 @@ void tst_QJSEngine::aggressiveGc()
qputenv("QV4_MM_AGGRESSIVE_GC", origAggressiveGc);
}
+void tst_QJSEngine::noAccumulatorInTemplateLiteral()
+{
+ const QByteArray origAggressiveGc = qgetenv("QV4_MM_AGGRESSIVE_GC");
+ qputenv("QV4_MM_AGGRESSIVE_GC", "true");
+ {
+ QJSEngine engine;
+
+ // getTemplateLiteral should not save the accumulator as it's garbage and trashes
+ // the next GC run. Instead, we want to see the stack overflow error.
+ QJSValue value = engine.evaluate("function a(){\nS=o=>s\nFunction``\na()}a()");
+
+ QVERIFY(value.isError());
+ QCOMPARE(value.toString(), "RangeError: Maximum call stack size exceeded.");
+ }
+ qputenv("QV4_MM_AGGRESSIVE_GC", origAggressiveGc);
+}
+
void tst_QJSEngine::interrupt_data()
{
QTest::addColumn<int>("jitThreshold");