summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@nokia.com>2009-07-30 21:31:01 (GMT)
committerTor Arne Vestbø <tor.arne.vestbo@nokia.com>2009-07-31 11:46:44 (GMT)
commit819bc9a2f9f86260af8a76027a712b2a310a088d (patch)
tree48a11b945fde67434da02d8629e1de794f81a7b1 /src/script/bridge
parentb2fc6a9406f3b59f9e800e9d2d567d0dabde6cef (diff)
downloadQt-819bc9a2f9f86260af8a76027a712b2a310a088d.zip
Qt-819bc9a2f9f86260af8a76027a712b2a310a088d.tar.gz
Qt-819bc9a2f9f86260af8a76027a712b2a310a088d.tar.bz2
QScriptValueIterator: fix missing non-enumerable values
Added an extra argument to JSObject::getPropertyNames() that specifies if the non-enumerable properties (those with the DontEnum attribute set) should be included or not. Tried looking at using a unsigned as an attribute-inclusion or exclusion filter, but the semantics of either the calling or the callee code would be very strange so I opted out.
Diffstat (limited to 'src/script/bridge')
-rw-r--r--src/script/bridge/qscriptclassobject.cpp5
-rw-r--r--src/script/bridge/qscriptclassobject_p.h2
-rw-r--r--src/script/bridge/qscriptobject.cpp11
-rw-r--r--src/script/bridge/qscriptobject_p.h5
-rw-r--r--src/script/bridge/qscriptqobject.cpp11
-rw-r--r--src/script/bridge/qscriptqobject_p.h6
6 files changed, 23 insertions, 17 deletions
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index 512c00e..2a26049 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -179,7 +179,8 @@ bool ClassObjectDelegate::getPropertyAttributes(const QScriptObject* object, JSC
}
void ClassObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState *exec,
- JSC::PropertyNameArray &propertyNames)
+ JSC::PropertyNameArray &propertyNames,
+ bool includeNonEnumerable)
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
@@ -192,7 +193,7 @@ void ClassObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState
}
delete it;
}
- QScriptObjectDelegate::getPropertyNames(object, exec, propertyNames);
+ QScriptObjectDelegate::getPropertyNames(object, exec, propertyNames, includeNonEnumerable);
}
JSC::CallType ClassObjectDelegate::getCallData(QScriptObject*, JSC::CallData &callData)
diff --git a/src/script/bridge/qscriptclassobject_p.h b/src/script/bridge/qscriptclassobject_p.h
index bafcbcd..61ece04 100644
--- a/src/script/bridge/qscriptclassobject_p.h
+++ b/src/script/bridge/qscriptclassobject_p.h
@@ -89,7 +89,7 @@ public:
const JSC::Identifier&,
unsigned&) const;
virtual void getPropertyNames(QScriptObject*, JSC::ExecState*,
- JSC::PropertyNameArray&);
+ JSC::PropertyNameArray&, bool includeNonEnumerable = false);
virtual JSC::CallType getCallData(QScriptObject*, JSC::CallData&);
static JSC::JSValue JSC_HOST_CALL call(JSC::ExecState*, JSC::JSObject*,
diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp
index 8f74a93..65c4754 100644
--- a/src/script/bridge/qscriptobject.cpp
+++ b/src/script/bridge/qscriptobject.cpp
@@ -132,13 +132,13 @@ bool QScriptObject::getPropertyAttributes(JSC::ExecState* exec, const JSC::Ident
return d->delegate->getPropertyAttributes(this, exec, propertyName, attributes);
}
-void QScriptObject::getPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames)
+void QScriptObject::getPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames, bool includeNonEnumerable)
{
if (!d || !d->delegate) {
- JSC::JSObject::getPropertyNames(exec, propertyNames);
+ JSC::JSObject::getPropertyNames(exec, propertyNames, includeNonEnumerable);
return;
}
- d->delegate->getPropertyNames(this, exec, propertyNames);
+ d->delegate->getPropertyNames(this, exec, propertyNames, includeNonEnumerable);
}
void QScriptObject::mark()
@@ -217,9 +217,10 @@ bool QScriptObjectDelegate::getPropertyAttributes(const QScriptObject* object,
}
void QScriptObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState* exec,
- JSC::PropertyNameArray& propertyNames)
+ JSC::PropertyNameArray& propertyNames,
+ bool includeNonEnumerable)
{
- object->JSC::JSObject::getPropertyNames(exec, propertyNames);
+ object->JSC::JSObject::getPropertyNames(exec, propertyNames, includeNonEnumerable);
}
void QScriptObjectDelegate::mark(QScriptObject* object)
diff --git a/src/script/bridge/qscriptobject_p.h b/src/script/bridge/qscriptobject_p.h
index e124cbf..17e5e6b 100644
--- a/src/script/bridge/qscriptobject_p.h
+++ b/src/script/bridge/qscriptobject_p.h
@@ -88,7 +88,7 @@ public:
const JSC::Identifier& propertyName);
virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&,
unsigned&) const;
- virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);
+ virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, bool includeNonEnumerable = false);
virtual void mark();
virtual JSC::CallType getCallData(JSC::CallData&);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
@@ -142,7 +142,8 @@ public:
const JSC::Identifier& propertyName);
virtual bool getPropertyAttributes(const QScriptObject*, JSC::ExecState*,
const JSC::Identifier&, unsigned&) const;
- virtual void getPropertyNames(QScriptObject*, JSC::ExecState*, JSC::PropertyNameArray&);
+ virtual void getPropertyNames(QScriptObject*, JSC::ExecState*, JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
virtual void mark(QScriptObject*);
virtual JSC::CallType getCallData(QScriptObject*, JSC::CallData&);
virtual JSC::ConstructType getConstructData(QScriptObject*, JSC::ConstructData&);
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index ad43e55..9c15233 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -1490,7 +1490,8 @@ bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object,
}
void QObjectDelegate::getPropertyNames(QScriptObject *object, JSC::ExecState *exec,
- JSC::PropertyNameArray &propertyNames)
+ JSC::PropertyNameArray &propertyNames,
+ bool includeNonEnumerable)
{
QObject *qobject = data->value;
if (!qobject) {
@@ -1506,7 +1507,7 @@ void QObjectDelegate::getPropertyNames(QScriptObject *object, JSC::ExecState *ex
? meta->propertyOffset() : 0;
for ( ; i < meta->propertyCount(); ++i) {
QMetaProperty prop = meta->property(i);
- if (isEnumerableMetaProperty(prop, meta, i)) {
+ if (includeNonEnumerable || isEnumerableMetaProperty(prop, meta, i)) {
QString name = QString::fromLatin1(prop.name());
propertyNames.add(JSC::Identifier(exec, qtStringToJSCUString(name)));
}
@@ -1534,7 +1535,7 @@ void QObjectDelegate::getPropertyNames(QScriptObject *object, JSC::ExecState *ex
}
}
- QScriptObjectDelegate::getPropertyNames(object, exec, propertyNames);
+ QScriptObjectDelegate::getPropertyNames(object, exec, propertyNames, includeNonEnumerable);
}
void QObjectDelegate::mark(QScriptObject *object)
@@ -1768,7 +1769,7 @@ bool QMetaObjectWrapperObject::getPropertyAttributes(JSC::ExecState *exec,
return JSC::JSObject::getPropertyAttributes(exec, propertyName, attributes);
}
-void QMetaObjectWrapperObject::getPropertyNames(JSC::ExecState *exec, JSC::PropertyNameArray &propertyNames)
+void QMetaObjectWrapperObject::getPropertyNames(JSC::ExecState *exec, JSC::PropertyNameArray &propertyNames, bool includeNonEnumerable)
{
const QMetaObject *meta = data->value;
if (!meta)
@@ -1778,7 +1779,7 @@ void QMetaObjectWrapperObject::getPropertyNames(JSC::ExecState *exec, JSC::Prope
for (int j = 0; j < e.keyCount(); ++j)
propertyNames.add(JSC::Identifier(exec, e.key(j)));
}
- JSC::JSObject::getPropertyNames(exec, propertyNames);
+ JSC::JSObject::getPropertyNames(exec, propertyNames, includeNonEnumerable);
}
void QMetaObjectWrapperObject::mark()
diff --git a/src/script/bridge/qscriptqobject_p.h b/src/script/bridge/qscriptqobject_p.h
index 6128c9f..14b426e 100644
--- a/src/script/bridge/qscriptqobject_p.h
+++ b/src/script/bridge/qscriptqobject_p.h
@@ -106,7 +106,8 @@ public:
virtual bool getPropertyAttributes(const QScriptObject*, JSC::ExecState*,
const JSC::Identifier&,
unsigned&) const;
- virtual void getPropertyNames(QScriptObject*, JSC::ExecState*, JSC::PropertyNameArray&);
+ virtual void getPropertyNames(QScriptObject*, JSC::ExecState*, JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
virtual void mark(QScriptObject*);
inline QObject *value() const { return data->value; }
@@ -293,7 +294,8 @@ public:
const JSC::Identifier& propertyName);
virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&,
unsigned&) const;
- virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);
+ virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
virtual void mark();
virtual JSC::CallType getCallData(JSC::CallData&);