Bug 1692663 - Replace LSCopyKindStringForMIMEType by UTTypeCopyDescription in nsOSHelperAppService.mm try: -b do -p linux64 -u mochitests -t none draft bug1692663
authorlongsonr <longsonr@gmail.com>
Sat, 13 Feb 2021 09:52:19 +0000
changeset 3539911 1c7763c282c68b1d015b1801fa218da30edd9760
parent 3539631 6f7e9ff0c23e3844b46ca31481027d5c29040638
child 3688633 ec24bbc9881732c44c53505a52bd9523360d4075
push id654822
push userlongsonr@gmail.com
push dateSat, 13 Feb 2021 09:55:42 +0000
treeherdertry@1c7763c282c6 [default view] [failures only]
bugs1692663
milestone87.0a1
Bug 1692663 - Replace LSCopyKindStringForMIMEType by UTTypeCopyDescription in nsOSHelperAppService.mm try: -b do -p linux64 -u mochitests -t none
uriloader/exthandler/mac/nsOSHelperAppService.mm
--- a/uriloader/exthandler/mac/nsOSHelperAppService.mm
+++ b/uriloader/exthandler/mac/nsOSHelperAppService.mm
@@ -529,27 +529,24 @@ nsresult nsOSHelperAppService::GetMIMEIn
         nsAutoCString ext;
         ext.Assign((char*)[extension cStringUsingEncoding:NSASCIIStringEncoding]);
         mimeInfoMac->AppendExtension(ext);
       }
     }
 
     CFStringRef cfType = ::CFStringCreateWithCString(NULL, mimeType.get(), kCFStringEncodingUTF8);
     if (cfType) {
-      CFStringRef cfTypeDesc = NULL;
-      if (::LSCopyKindStringForMIMEType(cfType, &cfTypeDesc) == noErr) {
+      if (CFStringRef cfTypeDesc = ::UTTypeCopyDescription(cfType)) {
         AutoTArray<UniChar, 255> buffer;
         CFIndex typeDescLength = ::CFStringGetLength(cfTypeDesc);
         buffer.SetLength(typeDescLength);
         ::CFStringGetCharacters(cfTypeDesc, CFRangeMake(0, typeDescLength), buffer.Elements());
         nsAutoString typeDesc;
         typeDesc.Assign(reinterpret_cast<char16_t*>(buffer.Elements()), typeDescLength);
         mimeInfoMac->SetDescription(typeDesc);
-      }
-      if (cfTypeDesc) {
         ::CFRelease(cfTypeDesc);
       }
       ::CFRelease(cfType);
     }
   }
 
   MOZ_LOG(mLog, LogLevel::Debug, ("OS gave us: type '%s' found '%i'\n", mimeType.get(), *aFound));