New issue
Advanced search Search tips
Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue v8:90
Owner: ----
Closed: Feb 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug



Sign in to add a comment

Array.sort return a different order even when passing a function that always returns zero

Reported by txgru...@gmail.com, Feb 6 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Steps to reproduce the problem:
1. Create an array with 11+ objects in it
2. Call .sort in this array passing a function that always return zero
3. The first item should not be the item zero

What is the expected behavior?
The array should be returned unchanged since the sort function always returns zero

What went wrong?
In the example at https://jsbin.com/naxumucato/1/edit?js,console the first item was the number 214 for an array with 10237 items, with 11 items the first item is 5, with 234 items the first item is 117, etc.

Did this work before? N/A 

Chrome version: 56.0.2924.87  Channel: stable
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 24.0 r0

Chrome: 56.0.2924.87
Opera: 42.0.2393.517
Firefox: 48.0.1
Safari: 10.0.3

 

Comment 1 by txgru...@gmail.com, Feb 6 2017

Screen Shot 2017-02-06 at 21.20.56.png
218 KB View Download
Screen Shot 2017-02-06 at 21.20.45.png
264 KB View Download
Screen Shot 2017-02-06 at 21.20.32.png
246 KB View Download
Screen Shot 2017-02-06 at 21.20.24.png
265 KB View Download

Comment 2 by a...@chromium.org, Feb 7 2017

Labels: Needs-Triage-M56

Comment 3 Deleted

Components: Blink>JavaScript
Labels: -Pri-2 -Needs-Triage-M56 M-56 OS-Linux OS-Windows Pri-1
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on windows 7, Linux Ubuntu 14.04 and Mac 10.12.2 using chrome version 56.0.2924.87 and canary 58.0.3004.0.
This is non regression issue as the issue seen from M30 old builds.
Marking it as Untriaged to get more inputs from dev team.

Thanks,

Comment 5 by kochi@chromium.org, Feb 8 2017

Mergedinto: v8:90
Status: Duplicate (was: Untriaged)
The Array.sort() algorithm is not stable.
See discussion in  issue v8:90  etc.

Sign in to add a comment