Changeset 167797 in webkit
- Timestamp:
- Apr 25, 2014 1:25:59 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r167796 r167797 1 2014-04-25 Antoine Quint <graouts@webkit.org> 2 3 Implement Array.prototype.find() 4 https://bugs.webkit.org/show_bug.cgi?id=130966 5 6 Reviewed by Oliver Hunt. 7 8 * js/Object-getOwnPropertyNames-expected.txt: 9 * js/array-find-expected.txt: Added. 10 * js/array-find.html: Added. 11 * js/array-findIndex-expected.txt: Added. 12 * js/array-findIndex.html: Added. 13 * js/script-tests/Object-getOwnPropertyNames.js: 14 * js/script-tests/array-find.js: Added. 15 * js/script-tests/array-findIndex.js: Added. 16 1 17 2014-04-25 Ion Rosca <rosca@adobe.com> 2 18 -
trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt
r167380 r167797 46 46 PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString'] 47 47 PASS getSortedOwnPropertyNames(Array) is ['isArray', 'length', 'name', 'prototype'] 48 PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'f orEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']48 PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift'] 49 49 PASS getSortedOwnPropertyNames(String) is ['fromCharCode', 'length', 'name', 'prototype'] 50 50 PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'replace', 'search', 'slice', 'small', 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf'] -
trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
r167380 r167797 54 54 "Function.prototype": "['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']", 55 55 "Array": "['isArray', 'length', 'name', 'prototype']", 56 "Array.prototype": "['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'f orEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']",56 "Array.prototype": "['concat', 'constructor', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']", 57 57 "String": "['fromCharCode', 'length', 'name', 'prototype']", 58 58 "String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'replace', 'search', 'slice', 'small', 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']", -
trunk/Source/JavaScriptCore/ChangeLog
r167786 r167797 1 2014-04-25 Antoine Quint <graouts@webkit.org> 2 3 Implement Array.prototype.find() 4 https://bugs.webkit.org/show_bug.cgi?id=130966 5 6 Reviewed by Oliver Hunt. 7 8 Implement Array.prototype.find() and Array.prototype.findIndex() as proposed in the Harmony spec. 9 10 * builtins/Array.prototype.js: 11 (find): 12 (findIndex): 13 * runtime/ArrayPrototype.cpp: 14 1 15 2014-04-24 Brady Eidson <beidson@apple.com> 2 16 -
trunk/Source/JavaScriptCore/builtins/Array.prototype.js
r167380 r167797 190 190 } 191 191 192 function find(callback /*, thisArg */) { 193 "use strict"; 194 if (this === null) 195 throw new @TypeError("Array.prototype.find requires that |this| not be null"); 196 197 if (this === undefined) 198 throw new @TypeError("Array.prototype.find requires that |this| not be undefined"); 199 200 var array = @Object(this); 201 var length = array.length >>> 0; 202 203 if (typeof callback !== "function") 204 throw new @TypeError("Array.prototype.find callback must be a function"); 205 206 var thisArg = arguments.length > 1 ? arguments[1] : undefined; 207 for (var i = 0; i < length; i++) { 208 if (callback.@call(thisArg, array[i], i, array)) 209 return array[i]; 210 } 211 return undefined; 212 } 213 214 function findIndex(callback /*, thisArg */) { 215 "use strict"; 216 if (this === null) 217 throw new @TypeError("Array.prototype.findIndex requires that |this| not be null"); 218 219 if (this === undefined) 220 throw new @TypeError("Array.prototype.findIndex requires that |this| not be undefined"); 221 222 var array = @Object(this); 223 var length = array.length >>> 0; 224 225 if (typeof callback !== "function") 226 throw new @TypeError("Array.prototype.findIndex callback must be a function"); 227 228 var thisArg = arguments.length > 1 ? arguments[1] : undefined; 229 for (var i = 0; i < length; i++) { 230 if (callback.@call(thisArg, array[i], i, array)) 231 return i; 232 } 233 return -1; 234 } -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r167380 r167797 116 116 entries arrayProtoFuncEntries DontEnum|Function 0 117 117 keys arrayProtoFuncKeys DontEnum|Function 0 118 find arrayProtoFuncFind DontEnum|Function 1 119 findIndex arrayProtoFuncFindIndex DontEnum|Function 1 118 120 @end 119 121 */
Note: See TracChangeset
for help on using the changeset viewer.