Changeset 11659 in webkit
- Timestamp:
- Dec 18, 2005 4:27:29 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r11650 r11659 1 2005-12-18 Justin Haygood <justin@xiondigital.net> 2 3 Reviewed, tweaked, and landed by Darin. 4 5 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5227 6 Array indexOf() extension for JavaScript 1.5 Core 7 8 * kjs/array_object.h: 9 * kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Added implementation of indexOf. 10 1 11 2005-12-18 Anders Carlsson <andersca@mac.com> 2 12 -
trunk/JavaScriptCore/kjs/array_object.cpp
r11566 r11659 393 393 forEach ArrayProtoFunc::ForEach DontEnum|Function 5 394 394 some ArrayProtoFunc::Some DontEnum|Function 5 395 indexOf ArrayProtoFunc::IndexOf DontEnum|Function 1 395 396 @end 396 397 */ … … 811 812 break; 812 813 } 813 814 815 case IndexOf: { 816 // JavaScript 1.5 Extension by Mozilla 817 // Documentation: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf 818 819 unsigned index = 0; 820 double d = args[1]->toInteger(exec); 821 if (d < 0) 822 d += length; 823 if (d > 0) { 824 if (d > length) 825 index = length; 826 else 827 index = static_cast<unsigned>(d); 828 } 829 830 JSValue* searchElement = args[0]; 831 for (; index < length; ++index) { 832 JSValue* e = getProperty(exec, thisObj, index); 833 if (!e) 834 e = jsUndefined(); 835 if (strictEqual(exec, searchElement, e)) 836 return jsNumber(index); 837 } 838 839 return jsNumber(-1); 840 } 841 814 842 default: 815 843 assert(0); -
trunk/JavaScriptCore/kjs/array_object.h
r11527 r11659 46 46 enum { ToString, ToLocaleString, Concat, Join, Pop, Push, 47 47 Reverse, Shift, Slice, Sort, Splice, UnShift, 48 Every, ForEach, Some };48 Every, ForEach, Some, IndexOf }; 49 49 private: 50 50 int id; -
trunk/LayoutTests/ChangeLog
r11656 r11659 1 2005-12-18 Justin Haygood <justin@xiondigital.net> 2 3 Reviewed, tweaked, and landed by Darin. 4 5 - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=5227 6 Array indexOf() extension for JavaScript 1.5 Core 7 8 * fast/js/array-indexof-expected.txt: Added. 9 * fast/js/array-indexof.html: Added. 10 1 11 2005-12-18 Mitz Pettel <opendarwin.org@mitzpettel.com> 2 12
Note: See TracChangeset
for help on using the changeset viewer.