[QuickLook] Use case-insensitive comparison of preview MIME types
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Aug 2017 15:52:19 +0000 (15:52 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Aug 2017 15:52:19 +0000 (15:52 +0000)
commitcf85028ce29847ac5b95e0367f0bfdb722da23cd
tree8860a883474076470e21323c88037fe857c1d168
parentd085e03bdbb69a993b9483e0adb52ff6deae9990
[QuickLook] Use case-insensitive comparison of preview MIME types
https://bugs.webkit.org/show_bug.cgi?id=175350
<rdar://problem/33761159>

Reviewed by Brady Eidson.

Source/WebCore:

MIME types are case-insensitive, but PreviewLoader was using a case-sensitive comparison to
determine if a MIME type was supported by QLPreviewConverter. As a result we would fail to
preview Excel macro-enabled workbooks, since CFNetwork would sniff a MIME type of
"application/vnd.ms-excel.sheet.macroEnabled.12" but QuickLook contained
"application/vnd.ms-excel.sheet.macroenabled.12" in its set of supported MIME type strings.

Fix this by copying the QuickLook supported MIME type set into a HashSet using
ASCIICaseInsensitiveHash and using that HashSet for MIME type checks.

Test: quicklook/excel-macro-enabled.html

* loader/ios/PreviewLoader.mm:
(WebCore::PreviewLoader::shouldCreateForMIMEType):

LayoutTests:

* platform/ios-11/quicklook/excel-macro-enabled-expected.txt: Added.
* quicklook/excel-macro-enabled-expected.txt: Added.
* quicklook/excel-macro-enabled.html: Added.
* quicklook/resources/excel-macro-enabled.xlsm: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/ios-11/quicklook/excel-macro-enabled-expected.txt [new file with mode: 0644]
LayoutTests/quicklook/excel-macro-enabled-expected.txt [new file with mode: 0644]
LayoutTests/quicklook/excel-macro-enabled.html [new file with mode: 0644]
LayoutTests/quicklook/resources/excel-macro-enabled.xlsm [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/ios/PreviewLoader.mm