Array.forEach incompatibility

RESOLVED FIXED

Status

RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: dr.bobik+mozdev, Unassigned)

Tracking

Details

(Reporter)

Description

11 years ago
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.

Comment 1

11 years ago
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
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.