Closed
Bug 728286
Opened 12 years ago
Closed 12 years ago
Array.sort does not always call function arg
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: roger.skubowius, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Build ID: 20120208060813 Steps to reproduce: Running jQuery core test suite against Rhino 1.7R3 and investigating failures that involve removing duplicate jQuery objects. Actual results: Duplicates HTML elements were not detected as duplicate. Expected results: Duplicates should have been detected. In reviewing the jQuery javascript code, duplicates are detected by first sorting the array of jQuery objects (wrapping HTML Element nodes). This results in jQuery eventually calling Array.sort() with a function parm to determine is one element is <, = or > than the other. In the function arg, jQuery sets a state variable that's later used to test the sorting state. This state variable was never changed and, upon investigation, it appears the culprit is NativeArray::js_sort() that, before calling our comparator, uses its own internal comparator, so our method is never called. Commenting out the internal comparator allows these test cases to all pass.
Comment 1•12 years ago
|
||
See [1] and [2] for the required changes to get this working properly: [1] https://github.com/anba/rhino/commit/2f947b93ce84c00a63806adf5600751e9bb7b954#L19L1006 [2] https://github.com/anba/rhino/commit/2f947b93ce84c00a63806adf5600751e9bb7b954#L19L1033
Comment 2•12 years ago
|
||
New pull request at https://github.com/mozilla/rhino/pull/73
Comment 3•12 years ago
|
||
Thanks André, merged to git master: https://github.com/mozilla/rhino/commit/a9bbc345f75ccbdeae77c8fbc0603ea8b45dce73
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•