Web Automation: files selected for upload should be matched against 'accept' attribut...
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 07:57:55 +0000 (07:57 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 07:57:55 +0000 (07:57 +0000)
commit3d2b55eedf47ac2ac594d1110175b55222e88ce6
tree82ac8a7fcc2750d966b08e3453d79f6a9f03cfac
parent374a4f8a565e7d10a7795b2c05eac504aa525700
Web Automation: files selected for upload should be matched against 'accept' attribute values case-insensitively
https://bugs.webkit.org/show_bug.cgi?id=175191
<rdar://problem/33725790>

Reviewed by Carlos Garcia Campos.

Values of the "accept" attribute are to be compared in a case-insensitive manner, per
https://html.spec.whatwg.org/multipage/input.html#file-upload-state-(type=file)

Except for converting MIME types and extensions to lowercase, most of these changes
were lost in a rebase prior to landing the patch.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::fileCanBeAcceptedForUpload): Fix some issues:
- Handle a file ending in a period.
- Handle MIME type inference failing.
- Convert extensions and MIMEs to lower case, per specification.

(WebKit::WebAutomationSession::handleRunOpenPanel):
- Strip the leading period from file extensions.
- These range converters crash unless the API::Array is retained by a local variable.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220312 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp