Bug 208102 - Fix HTMLDataListElement.options to include even options that are not suggestions
Summary: Fix HTMLDataListElement.options to include even options that are not suggestions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-22 23:26 PST by Darin Adler
Modified: 2020-03-10 20:54 PDT (History)
11 users (show)

See Also:


Attachments
Patch (17.93 KB, patch)
2020-02-22 23:31 PST, Darin Adler
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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).