Closed
Bug 1281047
Opened 8 years ago
Closed 8 years ago
Reps: array indexes aren't sorted properly
Categories
(DevTools :: Shared Components, defect, P1)
DevTools
Shared Components
Tracking
(firefox50 fixed)
Tracking | Status | |
---|---|---|
firefox50 | --- | fixed |
People
(Reporter: linclark, Assigned: miker)
References
Details
(Whiteboard: [devtools-html])
Attachments
(2 files, 1 obsolete file)
93.65 KB,
image/png
|
Details | |
1.86 KB,
patch
|
miker
:
review+
|
Details | Diff | Splinter Review |
The array indexes seem to be sorted as if they were strings, not numbers.
Reporter | ||
Updated•8 years ago
|
Whiteboard: [devtools-html] [triage]
Updated•8 years ago
|
Blocks: devtools-html-2
Updated•8 years ago
|
Flags: qe-verify-
Priority: -- → P2
Whiteboard: [devtools-html] [triage] → [devtools-html]
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → mratcliffe
Updated•8 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•8 years ago
|
||
Test string: [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ]
Comment hidden (obsolete) |
Comment hidden (obsolete) |
Assignee | ||
Comment 4•8 years ago
|
||
I can reproduce if I enable the DOM panel so I will work on it there.
Flags: needinfo?(lclark)
Assignee | ||
Comment 5•8 years ago
|
||
In summary I needed the patch from bug 1283123 and bug 1283870.
Updated•8 years ago
|
Iteration: --- → 50.3 - Jul 18
Priority: P2 → P1
Assignee | ||
Comment 6•8 years ago
|
||
In devtools/server/actors/object.js::enumArrayProperties() we use the following to get the property names: ``` Object.getOwnPropertyNames([ "a", "b", "c" ]) ``` The problem is that this returns [ "1", "2", "3" ] instead of [ 1, 2, 3 ]. Of course, an array can contain object properties e.g. myArr.someProp so we need to support both in this instance.
Assignee | ||
Comment 7•8 years ago
|
||
So it seems that in this instance getOwnPropertyNames() is correct... array indexes are strings internally. It is not obvious because e.g. arr[1] is coerced into arr["1"]. We should still sort arrays as a special case because this is what most users would expect.
Assignee | ||
Comment 8•8 years ago
|
||
Attachment #8769702 -
Flags: review?(odvarko)
Assignee | ||
Comment 9•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=1b09eca51db0
Comment 10•8 years ago
|
||
Comment on attachment 8769702 [details] [diff] [review] 1281047-fix-array-key-order.diff Review of attachment 8769702 [details] [diff] [review]: ----------------------------------------------------------------- Works for me. We should make sure that this is covered by a test (in bug 1264676) Nit: the commit message should be: Bug 1281047 - Properly sort array indexes; r=Honza Thanks Mike! Honza
Attachment #8769702 -
Flags: review?(odvarko) → review+
Assignee | ||
Comment 11•8 years ago
|
||
The test will be added in bug 1286186 so this can be landed.
Attachment #8769702 -
Attachment is obsolete: true
Attachment #8770057 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 12•8 years ago
|
||
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/fx-team/rev/4773ee41e97d Properly sort array indexes; r=honza
Keywords: checkin-needed
Comment 13•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4773ee41e97d
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 50
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•