diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-07-27 13:24:15 (GMT) |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-07-27 16:23:37 (GMT) |
commit | da769c4d4bd890e98173baf406f5455052f09c1f (patch) | |
tree | 60891add8ae8468e571abb25978f6abb519bf360 | |
parent | 3d0721b71bbec26a47fd1f909b373fc2cf46bc9e (diff) | |
download | Qt-da769c4d4bd890e98173baf406f5455052f09c1f.zip Qt-da769c4d4bd890e98173baf406f5455052f09c1f.tar.gz Qt-da769c4d4bd890e98173baf406f5455052f09c1f.tar.bz2 |
Fix tst_QScriptExtQObject::objectDeleted()
Fix tst_QScriptExtQObject::objectDeleted(), the exception generated
in the JSC script engine needs to be stored in uncaughtException of
QScriptEngine.
Reviewed-by: Kent Hansen
-rw-r--r-- | src/script/bridge/qscriptqobject.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qscriptqobject/tst_qscriptqobject.cpp | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index d903efd..43c97aa 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -1248,11 +1248,12 @@ void QObjectDelegate::put(QScriptObject *object, JSC::ExecState* exec, JSC::JSValue value, JSC::PutPropertySlot &slot) { QByteArray name = qtStringFromJSCUString(propertyName.ustring()).toLatin1(); + QScriptEnginePrivate *const eng = static_cast<QScript::GlobalObject*>(exec->lexicalGlobalObject())->engine; QObject *qobject = data->value; if (!qobject) { QString message = QString::fromLatin1("cannot access member `%0' of deleted QObject") .arg(QString::fromLatin1(name)); - JSC::throwError(exec, JSC::GeneralError, qtStringToJSCUString(message)); + eng->uncaughtException = JSC::throwError(exec, JSC::GeneralError, qtStringToJSCUString(message)); return; } diff --git a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp index c456f1c..acabd4d 100644 --- a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp +++ b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp @@ -2839,11 +2839,8 @@ void tst_QScriptExtQObject::objectDeleted() eng.evaluate("Object"); QVERIFY(!eng.hasUncaughtException()); v.setProperty("objectName", QScriptValue(&eng, "foo")); - QEXPECT_FAIL("", "Attempt to set property of deleted QObject should throw error", Continue); QVERIFY(eng.hasUncaughtException()); - QEXPECT_FAIL("", "Attempt to set property of deleted QObject should throw error", Continue); QVERIFY(eng.uncaughtException().isError()); - QEXPECT_FAIL("", "Attempt to set property of deleted QObject should throw error", Continue); QCOMPARE(eng.uncaughtException().toString(), QLatin1String("Error: cannot access member `objectName' of deleted QObject")); } |