aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-01-27 10:07:28 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-01-27 10:54:18 +0100
commitb7bbdf7e7d13eddf0ba9145d2671ff13aca6000d (patch)
treeed09263364e4739e27d16da51c92b69e54a8801b /tests
parenta34f92703333ce9eb6fae91891c34b478d73365f (diff)
V4: Store instruction pointer before CmpIn
The "in" operator may throw an exception. Change-Id: I7d0b6e2212ac6ec237fbf14719349f8e23810028 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 86bd32ccbe..5f5f30a307 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -400,6 +400,7 @@ private slots:
void proxyIteration();
void proxyHandlerTraps();
void gcCrashRegressionTest();
+ void cmpInThrows();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -9693,6 +9694,18 @@ void tst_qqmlecmascript::proxyHandlerTraps()
QVERIFY(value.isString() && value.toString() == QStringLiteral("SUCCESS"));
}
+void tst_qqmlecmascript::cmpInThrows()
+{
+ QJSEngine engine;
+ QStringList stacktrace;
+ QJSValue value = engine.evaluate(QStringLiteral("\n\n'foo' in 1"), QStringLiteral("foo.js"), 12,
+ &stacktrace);
+ QVERIFY(value.isError());
+ QCOMPARE(value.errorType(), QJSValue::TypeError);
+ QVERIFY(!stacktrace.isEmpty());
+ QCOMPARE(stacktrace.at(0), QStringLiteral("%entry:14:-1:file:foo.js"));
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"