diff options
author | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2009-07-30 21:31:01 (GMT) |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2009-07-31 11:46:44 (GMT) |
commit | 819bc9a2f9f86260af8a76027a712b2a310a088d (patch) | |
tree | 48a11b945fde67434da02d8629e1de794f81a7b1 /src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp | |
parent | b2fc6a9406f3b59f9e800e9d2d567d0dabde6cef (diff) | |
download | Qt-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/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp index 5dfd919..1e4c429 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp @@ -285,7 +285,7 @@ void Structure::materializePropertyMap() } } -void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject) +void Structure::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject, bool includeNonEnumerable) { bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_isDictionary); @@ -297,8 +297,8 @@ void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& p clearEnumerationCache(); } - getEnumerableNamesFromPropertyTable(propertyNames); - getEnumerableNamesFromClassInfoTable(exec, baseObject->classInfo(), propertyNames); + getNamesFromPropertyTable(propertyNames, includeNonEnumerable); + getNamesFromClassInfoTable(exec, baseObject->classInfo(), propertyNames, includeNonEnumerable); if (m_prototype.isObject()) { propertyNames.setShouldCache(false); // No need for our prototypes to waste memory on caching, since they're not being enumerated directly. @@ -1008,7 +1008,7 @@ static int comparePropertyMapEntryIndices(const void* a, const void* b) return 0; } -void Structure::getEnumerableNamesFromPropertyTable(PropertyNameArray& propertyNames) +void Structure::getNamesFromPropertyTable(PropertyNameArray& propertyNames, bool includeNonEnumerable) { materializePropertyMapIfNecessary(); if (!m_propertyTable) @@ -1019,7 +1019,8 @@ void Structure::getEnumerableNamesFromPropertyTable(PropertyNameArray& propertyN int i = 0; unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount; for (unsigned k = 1; k <= entryCount; k++) { - if (m_propertyTable->entries()[k].key && !(m_propertyTable->entries()[k].attributes & DontEnum)) { + if (m_propertyTable->entries()[k].key + && (includeNonEnumerable || !(m_propertyTable->entries()[k].attributes & DontEnum))) { PropertyMapEntry* value = &m_propertyTable->entries()[k]; int j; for (j = i - 1; j >= 0 && a[j]->index > value->index; --j) @@ -1046,7 +1047,8 @@ void Structure::getEnumerableNamesFromPropertyTable(PropertyNameArray& propertyN PropertyMapEntry** p = sortedEnumerables.data(); unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount; for (unsigned i = 1; i <= entryCount; i++) { - if (m_propertyTable->entries()[i].key && !(m_propertyTable->entries()[i].attributes & DontEnum)) + if (m_propertyTable->entries()[i].key + && (includeNonEnumerable || !(m_propertyTable->entries()[i].attributes & DontEnum))) *p++ = &m_propertyTable->entries()[i]; } @@ -1065,7 +1067,7 @@ void Structure::getEnumerableNamesFromPropertyTable(PropertyNameArray& propertyN } } -void Structure::getEnumerableNamesFromClassInfoTable(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames) +void Structure::getNamesFromClassInfoTable(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames, bool includeNonEnumerable) { // Add properties from the static hashtables of properties for (; classInfo; classInfo = classInfo->parentClass) { @@ -1078,7 +1080,7 @@ void Structure::getEnumerableNamesFromClassInfoTable(ExecState* exec, const Clas int hashSizeMask = table->compactSize - 1; const HashEntry* entry = table->table; for (int i = 0; i <= hashSizeMask; ++i, ++entry) { - if (entry->key() && !(entry->attributes() & DontEnum)) + if (entry->key() && (includeNonEnumerable || !(entry->attributes() & DontEnum))) propertyNames.add(entry->key()); } } |