Bug 145361

Summary: Array#findIndex/find should not skip holes
Product: WebKit Reporter: Jordan Harband <ljharb>
Component: JavaScriptCoreAssignee: Jordan Harband <ljharb>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, ggaren, ysuzuki
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 132658    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Comment 1 Jordan Harband 2015-05-24 13:00:22 PDT
Created attachment 253666 [details]
Patch
Comment 2 Yusuke Suzuki 2015-05-24 19:15:53 PDT
Comment on attachment 253666 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=253666&action=review

> LayoutTests/js/script-tests/array-find.js:49
> +arrayWithHoles[7] = "";

Coulld you add non-arrayhole `undefined` case?

> LayoutTests/js/script-tests/array-findIndex.js:49
> +arrayWithHoles[7] = "";

Ditto
Comment 3 Jordan Harband 2015-05-24 19:33:18 PDT
(In reply to comment #2)
> Comment on attachment 253666 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253666&action=review
> 
> > LayoutTests/js/script-tests/array-find.js:49
> > +arrayWithHoles[7] = "";
> 
> Coulld you add non-arrayhole `undefined` case?
> 
> > LayoutTests/js/script-tests/array-findIndex.js:49
> > +arrayWithHoles[7] = "";
> 
> Ditto

Both of those already exist in the test files, higher up. `shouldBe("[undefined, 0, null, false, ''].find(passUndefined)", "undefined");` and `shouldBe("[undefined, 0, null, false, ''].findIndex(passUndefined)", "0");`
Comment 4 Yusuke Suzuki 2015-05-24 20:02:07 PDT
Comment on attachment 253666 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=253666&action=review

>>> LayoutTests/js/script-tests/array-find.js:49
>>> +arrayWithHoles[7] = "";
>> 
>> Coulld you add non-arrayhole `undefined` case?
> 
> Both of those already exist in the test files, higher up. `shouldBe("[undefined, 0, null, false, ''].find(passUndefined)", "undefined");` and `shouldBe("[undefined, 0, null, false, ''].findIndex(passUndefined)", "0");`

OK, make sense. Nice catch!
Comment 5 WebKit Commit Bot 2015-05-24 20:51:31 PDT
Comment on attachment 253666 [details]
Patch

Clearing flags on attachment: 253666

Committed r184848: <http://trac.webkit.org/changeset/184848>
Comment 6 WebKit Commit Bot 2015-05-24 20:51:34 PDT
All reviewed patches have been landed.  Closing bug.