Closed Bug 443817 Opened 16 years ago Closed 8 years ago

SM: fast and slow arrays use different enumeration order

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1175111

People

(Reporter: igor, Unassigned)

Details

Currently the enumeration of the fast array effectively uses the index order while the slow arrays uses the insertion order as the following session demonstrates:

~ $ cat ~/s/y.js
var a = [];
a[2] = 2; a[1] = 1; a[0] = 0;

var s = "";
for (var i in a)
    s += " "+i;
print(s);

var a = [];
a[2] = 2; a[1] = 1; a.foo = 'bar'; a[0] = 0;

var s = "";
for (var i in a)
    s += " "+i;
print(s);
~ $ ~/m/20-ff/js/src/Linux_All_DBG.OBJ/js ~/s/y.js
 0 1 2
 1 2 foo 0

This effectively makes the enumeration order unpredictable. SM should in both cases either stick to the insert order or use the index order for any indexed array property.
Assignee: general → nobody
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.