summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAriya Hidayat <ariya.hidayat@nokia.com>2009-07-15 15:09:51 (GMT)
committerAriya Hidayat <ariya.hidayat@nokia.com>2009-07-17 18:11:33 (GMT)
commit86d2d5d3a2568982468d19bfae3b19bfb6b42457 (patch)
tree82d59ead9617a387c73981199e8e3876a45ac7e9
parent7f04bc3a46d4dd5203b9776c102b487b283a6282 (diff)
downloadQt-86d2d5d3a2568982468d19bfae3b19bfb6b42457.zip
Qt-86d2d5d3a2568982468d19bfae3b19bfb6b42457.tar.gz
Qt-86d2d5d3a2568982468d19bfae3b19bfb6b42457.tar.bz2
Fix the return value of a function call that throws an error.
-rw-r--r--src/script/api/qscriptvalue.cpp4
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index c3c7c18..79c769a 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -1987,8 +1987,10 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject,
JSC::CallData callData;
JSC::CallType callType = callee.getCallData(callData);
JSC::JSValue result = JSC::call(exec, callee, callType, callData, jscThisObject, jscArgs);
- if (exec->hadException())
+ if (exec->hadException()) {
eng_p->uncaughtException = exec->exception();
+ result = exec->exception();
+ }
return eng_p->scriptValueFromJSCValue(result);
}
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 2eff71a..b0df6fd 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2354,10 +2354,8 @@ void tst_QScriptValue::call()
{
QScriptValue result = fun.call();
- QEXPECT_FAIL("", "Returns null if a function throws an error", Continue);
QCOMPARE(result.isError(), true);
QCOMPARE(eng.hasUncaughtException(), true);
- QEXPECT_FAIL("", "returns null if a function throws an error", Continue);
QVERIFY(result.strictlyEquals(eng.uncaughtException()));
}
}