diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-28 14:28:36 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-28 15:38:55 (GMT) |
commit | ffeb75fe970dadbf2b5e5a96bc63ba0a53fb6be5 (patch) | |
tree | 4b366cc9bac8e8609c71f4671b32c574e0ce4639 /tests | |
parent | 4efaf156223cd12f799164a479929f78a9b5db95 (diff) | |
download | Qt-ffeb75fe970dadbf2b5e5a96bc63ba0a53fb6be5.zip Qt-ffeb75fe970dadbf2b5e5a96bc63ba0a53fb6be5.tar.gz Qt-ffeb75fe970dadbf2b5e5a96bc63ba0a53fb6be5.tar.bz2 |
QScript: Fix strange bugs and crashes.
I was assuming that the default return value register was always set
to 0 for native calls. But this is not the case. So we must ensure this.
Also be consistend in the way the stackframe grow and shrink. This expose
another bug in the way the call frame is created in JSC
Reviewed-by: Kent Hansen
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index 063075d..461c994 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -724,6 +724,31 @@ void tst_QScriptContext::backtrace_data() QTest::newRow("call native") << source << expected; } + + { + QLatin1String func( "function f1() {\n" + " eval('var q = 4');\n" + " return custom_call(bt, 22);\n" + "}"); + + QString source = QString::fromLatin1("\n" + "function f2() {\n" + " func = %1\n" + " return custom_call(func, 12);\n" + "}\n" + "f2();\n").arg(func); + + QStringList expected; + expected << "<native>(22) at -1" + << "<native>(function () {\n [native code]\n}, 22) at -1" + << "f1(12) at testfile:5" + << QString::fromLatin1("<native>(%1, 12) at -1").arg(func) + << "f2() at testfile:7" + << "<global>() at testfile:9"; + + + QTest::newRow("calls with closures") << source << expected; + } } |