From 90307d688e8485c143ba291685aa847fb571f6fb Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Thu, 17 Dec 2020 11:22:34 +0100 Subject: QML: Fix proxy iteration If the target of a proxy was extensible, we did not set the iteratorTarget to its correct value, and thus the ForInIteratorObject would not be usable. Fixes: QTBUG-86323 Change-Id: Id1924ac4087bab38c006b8eba92b619b79d36b7a Reviewed-by: Ulf Hermann (cherry picked from commit dd740d6b3469448dc1fd31c1742781e923e9f274) Reviewed-by: Qt Cherry-pick Bot --- src/qml/jsruntime/qv4proxy.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/qml/jsruntime') diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp index 1505eae426..8bfc9fc3ba 100644 --- a/src/qml/jsruntime/qv4proxy.cpp +++ b/src/qml/jsruntime/qv4proxy.cpp @@ -624,8 +624,10 @@ OwnPropertyKeyIterator *ProxyObject::virtualOwnPropertyKeys(const Object *m, Val else targetNonConfigurableKeys->push_back(keyAsValue); } - if (target->isExtensible() && targetNonConfigurableKeys->getLength() == 0) + if (target->isExtensible() && targetNonConfigurableKeys->getLength() == 0) { + *iteratorTarget = *m; return new ProxyObjectOwnPropertyKeyIterator(trapKeys); + } ScopedArrayObject uncheckedResultKeys(scope, scope.engine->newArrayObject()); uncheckedResultKeys->copyArrayData(trapKeys); @@ -639,8 +641,10 @@ OwnPropertyKeyIterator *ProxyObject::virtualOwnPropertyKeys(const Object *m, Val } } - if (target->isExtensible()) + if (target->isExtensible()) { + *iteratorTarget = *m; return new ProxyObjectOwnPropertyKeyIterator(trapKeys); + } len = targetConfigurableKeys->getLength(); for (uint i = 0; i < len; ++i) { -- cgit v1.2.3