diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-04-20 10:28:31 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-04-21 20:10:59 +0200 |
commit | f31a2dc6fc713ee06ea7a9ba45c3ceaace7d735d (patch) | |
tree | 6682724ad9ac2aa07310e89b5144ddcf9e4716ad /src/qml | |
parent | 239a90b8d5588bc6536cb81bbba7af8cc049d945 (diff) |
Check in even more places for exceptions
Amends commit 4c5ed04e64ea9ac0038ae30e1189cfe745b29bd9
Task-number: QTBUG-83384
Pick-to: 5.15 5.12
Change-Id: I0918c27dfa73dff83cbf0f58b41ce8620dff8a0a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4arraydata.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4globalobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4sequenceobject.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 3 |
4 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp index 1c587d2367..0eea3345c5 100644 --- a/src/qml/jsruntime/qv4arraydata.cpp +++ b/src/qml/jsruntime/qv4arraydata.cpp @@ -654,6 +654,8 @@ bool ArrayElementLessThan::operator()(Value v1, Value v2) const jsCallData->args[0] = v1; jsCallData->args[1] = v2; result = o->call(jsCallData); + if (scope.hasException()) + return false; return result->toNumber() < 0; } diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index bb81fb52d4..1b47620572 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -372,12 +372,12 @@ ReturnedValue EvalFunction::evalCall(const Value *, const Value *argv, int argc, if (function->isStrict() || isStrict) { ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function)); ScopedValue thisObject(scope, directCall ? scope.engine->currentStackFrame->thisObject() : scope.engine->globalObject->asReturnedValue()); - return e->call(thisObject, nullptr, 0); + return checkedResult(v4, e->call(thisObject, nullptr, 0)); } ScopedValue thisObject(scope, scope.engine->currentStackFrame->thisObject()); - return function->call(thisObject, nullptr, 0, ctx); + return checkedResult(v4, function->call(thisObject, nullptr, 0, ctx)); } diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index ee42342bf2..9e5bb7cc2f 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -451,6 +451,8 @@ public: argv[0] = convertElementToValue(m_v4, lhs); argv[1] = convertElementToValue(m_v4, rhs); QV4::ScopedValue result(scope, compare->call(m_v4->globalObject, argv, 2)); + if (scope.engine->hasException) + return false; return result->toNumber() < 0; } diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 209a1b4e76..bf098fef26 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -571,7 +571,7 @@ ReturnedValue StringPrototype::method_match(const FunctionObject *b, const Value ScopedFunctionObject fo(scope, f); if (!fo) return scope.engine->throwTypeError(); - return fo->call(r, thisObject, 1); + return checkedResult(scope.engine, fo->call(r, thisObject, 1)); } } @@ -862,6 +862,7 @@ ReturnedValue StringPrototype::method_replace(const FunctionObject *b, const Val Value that = Value::undefinedValue(); replacement = searchCallback->call(&that, arguments, numCaptures + 2); + CHECK_EXCEPTION(); result += string.midRef(lastEnd, matchStart - lastEnd); result += replacement->toQString(); lastEnd = matchEnd; |