archives

« Bugzilla Issues Index

#4107 — 9.4.3.3 [[Enumerate]], 9.4.5.6 [[Enumerate]]: Duplicate property names not detected


9.4.3.3 [[Enumerate]] ()
9.4.5.6 [[Enumerate]] ()

Duplicate property names are possible with current definition of [[Enumerate]] for String and Integer Indexed objects if an integer indexed property is present on an object in the prototype chain.

For example:
---
Object.defineProperty(Object.prototype, "0", {enumerable: true});
print([...Reflect.enumerate(new String("abc"))]);
---

Expected: Prints "0, 1, 2"
Actual: Prints "0, 1, 2, 0"


Are 9.4.3.3 and 9.4.5.6 actually needed? Maybe this issue can be fixed by simply changing 9.1.11 to use "[[OwnPropertyKeys]]" instead of "properties" and then deleting 9.4.3.3 and 9.4.5.6 because they are no longer needed. (This also allows to delete CompoundIterator object.)

> Return an Iterator object (25.1.1.2) whose next method iterates over all
> the String-valued keys of enumerable properties of O.


fixed in rev35 editor's draft

eliminated 9.4.3.3 and 9.4.5.6, via various tweaks in 9.4.5.6, the nost inport being the addition of:

[[Enumerate]] must obtain the own property keys of the target object as if by calling its [[OwnPropertyKeys]] internal method. Property attributes of the target object must be obtained as if by calling its [[GetOwnProperty]] internal method.


fixed in rev35