path: root/src/qml/jsruntime/qv4object_p.h
diff options
authorLars Knoll <>2018-06-17 22:06:45 +0200
committerLars Knoll <>2018-06-25 07:36:22 +0000
commit3e1bb90da4c44455c8c307e01876cc2127bdb15c (patch)
tree6b9278e2612fe71ce84273857babf8494b8d91bc /src/qml/jsruntime/qv4object_p.h
parentf5a7953df3cb61edc6cc30175ea4f7f1c97deae6 (diff)
Implement a virtual interface for getOwnProperty
This is required to support Proxy properly, and at the same time fixes a couple of test failures. The new interface also replaces the old query and queryIndexed virtual interfaces, as those where doing a subset of what getOwnProperty does. Change-Id: I750e366b475ce971d6d9edf35fa17b7a2b07f771 Reviewed-by: Simon Hausmann <>
Diffstat (limited to 'src/qml/jsruntime/qv4object_p.h')
1 files changed, 6 insertions, 15 deletions
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 5ad67635db..a08ea851cd 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -173,10 +173,9 @@ struct ObjectVTable
ReturnedValue (*getIndexed)(const Managed *, uint index, bool *hasProperty);
bool (*put)(Managed *, StringOrSymbol *name, const Value &value);
bool (*putIndexed)(Managed *, uint index, const Value &value);
- PropertyAttributes (*query)(const Managed *, StringOrSymbol *name);
- PropertyAttributes (*queryIndexed)(const Managed *, uint index);
bool (*deleteProperty)(Managed *m, StringOrSymbol *name);
bool (*deleteIndexedProperty)(Managed *m, uint index);
+ PropertyAttributes (*getOwnProperty)(Managed *m, Identifier id, Property *p);
qint64 (*getLength)(const Managed *m);
void (*advanceIterator)(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes);
ReturnedValue (*instanceOf)(const Object *typeObject, const Value &var);
@@ -192,10 +191,9 @@ const QV4::ObjectVTable classname::static_vtbl = \
getIndexed, \
put, \
putIndexed, \
- query, \
- queryIndexed, \
deleteProperty, \
deleteIndexedProperty, \
+ getOwnProperty, \
getLength, \
advanceIterator, \
instanceOf \
@@ -243,8 +241,9 @@ struct Q_QML_EXPORT Object: Managed {
Heap::Object *prototype() const { return d()->prototype(); }
bool setPrototype(Object *proto);
- void getOwnProperty(StringOrSymbol *name, PropertyAttributes *attrs, Property *p = nullptr);
- void getOwnProperty(uint index, PropertyAttributes *attrs, Property *p = nullptr);
+ PropertyAttributes getOwnProperty(Identifier id, Property *p = nullptr) {
+ return vtable()->getOwnProperty(this, id, p);
+ }
PropertyIndex getValueOrSetter(StringOrSymbol *name, PropertyAttributes *attrs);
PropertyIndex getValueOrSetter(uint index, PropertyAttributes *attrs);
@@ -252,9 +251,6 @@ struct Q_QML_EXPORT Object: Managed {
bool hasProperty(StringOrSymbol *name) const;
bool hasProperty(uint index) const;
- bool hasOwnProperty(StringOrSymbol *name) const;
- bool hasOwnProperty(uint index) const;
bool __defineOwnProperty__(ExecutionEngine *engine, uint index, StringOrSymbol *member, const Property *p, PropertyAttributes attrs);
bool __defineOwnProperty__(ExecutionEngine *engine, StringOrSymbol *name, const Property *p, PropertyAttributes attrs);
bool __defineOwnProperty__(ExecutionEngine *engine, uint index, const Property *p, PropertyAttributes attrs);
@@ -418,10 +414,6 @@ public:
return ret;
- PropertyAttributes query(StringOrSymbol *name) const
- { return vtable()->query(this, name); }
- PropertyAttributes queryIndexed(uint index) const
- { return vtable()->queryIndexed(this, index); }
bool deleteProperty(StringOrSymbol *name)
{ return vtable()->deleteProperty(this, name); }
bool deleteIndexedProperty(uint index)
@@ -439,10 +431,9 @@ protected:
static ReturnedValue getIndexed(const Managed *m, uint index, bool *hasProperty);
static bool put(Managed *m, StringOrSymbol *name, const Value &value);
static bool putIndexed(Managed *m, uint index, const Value &value);
- static PropertyAttributes query(const Managed *m, StringOrSymbol *name);
- static PropertyAttributes queryIndexed(const Managed *m, uint index);
static bool deleteProperty(Managed *m, StringOrSymbol *name);
static bool deleteIndexedProperty(Managed *m, uint index);
+ static PropertyAttributes getOwnProperty(Managed *m, Identifier id, Property *p);
static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes);
static qint64 getLength(const Managed *m);
static ReturnedValue instanceOf(const Object *typeObject, const Value &var);