summaryrefslogtreecommitdiff
path: root/tests/auto/v8/v8test.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-05-31 13:48:10 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-05-31 13:48:10 +0200
commit6f2625e0e0e2818af6fdeb69528ada18556daef2 (patch)
tree4c4fe8c355c57c579d8ab5816c027a3ccd59360a /tests/auto/v8/v8test.cpp
parentfb6c137d548bf0752d9e3740f96e6fa61addf3c0 (diff)
parent7d469e82e274d334c7d03d81b10d225c59d30798 (diff)
downloadqtjsbackend-6f2625e0e0e2818af6fdeb69528ada18556daef2.tar.gz
Merge remote-tracking branch 'origin/release' into stable
Change-Id: Ic0daef1ae2cd8d9dc9e4e1597d730a42ad00c7b1
Diffstat (limited to 'tests/auto/v8/v8test.cpp')
-rw-r--r--tests/auto/v8/v8test.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/v8/v8test.cpp b/tests/auto/v8/v8test.cpp
index 6621846..6429cd7 100644
--- a/tests/auto/v8/v8test.cpp
+++ b/tests/auto/v8/v8test.cpp
@@ -1210,3 +1210,37 @@ cleanup:
ENDTEST();
}
+
+// test for https://bugreports.qt-project.org/browse/QTBUG-31366
+// assert/crash when inlining local functions in qml mode
+bool v8test_qmlmodeinlinelocal()
+{
+ BEGINTEST();
+
+ HandleScope handle_scope;
+ Persistent<Context> context = Context::New();
+ Context::Scope context_scope(context);
+
+ Local<Object> qmlglobal = Object::New();
+
+ Local<String> source = String::New(
+ "function func() {"
+ "function local_function () {"
+ "}"
+ // high enough to get it to opt; 10000 seems to be too low
+ "for (var i = 0; i < 100000; ++i) local_function();"
+ "}"
+ "func();"
+ );
+
+ Local<Script> script = Script::Compile(source, NULL, NULL, Handle<String>(), Script::QmlMode);
+
+ TryCatch tc;
+ script->Run(qmlglobal);
+ VERIFY(!tc.HasCaught());
+
+cleanup:
+ context.Dispose();
+
+ ENDTEST();
+}