Closed Bug 301204 Opened 19 years ago Closed 19 years ago

Array.reverse() is broken

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bugs.caleb, Assigned: mrbkap)

References

Details

(Keywords: js1.5, regression)

Attachments

(1 file)

The Array.reverse() function is not working properly.

Reproduction steps:

1. Open up the JS console 
2. Eval: var myArray = new Array("one", "two", "three"); myArray.reverse();

The expected output is: three,two,one
Actual output is: one,two,one

Possible regressor is bug 299738.
Component: JavaScript Console → JavaScript Engine
CC'ing mrbkap, he should probably know what to do :)
Assignee: js-console → general
QA Contact: jrgmorrison → general
Blocks: 299595
Flags: blocking1.8b4?
Assignee: general → mrbkap
Keywords: js1.5, regression
Target Milestone: --- → mozilla1.8beta4
I have a fix for this particular bug and am tracking down other regressions the
js testsuite is pointing out.
Status: NEW → ASSIGNED
Target Milestone: mozilla1.8beta4 → ---
Attached patch DuhSplinter Review
Reverse needed to grab both values before it started doing the swapping (duh!).
Slice needed to protect against begin > end because the setlength call was
depending on it (this wasn't a problem before because we didn't call setlength,
and instead relied on OBJ_SET_PROPERTY, which we can no longer do).

The JS testsuite (the tests in */Array/*, anyway) tell me that the only other
array bugs are known and open.
Attachment #189688 - Flags: review?(shaver)
Comment on attachment 189688 [details] [diff] [review]
Duh

r=shaver, requesting a.  This has coverage in the test suite already, it looks
like.
Attachment #189688 - Flags: review?(shaver)
Attachment #189688 - Flags: review+
Attachment #189688 - Flags: approval1.8b4?
Attachment #189688 - Flags: approval1.8b4? → approval1.8b4+
Fix checked in, sorry for the regression.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Hmm, did this bug cause an increased leakage?
Here are the checkins: 
http://tinderbox.mozilla.org/bonsai/cvsquery.cgi?module=PhoenixTinderbox&date=explicit&mindate=1121711760&maxdate=1121715719

From:
RLk:4.98KB
Lk:300KB
MH:7.67MB
A:214K

To:
RLk:5.02KB <---
Lk:299KB
MH:7.66MB
A:214K
Flags: blocking1.8b4?
Flags: testcase+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: