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 | |
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')
32 files changed, 59 insertions, 56 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h index 9d22ad9..4f1d51c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h @@ -66,7 +66,7 @@ private: virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); virtual double toNumber(ExecState*) const; virtual UString toString(ExecState*) const; diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h index 987c59f..8bcf8ad 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -372,7 +372,7 @@ JSValue JSCallbackObject<Base>::call(ExecState* exec, JSObject* functionObject, } template <class Base> -void JSCallbackObject<Base>::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void JSCallbackObject<Base>::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { JSContextRef execRef = toRef(exec); JSObjectRef thisRef = toRef(this); @@ -380,7 +380,7 @@ void JSCallbackObject<Base>::getPropertyNames(ExecState* exec, PropertyNameArray for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { if (JSObjectGetPropertyNamesCallback getPropertyNames = jsClass->getPropertyNames) { JSLock::DropAllLocks dropAllLocks(exec); - getPropertyNames(execRef, thisRef, toRef(&propertyNames)); + getPropertyNames(execRef, thisRef, toRef(&propertyNames), includeNonEnumerable); } if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { @@ -406,7 +406,7 @@ void JSCallbackObject<Base>::getPropertyNames(ExecState* exec, PropertyNameArray } } - Base::getPropertyNames(exec, propertyNames); + Base::getPropertyNames(exec, propertyNames, includeNonEnumerable); } template <class Base> diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.h b/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.h index 3e8b0eb..4dedc57 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.h @@ -187,6 +187,7 @@ typedef bool @param ctx The execution context to use. @param object The JSObject whose property names are being collected. @param accumulator A JavaScript property name accumulator in which to accumulate the names of object's properties. +@param includeNonEnumerable Flag deciding if properties with the DontEnum attribute should be included. @discussion If you named your function GetPropertyNames, you would declare it like this: void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); @@ -196,7 +197,7 @@ Property name accumulators are used by JSObjectCopyPropertyNames and JavaScript Use JSPropertyNameAccumulatorAddName to add property names to accumulator. A class's getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object's prototype, are added independently. */ typedef void -(*JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); +(*JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames, bool includeNonEnumerable); /*! @typedef JSObjectCallAsFunctionCallback diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp index 4b2568f..1a1b2a1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp @@ -70,9 +70,9 @@ bool DebuggerActivation::deleteProperty(ExecState* exec, const Identifier& prope return m_activation->deleteProperty(exec, propertyName); } -void DebuggerActivation::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void DebuggerActivation::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { - m_activation->getPropertyNames(exec, propertyNames); + m_activation->getPropertyNames(exec, propertyNames, includeNonEnumerable); } bool DebuggerActivation::getPropertyAttributes(JSC::ExecState* exec, const Identifier& propertyName, unsigned& attributes) const diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h index 9e1f9f5..dcefe5e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h @@ -42,7 +42,7 @@ namespace JSC { virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); virtual bool deleteProperty(ExecState*, const Identifier& propertyName); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const; virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction); virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp index 296ac9d..a50fc86 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.cpp @@ -427,7 +427,7 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i) return false; } -void JSArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void JSArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { // FIXME: Filling PropertyNameArray with an identifier for every integer // is incredibly inefficient for large arrays. We need a different approach, @@ -447,7 +447,7 @@ void JSArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames propertyNames.add(Identifier::from(exec, it->first)); } - JSObject::getPropertyNames(exec, propertyNames); + JSObject::getPropertyNames(exec, propertyNames, includeNonEnumerable); } bool JSArray::increaseVectorLength(unsigned newLength) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.h index ea490d8..aaeb810 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSArray.h @@ -87,7 +87,7 @@ namespace JSC { virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); virtual bool deleteProperty(ExecState*, const Identifier& propertyName); virtual bool deleteProperty(ExecState*, unsigned propertyName); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); virtual void mark(); void* lazyCreationData(); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.cpp index 2a5e72f..fad7451 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.cpp @@ -85,12 +85,12 @@ void JSByteArray::put(ExecState* exec, unsigned propertyName, JSValue value) setIndex(exec, propertyName, value); } -void JSByteArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void JSByteArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { unsigned length = m_storage->length(); for (unsigned i = 0; i < length; ++i) propertyNames.add(Identifier::from(exec, i)); - JSObject::getPropertyNames(exec, propertyNames); + JSObject::getPropertyNames(exec, propertyNames, includeNonEnumerable); } } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.h index 57374e0..ff57488 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSByteArray.h @@ -81,7 +81,7 @@ namespace JSC { virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); virtual void put(JSC::ExecState*, unsigned propertyName, JSC::JSValue); - virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); + virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, bool includeNonEnumerable = false); virtual const ClassInfo* classInfo() const { return m_classInfo; } static const ClassInfo s_defaultInfo; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.cpp index 937dc2b..e4aa23c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.cpp @@ -116,7 +116,7 @@ bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned) return false; } -void JSNotAnObject::getPropertyNames(ExecState* exec, PropertyNameArray&) +void JSNotAnObject::getPropertyNames(ExecState* exec, PropertyNameArray&, bool) { ASSERT_UNUSED(exec, exec->hadException() && exec->exception() == m_exception); } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.h index a8e36bd..dc89c66 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSNotAnObject.h @@ -87,7 +87,7 @@ namespace JSC { virtual bool deleteProperty(ExecState*, const Identifier& propertyName); virtual bool deleteProperty(ExecState*, unsigned propertyName); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); JSNotAnObjectErrorStub* m_exception; }; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp index a54c322..8e5c398 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp @@ -447,9 +447,9 @@ bool JSObject::getPropertySpecificValue(ExecState*, const Identifier& propertyNa return false; } -void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { - m_structure->getEnumerablePropertyNames(exec, propertyNames, this); + m_structure->getPropertyNames(exec, propertyNames, this, includeNonEnumerable); } bool JSObject::toBoolean(ExecState*) const diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h index db47ac7..9838bb1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h @@ -117,7 +117,7 @@ namespace JSC { virtual bool hasInstance(ExecState*, JSValue, JSValue prototypeProperty); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const; virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.cpp index a36cefa..e67bca6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.cpp @@ -41,15 +41,15 @@ bool JSVariableObject::deleteProperty(ExecState* exec, const Identifier& propert return JSObject::deleteProperty(exec, propertyName); } -void JSVariableObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void JSVariableObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { SymbolTable::const_iterator end = symbolTable().end(); for (SymbolTable::const_iterator it = symbolTable().begin(); it != end; ++it) { - if (!(it->second.getAttributes() & DontEnum)) + if (includeNonEnumerable || !(it->second.getAttributes() & DontEnum)) propertyNames.add(Identifier(exec, it->first.get())); } - JSObject::getPropertyNames(exec, propertyNames); + JSObject::getPropertyNames(exec, propertyNames, includeNonEnumerable); } bool JSVariableObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.h index b969da5..84ffe6c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSVariableObject.h @@ -49,7 +49,7 @@ namespace JSC { virtual void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes) = 0; virtual bool deleteProperty(ExecState*, const Identifier&); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); virtual bool isVariableObject() const; virtual bool isDynamicScope() const = 0; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpMatchesArray.h b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpMatchesArray.h index 9ae18b9..479a82c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpMatchesArray.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpMatchesArray.h @@ -72,11 +72,11 @@ namespace JSC { return JSArray::deleteProperty(exec, propertyName); } - virtual void getPropertyNames(ExecState* exec, PropertyNameArray& arr) + virtual void getPropertyNames(ExecState* exec, PropertyNameArray& arr, bool includeNonEnumerable = false) { if (lazyCreationData()) fillArrayInstance(exec); - JSArray::getPropertyNames(exec, arr); + JSArray::getPropertyNames(exec, arr, includeNonEnumerable); } void fillArrayInstance(ExecState*); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.cpp index df40691..927ea73 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.cpp @@ -79,12 +79,12 @@ bool StringObject::deleteProperty(ExecState* exec, const Identifier& propertyNam return JSObject::deleteProperty(exec, propertyName); } -void StringObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void StringObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { int size = internalValue()->value().size(); for (int i = 0; i < size; ++i) propertyNames.add(Identifier(exec, UString::from(i))); - return JSObject::getPropertyNames(exec, propertyNames); + return JSObject::getPropertyNames(exec, propertyNames, includeNonEnumerable); } bool StringObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.h index 0b643a6..8ed038b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StringObject.h @@ -38,7 +38,7 @@ namespace JSC { virtual void put(ExecState* exec, const Identifier& propertyName, JSValue, PutPropertySlot&); virtual bool deleteProperty(ExecState*, const Identifier& propertyName); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const; virtual const ClassInfo* classInfo() const { return &info; } 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()); } } diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h index 866999d..6c5e82f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h @@ -106,7 +106,7 @@ namespace JSC { return get(propertyName._ustring.rep(), attributes, specificValue); } - void getEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*); + void getPropertyNames(ExecState*, PropertyNameArray&, JSObject*, bool includeNonEnumerable = false); bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; } void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; } @@ -121,8 +121,8 @@ namespace JSC { size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); size_t remove(const Identifier& propertyName); - void getEnumerableNamesFromPropertyTable(PropertyNameArray&); - void getEnumerableNamesFromClassInfoTable(ExecState*, const ClassInfo*, PropertyNameArray&); + void getNamesFromPropertyTable(PropertyNameArray&, bool includeNonEnumerable = false); + void getNamesFromClassInfoTable(ExecState*, const ClassInfo*, PropertyNameArray&, bool includeNonEnumerable = false); void expandPropertyMapHashTable(); void rehashPropertyMapHashTable(); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp index 1bf478b..5a82d09 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.cpp @@ -103,9 +103,9 @@ bool JSDOMWindowShell::deleteProperty(ExecState* exec, const Identifier& propert return m_window->deleteProperty(exec, propertyName); } -void JSDOMWindowShell::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void JSDOMWindowShell::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { - m_window->getPropertyNames(exec, propertyNames); + m_window->getPropertyNames(exec, propertyNames, includeNonEnumerable); } bool JSDOMWindowShell::getPropertyAttributes(JSC::ExecState* exec, const Identifier& propertyName, unsigned& attributes) const diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h index 6f21892..086bfa0 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowShell.h @@ -70,7 +70,7 @@ namespace WebCore { virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); virtual void putWithAttributes(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, unsigned attributes); virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName); - virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); + virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, bool includeNonEnumerable = false); virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier& propertyName, unsigned& attributes) const; virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction); virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp index ad1e556..129a46a 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp @@ -268,12 +268,12 @@ CallType JSQuarantinedObjectWrapper::getCallData(CallData& callData) return CallTypeHost; } -void JSQuarantinedObjectWrapper::getPropertyNames(ExecState*, PropertyNameArray& array) +void JSQuarantinedObjectWrapper::getPropertyNames(ExecState*, PropertyNameArray& array, bool includeNonEnumerable) { if (!allowsGetPropertyNames()) return; - m_unwrappedObject->getPropertyNames(unwrappedExecState(), array); + m_unwrappedObject->getPropertyNames(unwrappedExecState(), array, includeNonEnumerable); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h index bf8fddb..9e54991 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h @@ -70,7 +70,7 @@ namespace WebCore { virtual bool hasInstance(JSC::ExecState*, JSC::JSValue, JSC::JSValue proto); - virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); + virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, bool includeNonEnumerable = false); virtual JSC::UString className() const { return m_unwrappedObject->className(); } diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm index 26cf3f5..dd3c10b 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -516,7 +516,7 @@ sub GenerateHeader push(@headerContent, " virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier&);\n") if $dataNode->extendedAttributes->{"CustomDeleteProperty"}; # Custom getPropertyNames function - push(@headerContent, " virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n") if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"}); + push(@headerContent, " virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, bool includeNonEnumerable = false);\n") if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"}); # Custom getPropertyAttributes function push(@headerContent, " virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&, unsigned& attributes) const;\n") if $dataNode->extendedAttributes->{"CustomGetPropertyAttributes"}; @@ -1334,13 +1334,13 @@ sub GenerateImplementation } if (($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"}) && !$dataNode->extendedAttributes->{"CustomGetPropertyNames"}) { - push(@implContent, "void ${className}::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)\n"); + push(@implContent, "void ${className}::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable)\n"); push(@implContent, "{\n"); if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"}) { push(@implContent, " for (unsigned i = 0; i < static_cast<${implClassName}*>(impl())->length(); ++i)\n"); push(@implContent, " propertyNames.add(Identifier::from(exec, i));\n"); } - push(@implContent, " Base::getPropertyNames(exec, propertyNames);\n"); + push(@implContent, " Base::getPropertyNames(exec, propertyNames, includeNonEnumerable);\n"); push(@implContent, "}\n\n"); } diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp index fcdd166..cd4db01 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp @@ -238,7 +238,7 @@ JSValue CInstance::valueOf(ExecState* exec) const return stringValue(exec); } -void CInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray) +void CInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray, bool includeNonEnumerable) { if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(_object->_class) || !_object->_class->enumerate) return; diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h index f9e9de3..a7354fd 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h @@ -65,7 +65,7 @@ public: virtual bool supportsConstruct() const; virtual JSValue invokeConstruct(ExecState*, const ArgList&); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); JSValue stringValue(ExecState*) const; JSValue numberValue(ExecState*) const; diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp index 506697a..e5fd8e6 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp @@ -222,7 +222,7 @@ void QtInstance::end() // Do nothing. } -void QtInstance::getPropertyNames(ExecState* exec, PropertyNameArray& array) +void QtInstance::getPropertyNames(ExecState* exec, PropertyNameArray& array, bool includeNonEnumerable) { // This is the enumerable properties, so put: // properties diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h index 23766b1..8379114 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h @@ -52,7 +52,7 @@ public: virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList&); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); JSValue stringValue(ExecState* exec) const; JSValue numberValue(ExecState* exec) const; diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime.h b/src/3rdparty/webkit/WebCore/bridge/runtime.h index 2f74a4e..bf24851 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime.h @@ -100,7 +100,7 @@ public: virtual bool supportsConstruct() const { return false; } virtual JSValue invokeConstruct(ExecState*, const ArgList&) { return JSValue(); } - virtual void getPropertyNames(ExecState*, PropertyNameArray&) { } + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false) { } virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const = 0; diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp index 385f914..4b9e6ec 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp @@ -241,7 +241,7 @@ ConstructType RuntimeObjectImp::getConstructData(ConstructData& constructData) return ConstructTypeHost; } -void RuntimeObjectImp::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void RuntimeObjectImp::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable) { if (!instance) { throwInvalidAccessError(exec); @@ -249,7 +249,7 @@ void RuntimeObjectImp::getPropertyNames(ExecState* exec, PropertyNameArray& prop } instance->begin(); - instance->getPropertyNames(exec, propertyNames); + instance->getPropertyNames(exec, propertyNames, includeNonEnumerable); instance->end(); } diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_object.h b/src/3rdparty/webkit/WebCore/bridge/runtime_object.h index f01fe1e..eb4a20f 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_object.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_object.h @@ -44,7 +44,7 @@ public: virtual CallType getCallData(CallData&); virtual ConstructType getConstructData(ConstructData&); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false); virtual void invalidate(); Bindings::Instance* getInternalInstance() const { return instance.get(); } |