aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2020-04-01 08:06:30 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2020-04-02 16:33:41 +0200
commit63bf6ac4c483cc64b48c410c6e1afb404f2bcbd1 (patch)
tree1146ff458281a538847980470da9ceace8654e79 /src/qml/jsruntime
parent19850f129881a04c36c51859454bf71ed688f28a (diff)
Throw an error if an incompatible parameter is passed to a C++ function
[ChangeLog][Important Behavior Changes][QML] Throw an error if an incompatible parameter is passed to a C++ function Change-Id: I088e362869f7dc00ca639a0fbc4ba20cb9e82f7d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index ea809064a3..720324ea42 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1298,11 +1298,16 @@ static QV4::ReturnedValue CallMethod(const QQmlObjectOrGadget &object, int index
: QString());
}
- qWarning() << QLatin1String("Passing incompatible arguments to C++ functions from "
- "JavaScript is dangerous and deprecated.");
- qWarning() << QLatin1String("This will throw a JavaScript TypeError in future "
- "releases of Qt!");
+ const bool is_signal =
+ object.metaObject()->method(index).methodType() == QMetaMethod::Signal;
+ if (is_signal) {
+ qWarning() << "Passing incomatible arguments to signals is not supported.";
+ } else {
+ return engine->throwTypeError(
+ "Passing incompatible arguments to C++ functions from "
+ "JavaScript is not allowed.");
+ }
}
}
QVarLengthArray<void *, 9> argData(args.count());