Bug 208102

Summary: Fix HTMLDataListElement.options to include even options that are not suggestions
Product: WebKit Reporter: Darin Adler <darin>
Component: DOMAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, dbates, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, kondapallykalyan, mifenton, pdr, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Darin Adler 2020-02-22 23:26:11 PST
Fix HTMLDataListElement.options to include even options that are not suggestions
Comment 1 Darin Adler 2020-02-22 23:31:49 PST
Created attachment 391481 [details]
Patch
Comment 2 Darin Adler 2020-02-23 07:16:13 PST
Committed r257194: <https://trac.webkit.org/changeset/257194>
Comment 3 Radar WebKit Bug Importer 2020-02-23 07:17:15 PST
<rdar://problem/59706968>
Comment 4 Tim Horton 2020-03-10 19:35:47 PDT
Comment on attachment 391481 [details]
Patch

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

> Source/WebCore/html/ColorInputType.cpp:291
> -        suggestions.reserveInitialCapacity(length);
> -        for (unsigned i = 0; i != length; ++i) {
> -            auto value = downcast<HTMLOptionElement>(*options->item(i)).value();
> -            if (isValidSimpleColor(value))
> -                suggestions.uncheckedAppend(Color(value));
> +        for (auto& option : dataList->suggestions()) {
> +            if (auto color = parseSimpleColorValue(option.value()))
> +                suggestions.uncheckedAppend(*color);

Concerning that EWS didn't catch the loss of reserveInitialCapacity here
Comment 5 Darin Adler 2020-03-10 19:37:55 PDT
Comment on attachment 391481 [details]
Patch

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

>> Source/WebCore/html/ColorInputType.cpp:291
>> +                suggestions.uncheckedAppend(*color);
> 
> Concerning that EWS didn't catch the loss of reserveInitialCapacity here

Oops. Obviously this needs to be plain old append, not uncheckedAppend! I can’t believe I missed that.
Comment 6 Darin Adler 2020-03-10 19:38:37 PDT
Comment on attachment 391481 [details]
Patch

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

>>> Source/WebCore/html/ColorInputType.cpp:291
>>> +                suggestions.uncheckedAppend(*color);
>> 
>> Concerning that EWS didn't catch the loss of reserveInitialCapacity here
> 
> Oops. Obviously this needs to be plain old append, not uncheckedAppend! I can’t believe I missed that.

Are you going to fix that, Tim, or would you like me to?
Comment 7 Tim Horton 2020-03-10 20:54:27 PDT
I think Megan is fixing it! (she found the problem, I just did the spelunking to find out how it got this way).