From df0ec196031d33850324dc5eeed2d71f61413885 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 15 Aug 2012 11:46:23 +0200 Subject: Make QScriptEngine::uncaughtExceptionBacktrace() work again This function has been broken since Qt 4.6 (when the JavaScriptCore- based back-end was introduced). Fix it by introducing a callback in JSC that allows us to capture the stack when an uncaught exception occurs. Task-number: QTBUG-6139 Change-Id: I4a829323c9fb0c8b2f16a2e5d6f0aeb13cc32561 Reviewed-by: Olivier Goffart --- tests/auto/qscriptengine/tst_qscriptengine.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index dc81cdb..6d7540f 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -3057,20 +3057,19 @@ void tst_QScriptEngine::stacktrace() const QString fileName("testfile"); QStringList backtrace; - backtrace << "foo(5)@testfile:9" - << "foo(4)@testfile:7" - << "foo(3)@testfile:6" - << "foo(2)@testfile:5" - << "foo(1)@testfile:4" - << "foo(0)@testfile:3" - << "()@testfile:12"; + backtrace << "foo(counter = 5) at testfile:9" + << "foo(counter = 4) at testfile:7" + << "foo(counter = 3) at testfile:6" + << "foo(counter = 2) at testfile:5" + << "foo(counter = 1) at testfile:4" + << "foo(counter = 0) at testfile:3" + << "() at testfile:12"; QScriptEngine eng; QScriptValue result = eng.evaluate(script, fileName); QVERIFY(eng.hasUncaughtException()); QVERIFY(result.isError()); - QEXPECT_FAIL("", "QTBUG-6139: uncaughtExceptionBacktrace() doesn't give the full backtrace", Abort); QCOMPARE(eng.uncaughtExceptionBacktrace(), backtrace); QVERIFY(eng.hasUncaughtException()); QVERIFY(result.strictlyEquals(eng.uncaughtException())); -- cgit v1.2.1