From 36be27265d61c76b25417a25e482030e30ff380f Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Fri, 20 Sep 2019 16:38:30 +0200 Subject: QMLJS: Fix exception handling in promises If an exception is thrown inside a promise's resolve or reject handler, the promise needs to resolve into a rejected state with the exceptions value. The value was previously not set. Fixes: QTBUG-78554 Change-Id: Ic22faa6ef1e519e4cae6732c69bb14f7053d13da Reviewed-by: Ulf Hermann Reviewed-by: Qt CI Bot --- src/qml/jsruntime/qv4promiseobject.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/qml') diff --git a/src/qml/jsruntime/qv4promiseobject.cpp b/src/qml/jsruntime/qv4promiseobject.cpp index 40a0dfaa57..851fee7bd8 100644 --- a/src/qml/jsruntime/qv4promiseobject.cpp +++ b/src/qml/jsruntime/qv4promiseobject.cpp @@ -163,6 +163,7 @@ void ReactionHandler::executeReaction(ReactionEvent *event) ScopedFunctionObject reaction(scope); if (scope.hasException()) { reaction = capability->d()->reject.as(); + result = scope.engine->catchException(); } else { reaction = capability->d()->resolve.as(); } -- cgit v1.2.3