Closed Bug 397882 Opened 18 years ago Closed 18 years ago

Array.forEach incompatibility

Categories

(Rhino Graveyard :: Core, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dr.bobik+mozdev, Unassigned)

Details

User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.6 (like Gecko) (Kubuntu) Build Identifier: Rhino 1.6 release 7 2007 08 30 The behavior differs from that specified in http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:forEach#Description as well as from what spidermonkey does, in the case when the array contains undefined elements. Reproducible: Always Steps to Reproduce: js> var a = (new Array(2)); a.forEach( function (e, i, a) { a[i] = i; } ); a.toSource(); Actual Results: prints [0, 1] Expected Results: the array should consist of two undefined elements, as per the documentation and consistently with spidermonkey.
Fixed in CVS HEAD: Checking in src/org/mozilla/javascript/NativeArray.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeArray.java,v <-- NativeArray.java new revision: 1.74; previous revision: 1.73 done
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.