Closed Bug 955670 Opened 11 years ago Closed 11 years ago

Indexed property enumeration order is not numeric for indices larger than 1000

Categories

(Core :: JavaScript Engine, defect)

x86_64
Windows 8.1
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 865760

People

(Reporter: felipe.dalorzo, Unassigned)

Details

(Keywords: js1.6, js1.7, Whiteboard: JSON auto-sort)

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

Steps to reproduce:

This code auto-sort the properties:

  var an_obj = { "4": "d", "1": "a", "2": "c"};
  alert(Object.keys(an_obj)); // will alert "1, 2, 4"

While this one is not:

var value2 = {"1003":1, "1001":2, "1000":3};
alert(Object.keys(value2));// will alert "1003, 1001, 1000"




Actual results:

First code sample, the properties are auto-sorted but the second example it is not.


Expected results:

Shouldn't both statements have the same behavior? I tried this in other browsers and they do.
Keywords: js1.6, js1.7
Whiteboard: JSON auto-sort
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
In ES5, property enumeration order is not defined.

In ES6, I'm not sure whether it's defined or no; I don't see anything in the spec defining it, so it might still be in flux.

In either case, I'm 99% sure this is a duplicate of an existing bug report about indexed property enumeration order not being numeric order for indices larger than 1000.
Summary: JSON Sort → Indexed property enumeration order is not numeric for indices larger than 1000
I do not think this has nothing about ES5 or ES6 because the behavior varies from when values are larger than 1000. Additionally this would affect all JSON objects where their properties are numbers larger than 1000 because they will be "read" in a different order.
https://bugzilla.mozilla.org/show_bug.cgi?id=865760
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.