Properties that already appeared earlier in the
proto chain should get skipped by for..in (as they
are inaccessible from JS).
Change-Id: Ia0d9cc8582f96df4b2aaaa409d884f206456fe89
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
if (!current)
break;
- p = current->advanceIterator(this, name, index, attrs);
- if (p)
+ while (p = current->advanceIterator(this, name, index, attrs)) {
+ // check the property is not already defined earlier in the proto chain
+ if (current != object) {
+ Property *pp;
+ if (*name) {
+ pp = object->__getPropertyDescriptor__(*name);
+ } else {
+ assert (*index != UINT_MAX);
+ pp = object->__getPropertyDescriptor__(*index);
+ }
+ if (pp != p)
+ continue;
+ }
return p;
+ }
if (flags & WithProtoChain)
current = current->prototype;