Bug 196822

Summary: Extract UTI mapping and allow for additions
Product: WebKit Reporter: Dean Jackson <dino>
Component: New BugsAssignee: Dean Jackson <dino>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch thorton: review+

Description Dean Jackson 2019-04-11 12:08:02 PDT
Extract UTI mapping and allow for additions
Comment 1 Radar WebKit Bug Importer 2019-04-11 12:08:32 PDT
<rdar://problem/49822339>
Comment 2 Dean Jackson 2019-04-11 12:13:17 PDT
Created attachment 367231 [details]
Patch
Comment 3 Tim Horton 2019-04-11 12:15:35 PDT
Comment on attachment 367231 [details]
Patch

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

> Source/WebKit/Shared/ios/UTIMappings.mm:42
> +NSString *UTIforMIMEType(const String& mimeType)

Seems like this should fold into UTIUtilities
Comment 4 Dean Jackson 2019-04-11 15:04:39 PDT
Created attachment 367247 [details]
Patch
Comment 5 Tim Horton 2019-04-11 15:20:00 PDT
Comment on attachment 367247 [details]
Patch

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

> Source/WebCore/platform/network/mac/UTIUtilities.mm:89
> +    static const auto map = makeNeverDestroyed([] {

Why not just go straight to UTI instead of using CoreServices, if you're already hardcoding?
Comment 6 Dean Jackson 2019-04-11 16:13:55 PDT
Committed r244201: <https://trac.webkit.org/changeset/244201>
Comment 7 Darin Adler 2019-04-12 09:12:21 PDT
Comment on attachment 367247 [details]
Patch

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

> Source/WebCore/platform/network/mac/UTIUtilities.mm:112
> +    return String(adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, mapEntry->value.createCFString().get(), nil)).get());

I don’t think the explicit String constructor is needed here.

> Source/WebCore/platform/network/mac/UTIUtilities.mm:121
> +            return String(type.get());

I don’t think the explicit String constructor is needed here.
Comment 8 Dean Jackson 2019-04-14 13:14:28 PDT
Committed r244247: <https://trac.webkit.org/changeset/244247>
Comment 9 Dean Jackson 2019-04-14 13:14:54 PDT
Comment on attachment 367247 [details]
Patch

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

>> Source/WebCore/platform/network/mac/UTIUtilities.mm:121
>> +            return String(type.get());
> 
> I don’t think the explicit String constructor is needed here.

Fixed.