Bug 1692663 - Replace LSCopyKindStringForMIMEType by UTTypeCopyDescription in nsOSHelperAppService.mm r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D105101
This commit is contained in:
longsonr 2021-02-13 18:12:58 +00:00
parent cb0b96820e
commit d5d9dcef4c

View File

@ -532,10 +532,9 @@ nsresult nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
}
}
CFStringRef cfType = ::CFStringCreateWithCString(NULL, mimeType.get(), kCFStringEncodingUTF8);
if (cfType) {
CFStringRef cfTypeDesc = NULL;
if (::LSCopyKindStringForMIMEType(cfType, &cfTypeDesc) == noErr) {
if (CFStringRef cfType =
::CFStringCreateWithCString(NULL, mimeType.get(), kCFStringEncodingUTF8)) {
if (CFStringRef cfTypeDesc = ::UTTypeCopyDescription(cfType)) {
AutoTArray<UniChar, 255> buffer;
CFIndex typeDescLength = ::CFStringGetLength(cfTypeDesc);
buffer.SetLength(typeDescLength);
@ -543,8 +542,6 @@ nsresult nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
nsAutoString typeDesc;
typeDesc.Assign(reinterpret_cast<char16_t*>(buffer.Elements()), typeDescLength);
mimeInfoMac->SetDescription(typeDesc);
}
if (cfTypeDesc) {
::CFRelease(cfTypeDesc);
}
::CFRelease(cfType);