[Webkit-unassigned] [Bug 6252] JavaScript 1.6 Array.lastIndexOf

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Tue Dec 27 14:49:55 PST 2005


http://bugzilla.opendarwin.org/show_bug.cgi?id=6252





------- Additional Comments From mjs at apple.com  2005-12-27 14:49 -------
Shouldn't index be capped at length - 1, not length, since a[length] is off the end of the array?

+    if (d > 0) {
+        if (d > length)
+            index = length;

(you'd have to cast (length -1) to unsigned since for length 0 it could be -1).

A test case that would see the difference is something like:

a = new Array();
a.length = 1;
alert(a.lastIndexOf(undefined,1));

I think the right answer is 0 but the code here would give 1.


-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list