summaryrefslogtreecommitdiffstats
path: root/WebCore/bridge/runtime_array.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bridge/runtime_array.cpp')
-rw-r--r--WebCore/bridge/runtime_array.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/WebCore/bridge/runtime_array.cpp b/WebCore/bridge/runtime_array.cpp
index 2849822..feadb07 100644
--- a/WebCore/bridge/runtime_array.cpp
+++ b/WebCore/bridge/runtime_array.cpp
@@ -75,6 +75,29 @@ bool RuntimeArray::getOwnPropertySlot(ExecState* exec, const Identifier& propert
return JSObject::getOwnPropertySlot(exec, propertyName, slot);
}
+bool RuntimeArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ if (propertyName == exec->propertyNames().length) {
+ PropertySlot slot;
+ slot.setCustom(this, lengthGetter);
+ descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
+ return true;
+ }
+
+ bool ok;
+ unsigned index = propertyName.toArrayIndex(&ok);
+ if (ok) {
+ if (index < getLength()) {
+ PropertySlot slot;
+ slot.setCustomIndex(this, index, indexGetter);
+ descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | DontEnum);
+ return true;
+ }
+ }
+
+ return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
bool RuntimeArray::getOwnPropertySlot(ExecState *exec, unsigned index, PropertySlot& slot)
{
if (index < getLength()) {