aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4scopedvalue_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-07-05 16:24:05 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-07-16 09:21:27 +0200
commit7e4b17943029b502cde63939a47f38ef900a9479 (patch)
tree6794242c6edbd07b7e5294ba43eaa6ea2752720e /src/qml/jsruntime/qv4scopedvalue_p.h
parent718bef9d2c85989479a8eef7e3a2837c42230c07 (diff)
Implement array methods for QQmlListProperty
The test revealed that the fill() method of JS arrays did not properly range-check its parameters. Fix that, too. [ChangeLog][QtQml][Important Behavior Changes] QQmlListProperty behaves like a JavaScript Array now. You can use map(), reduce(), forEach() etc on it. This also includes a slight change of behavior to the push() method. push() now returns the new list length, and it checks the length to not exceed UINT_MAX. Task-number: QTBUG-58831 Fixes: QTBUG-49613 Fixes: QTBUG-99041 Change-Id: Ia64d73fb704449c280fbbc7ddcf20f4698c82e09 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4scopedvalue_p.h')
-rw-r--r--src/qml/jsruntime/qv4scopedvalue_p.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index 09e8b60c91..fd68fcc1b3 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -32,9 +32,14 @@ namespace QV4 {
struct ScopedValue;
+inline bool hasExceptionOrIsInterrupted(ExecutionEngine *engine)
+{
+ return engine->hasException || engine->isInterrupted.loadRelaxed();
+}
+
#define CHECK_EXCEPTION() \
do { \
- if (scope.hasException() || scope.engine->isInterrupted.loadRelaxed()) { \
+ if (hasExceptionOrIsInterrupted(scope.engine)) { \
return QV4::Encode::undefined(); \
} \
} while (false)