summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/qmlsqldatabase.cpp7
-rw-r--r--tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml2
-rw-r--r--tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp19
3 files changed, 18 insertions, 10 deletions
diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp
index 4fa63cb..684caa2 100644
--- a/src/declarative/qml/qmlsqldatabase.cpp
+++ b/src/declarative/qml/qmlsqldatabase.cpp
@@ -44,7 +44,7 @@
#include "qmlengine.h"
#include "qmlengine_p.h"
#include "qmlrefcount_p.h"
-#include "qmlexpression_p.h"
+#include "qmlengine_p.h"
#include <QtCore/qobject.h>
#include <QtScript/qscriptvalue.h>
@@ -199,7 +199,6 @@ static QScriptValue qmlsqldatabase_item(QScriptContext *context, QScriptEngine *
static QScriptValue qmlsqldatabase_executeSql_outsidetransaction(QScriptContext *context, QScriptEngine * /*engine*/)
{
- qDebug() << QmlEngine::tr("executeSql called outside transaction()"); // XXX pending bug QTBUG-6507
THROW_SQL(DATABASE_ERR,QmlEngine::tr("executeSql called outside transaction()"));
}
@@ -319,10 +318,6 @@ static QScriptValue qmlsqldatabase_transaction_shared(QScriptContext *context, Q
instance.setProperty(QLatin1String("executeSql"),
engine->newFunction(qmlsqldatabase_executeSql_outsidetransaction));
if (engine->hasUncaughtException()) {
- QmlError error;
- QmlExpressionPrivate::exceptionToError(engine, error);
- qWarning() << error;
- engine->clearExceptions();
db.rollback();
} else {
if (!db.commit())
diff --git a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml b/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml
index 44722a9..acc3163 100644
--- a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml
+++ b/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml
@@ -3,6 +3,6 @@ import Qt.test 1.0
MyQmlObject {
Component.onCompleted:
- { throw(123,"JS exception") }
+ { throw(new Error("JS exception")) }
}
diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
index 6f7832a..a153296 100644
--- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
+++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
@@ -106,7 +106,8 @@ private slots:
void signalTriggeredBindings();
void listProperties();
void exceptionClearsOnReeval();
- void exceptionProducesWarning();
+ void exceptionSlotProducesWarning();
+ void exceptionBindingProducesWarning();
void transientErrors();
void shutdownErrors();
void externalScript();
@@ -933,12 +934,24 @@ void tst_qmlecmascript::exceptionClearsOnReeval()
QCOMPARE(object->property("test").toBool(), true);
}
-void tst_qmlecmascript::exceptionProducesWarning()
+void tst_qmlecmascript::exceptionSlotProducesWarning()
{
QmlComponent component(&engine, TEST_FILE("exceptionProducesWarning.qml"));
QString url = component.url().toString();
- QString warning = "Expected error - QTBUG-6507";
+ QString warning = component.url().toString() + ":6: Error: JS exception";
+
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+}
+
+void tst_qmlecmascript::exceptionBindingProducesWarning()
+{
+ QmlComponent component(&engine, TEST_FILE("exceptionProducesWarning2.qml"));
+ QString url = component.url().toString();
+
+ QString warning = component.url().toString() + ":5: Error: JS exception";
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());