aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4argumentsobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4module.cpp3
-rw-r--r--src/qml/jsruntime/qv4module_p.h2
-rw-r--r--src/qml/jsruntime/qv4object.cpp3
-rw-r--r--src/qml/jsruntime/qv4object_p.h6
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp6
-rw-r--r--src/qml/jsruntime/qv4objectiterator_p.h9
-rw-r--r--src/qml/jsruntime/qv4proxy.cpp7
-rw-r--r--src/qml/jsruntime/qv4proxy_p.h2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp3
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h2
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp7
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp3
-rw-r--r--src/qml/jsruntime/qv4stringobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4vtable_p.h2
16 files changed, 38 insertions, 25 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index 6c1c4a6eea..86b97d83a1 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -213,8 +213,8 @@ qint64 ArgumentsObject::virtualGetLength(const Managed *m)
return a->propertyData(Heap::ArgumentsObject::LengthPropertyIndex)->toLength();
}
-OwnPropertyKeyIterator *ArgumentsObject::virtualOwnPropertyKeys(const Object *m)
+OwnPropertyKeyIterator *ArgumentsObject::virtualOwnPropertyKeys(const Object *m, Value *target)
{
static_cast<ArgumentsObject *>(const_cast<Object *>(m))->fullyCreate();
- return Object::virtualOwnPropertyKeys(m);
+ return Object::virtualOwnPropertyKeys(m, target);
}
diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h
index 6be1ab923f..00302027d1 100644
--- a/src/qml/jsruntime/qv4argumentsobject_p.h
+++ b/src/qml/jsruntime/qv4argumentsobject_p.h
@@ -106,7 +106,7 @@ struct ArgumentsObject: Object {
static bool virtualDeleteProperty(Managed *m, PropertyKey id);
static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
static qint64 virtualGetLength(const Managed *m);
- static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
+ static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
void fullyCreate();
diff --git a/src/qml/jsruntime/qv4module.cpp b/src/qml/jsruntime/qv4module.cpp
index 2db229e2b0..385fa91823 100644
--- a/src/qml/jsruntime/qv4module.cpp
+++ b/src/qml/jsruntime/qv4module.cpp
@@ -214,9 +214,10 @@ PropertyKey ModuleNamespaceIterator::next(const Object *o, Property *pd, Propert
return ObjectOwnPropertyKeyIterator::next(o, pd, attrs);
}
-OwnPropertyKeyIterator *Module::virtualOwnPropertyKeys(const Object *o)
+OwnPropertyKeyIterator *Module::virtualOwnPropertyKeys(const Object *o, Value *target)
{
const Module *module = static_cast<const Module *>(o);
+ *target = *o;
return new ModuleNamespaceIterator(module->d()->unit->exportedNames());
}
diff --git a/src/qml/jsruntime/qv4module_p.h b/src/qml/jsruntime/qv4module_p.h
index 073e0d1e54..7e8822a922 100644
--- a/src/qml/jsruntime/qv4module_p.h
+++ b/src/qml/jsruntime/qv4module_p.h
@@ -82,7 +82,7 @@ struct Q_QML_EXPORT Module : public Object {
static bool virtualDefineOwnProperty(Managed *, PropertyKey, const Property *, PropertyAttributes);
static bool virtualPut(Managed *, PropertyKey, const Value &, Value *);
static bool virtualDeleteProperty(Managed *m, PropertyKey id);
- static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
+ static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
static Heap::Object *virtualGetPrototypeOf(const Managed *);
static bool virtualSetPrototypeOf(Managed *, const Object *proto);
static bool virtualIsExtensible(const Managed *);
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 3c98e6eb35..267726d22f 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -390,8 +390,9 @@ PropertyKey ObjectOwnPropertyKeyIterator::next(const Object *o, Property *pd, Pr
return PropertyKey::invalid();
}
-OwnPropertyKeyIterator *Object::virtualOwnPropertyKeys(const Object *)
+OwnPropertyKeyIterator *Object::virtualOwnPropertyKeys(const Object *o, Value *target)
{
+ *target = *o;
return new ObjectOwnPropertyKeyIterator;
}
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index acd84cd66e..0a27993004 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -353,8 +353,8 @@ public:
bool deleteProperty(PropertyKey id)
{ return vtable()->deleteProperty(this, id); }
- OwnPropertyKeyIterator *ownPropertyKeys() const
- { return vtable()->ownPropertyKeys(this); }
+ OwnPropertyKeyIterator *ownPropertyKeys(Value *target) const
+ { return vtable()->ownPropertyKeys(this, target); }
qint64 getLength() const { return vtable()->getLength(this); }
ReturnedValue instanceOf(const Value &var) const
{ return vtable()->instanceOf(this, var); }
@@ -374,7 +374,7 @@ protected:
static bool virtualPreventExtensions(Managed *);
static Heap::Object *virtualGetPrototypeOf(const Managed *);
static bool virtualSetPrototypeOf(Managed *, const Object *);
- static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
+ static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
static qint64 virtualGetLength(const Managed *m);
static ReturnedValue virtualInstanceOf(const Object *typeObject, const Value &var);
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index 3eaf760792..906f6b38a6 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -164,6 +164,7 @@ PropertyKey ForInIteratorObject::nextProperty() const
Scope scope(this);
ScopedObject c(scope, d()->current);
+ ScopedObject t(scope, d()->target);
ScopedObject o(scope);
ScopedProperty p(scope);
ScopedPropertyKey key(scope);
@@ -171,7 +172,7 @@ PropertyKey ForInIteratorObject::nextProperty() const
while (1) {
while (1) {
- key = d()->iterator->next(c, p, &attrs);
+ key = d()->iterator->next(t, p, &attrs);
if (!key->isValid())
break;
if (!attrs.isEnumerable() || key->isSymbol())
@@ -198,7 +199,8 @@ PropertyKey ForInIteratorObject::nextProperty() const
if (!c)
break;
delete d()->iterator;
- d()->iterator = c->ownPropertyKeys();
+ d()->iterator = c->ownPropertyKeys(t.getRef());
+ d()->target.set(scope.engine, t->d());
if (!d()->iterator) {
scope.engine->throwTypeError();
return PropertyKey::invalid();
diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h
index 8d7b5512d4..0a5bcfc7ed 100644
--- a/src/qml/jsruntime/qv4objectiterator_p.h
+++ b/src/qml/jsruntime/qv4objectiterator_p.h
@@ -75,7 +75,8 @@ struct Q_QML_EXPORT ObjectIterator
object = static_cast<Object *>(scope.alloc());
this->flags = flags;
object->setM(o ? o->m() : nullptr);
- iterator = object->ownPropertyKeys();
+ if (o)
+ iterator = object->ownPropertyKeys(object);
}
~ObjectIterator()
{
@@ -93,6 +94,7 @@ namespace Heap {
#define ForInIteratorObjectMembers(class, Member) \
Member(class, Pointer, Object *, object) \
Member(class, Pointer, Object *, current) \
+ Member(class, Pointer, Object *, target) \
Member(class, NoMark, OwnPropertyKeyIterator *, iterator)
DECLARE_HEAP_OBJECT(ForInIteratorObject, Object) {
@@ -130,7 +132,10 @@ void Heap::ForInIteratorObject::init(QV4::Object *o)
return;
object.set(o->engine(), o->d());
current.set(o->engine(), o->d());
- iterator = o->ownPropertyKeys();
+ Scope scope(o);
+ ScopedObject obj(scope);
+ iterator = o->ownPropertyKeys(obj.getRef());
+ target.set(o->engine(), obj->d());
}
diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp
index 895763d40e..a1138c2515 100644
--- a/src/qml/jsruntime/qv4proxy.cpp
+++ b/src/qml/jsruntime/qv4proxy.cpp
@@ -546,7 +546,7 @@ static bool removeAllOccurrences(ArrayObject *target, ReturnedValue val) {
return found;
}
-OwnPropertyKeyIterator *ProxyObject::virtualOwnPropertyKeys(const Object *m)
+OwnPropertyKeyIterator *ProxyObject::virtualOwnPropertyKeys(const Object *m, Value *iteratorTarget)
{
Scope scope(m);
const ProxyObject *o = static_cast<const ProxyObject *>(m);
@@ -564,7 +564,7 @@ OwnPropertyKeyIterator *ProxyObject::virtualOwnPropertyKeys(const Object *m)
if (scope.hasException())
return nullptr;
if (trap->isUndefined())
- return target->ownPropertyKeys();
+ return target->ownPropertyKeys(iteratorTarget);
if (!trap->isFunctionObject()) {
scope.engine->throwTypeError();
return nullptr;
@@ -637,12 +637,13 @@ OwnPropertyKeyIterator *ProxyObject::virtualOwnPropertyKeys(const Object *m)
len = uncheckedResultKeys->getLength();
for (uint i = 0; i < len; ++i) {
- if (targetConfigurableKeys->get(i) != Encode::undefined()) {
+ if (uncheckedResultKeys->get(i) != Encode::undefined()) {
scope.engine->throwTypeError();
return nullptr;
}
}
+ *iteratorTarget = *m;
return new ProxyObjectOwnPropertyKeyIterator(trapKeys);
}
diff --git a/src/qml/jsruntime/qv4proxy_p.h b/src/qml/jsruntime/qv4proxy_p.h
index 7c10b91b13..132038a1ee 100644
--- a/src/qml/jsruntime/qv4proxy_p.h
+++ b/src/qml/jsruntime/qv4proxy_p.h
@@ -110,7 +110,7 @@ struct ProxyObject : FunctionObject {
static bool virtualPreventExtensions(Managed *);
static Heap::Object *virtualGetPrototypeOf(const Managed *);
static bool virtualSetPrototypeOf(Managed *, const Object *);
- static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
+ static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *iteratorTarget);
};
struct ProxyFunctionObject : ProxyObject {
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 23a268b8b9..5800b08ef4 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -823,8 +823,9 @@ PropertyKey QObjectWrapperOwnPropertyKeyIterator::next(const Object *o, Property
return ObjectOwnPropertyKeyIterator::next(o, pd, attrs);
}
-OwnPropertyKeyIterator *QObjectWrapper::virtualOwnPropertyKeys(const Object *)
+OwnPropertyKeyIterator *QObjectWrapper::virtualOwnPropertyKeys(const Object *m, Value *target)
{
+ *target = *m;
return new QObjectWrapperOwnPropertyKeyIterator;
}
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 1772ce434d..1f4b1480f9 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -195,7 +195,7 @@ protected:
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
- static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
+ static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
static ReturnedValue method_connect(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
static ReturnedValue method_disconnect(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index da5aa17719..1eef12a491 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -369,8 +369,9 @@ public:
}
};
- static OwnPropertyKeyIterator *containerOwnPropertyKeys(const Object *)
+ static OwnPropertyKeyIterator *containerOwnPropertyKeys(const Object *m, Value *target)
{
+ *target = *m;
return new OwnPropertyKeyIterator;
}
@@ -596,8 +597,8 @@ public:
}
static bool virtualIsEqualTo(Managed *that, Managed *other)
{ return static_cast<QQmlSequence<Container> *>(that)->containerIsEqualTo(other); }
- static QV4::OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m)
- { return static_cast<const QQmlSequence<Container> *>(m)->containerOwnPropertyKeys(m);}
+ static QV4::OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target)
+ { return static_cast<const QQmlSequence<Container> *>(m)->containerOwnPropertyKeys(m, target);}
};
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index e13accd4ea..f6156be0cd 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -140,8 +140,9 @@ PropertyKey StringObjectOwnPropertyKeyIterator::next(const Object *o, Property *
return ObjectOwnPropertyKeyIterator::next(o, pd, attrs);
}
-OwnPropertyKeyIterator *StringObject::virtualOwnPropertyKeys(const Object *)
+OwnPropertyKeyIterator *StringObject::virtualOwnPropertyKeys(const Object *m, Value *target)
{
+ *target = *m;
return new StringObjectOwnPropertyKeyIterator;
}
diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h
index 4d89c802b6..9d95b1f160 100644
--- a/src/qml/jsruntime/qv4stringobject_p.h
+++ b/src/qml/jsruntime/qv4stringobject_p.h
@@ -101,7 +101,7 @@ struct StringObject: Object {
using Object::getOwnProperty;
protected:
static bool virtualDeleteProperty(Managed *m, PropertyKey id);
- static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
+ static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
};
diff --git a/src/qml/jsruntime/qv4vtable_p.h b/src/qml/jsruntime/qv4vtable_p.h
index 7058991a34..0413655274 100644
--- a/src/qml/jsruntime/qv4vtable_p.h
+++ b/src/qml/jsruntime/qv4vtable_p.h
@@ -78,7 +78,7 @@ struct VTable
typedef Heap::Object *(*GetPrototypeOf)(const Managed *);
typedef bool (*SetPrototypeOf)(Managed *, const Object *);
typedef qint64 (*GetLength)(const Managed *m);
- typedef OwnPropertyKeyIterator *(*OwnPropertyKeys)(const Object *m);
+ typedef OwnPropertyKeyIterator *(*OwnPropertyKeys)(const Object *m, Value *target);
typedef ReturnedValue (*InstanceOf)(const Object *typeObject, const Value &var);
typedef ReturnedValue (*Call)(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);