diff --git a/mozilla/uriloader/exthandler/mac/nsOSHelperAppService.cpp b/mozilla/uriloader/exthandler/mac/nsOSHelperAppService.cpp index e8572a6bc92..f887f6186ed 100644 --- a/mozilla/uriloader/exthandler/mac/nsOSHelperAppService.cpp +++ b/mozilla/uriloader/exthandler/mac/nsOSHelperAppService.cpp @@ -96,7 +96,11 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromExtension(const char * aFileExt, nsIM { // first, ask our base class. We may already have this information cached.... nsresult rv = nsExternalHelperAppService::GetFromExtension(aFileExt, aMIMEInfo); - if (NS_SUCCEEDED(rv) && *aMIMEInfo) return rv; + if (NS_SUCCEEDED(rv) && *aMIMEInfo) + { + UpdateCreatorInfo(*aMIMEInfo); + return rv; + } // oops, we didn't find an entry....ask the internet config service to look it up for us... nsCOMPtr icService (do_GetService(NS_INTERNETCONFIGSERVICE_CONTRACTID)); @@ -117,7 +121,11 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromMIMEType(const char * aMIMEType, nsIM { // first, ask our base class. We may already have this information cached.... nsresult rv = nsExternalHelperAppService::GetFromMIMEType(aMIMEType, aMIMEInfo); - if (NS_SUCCEEDED(rv) && *aMIMEInfo) return rv; + if (NS_SUCCEEDED(rv) && *aMIMEInfo) + { + UpdateCreatorInfo(*aMIMEInfo); + return rv; + } // oops, we didn't find an entry....ask the internet config service to look it up for us... nsCOMPtr icService (do_GetService(NS_INTERNETCONFIGSERVICE_CONTRACTID)); @@ -133,3 +141,33 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromMIMEType(const char * aMIMEType, nsIM if (!*aMIMEInfo) rv = NS_ERROR_FAILURE; return rv; } + +// we never want to use a hard coded value for the creator and file type for the mac. always look these values up +// from internet config. +void nsOSHelperAppService::UpdateCreatorInfo(nsIMIMEInfo * aMIMEInfo) +{ + PRUint32 macCreatorType; + PRUint32 macFileType; + aMIMEInfo->GetMacType(&macFileType); + aMIMEInfo->GetMacCreator(&macCreatorType); + + if (macFileType == 0 || macCreatorType == 0) + { + // okay these values haven't been initialized yet so fetch a mime object from internet config. + nsXPIDLCString mimeType; + aMIMEInfo->GetMIMEType(getter_Copies(mimeType)); + nsCOMPtr icService (do_GetService(NS_INTERNETCONFIGSERVICE_CONTRACTID)); + if (icService) + { + nsCOMPtr osMimeObject; + icService->FillInMIMEInfo(mimeType, nsnull, getter_AddRefs(osMimeObject)); + if (osMimeObject) + { + osMimeObject->GetMacType(&macFileType); + osMimeObject->GetMacCreator(&macCreatorType); + aMIMEInfo->SetMacCreator(macCreatorType); + aMIMEInfo->SetMacType(macFileType); + } // if we got an os object + } // if we got the ic service + } // if the creator or file type hasn't been initialized yet +} diff --git a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp index 82c6a5150c7..aad85a6bfa3 100644 --- a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -75,31 +75,31 @@ static nsDefaultMimeTypeEntry defaultMimeEntries [] = { { TEXT_PLAIN, "txt,text", "Text File", 'TEXT', 'ttxt' }, #if defined(VMS) - { APPLICATION_OCTET_STREAM, "exe,bin,sav,bck,pcsi,dcx_axpexe,dcx_vaxexe,sfx_axpexe,sfx_vaxexe", "Binary Executable", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, + { APPLICATION_OCTET_STREAM, "exe,bin,sav,bck,pcsi,dcx_axpexe,dcx_vaxexe,sfx_axpexe,sfx_vaxexe", "Binary Executable", 0, 0 }, #elif defined(XP_MAC) // don't define .bin on the mac...use internet config to look that up... - { APPLICATION_OCTET_STREAM, "exe", "Binary Executable", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, + { APPLICATION_OCTET_STREAM, "exe", "Binary Executable", 0, 0 }, #else - { APPLICATION_OCTET_STREAM, "exe,bin", "Binary Executable", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, + { APPLICATION_OCTET_STREAM, "exe,bin", "Binary Executable", 0, 0 }, #endif - { TEXT_HTML, "htm,html,shtml,ehtml", "Hyper Text Markup Language", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, + { TEXT_HTML, "htm,html,shtml,ehtml", "Hyper Text Markup Language", 'TEXT', 'MOSS' }, { TEXT_RDF, "rdf", "Resource Description Framework", 'TEXT','ttxt' }, { TEXT_XUL, "xul", "XML-Based User Interface Language", 'TEXT', 'ttxt' }, { TEXT_XML, "xml,xsl", "Extensible Markup Language", 'TEXT', 'ttxt' }, { TEXT_CSS, "css", "Style Sheet", 'TEXT', 'ttxt' }, { APPLICATION_JAVASCRIPT, "js", "Javascript Source File", 'TEXT', 'ttxt' }, - { MESSAGE_RFC822, "eml", "RFC-822 data", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, - { APPLICATION_GZIP2, "gz", "gzip", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, - { IMAGE_GIF, "gif", "GIF Image", 'GIFf','GCon' }, - { IMAGE_JPG, "jpeg,jpg", "JPEG Image", 'JPEG', 'GCon' }, - { IMAGE_PNG, "png", "PNG Image", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, - { IMAGE_ART, "art", "ART Image", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, - { IMAGE_TIFF, "tiff,tif", "TIFF Image", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, - { APPLICATION_POSTSCRIPT, "ps,eps,ai", "Postscript File", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, - { TEXT_RTF, "rtf", "Rich Text Format", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, + { MESSAGE_RFC822, "eml", "RFC-822 data", 'TEXT', 'MOSS' }, + { APPLICATION_GZIP2, "gz", "gzip", 0, 0 }, + { IMAGE_GIF, "gif", "GIF Image", 0,0 }, + { IMAGE_JPG, "jpeg,jpg", "JPEG Image", 0, 0 }, + { IMAGE_PNG, "png", "PNG Image", 0, 0 }, + { IMAGE_ART, "art", "ART Image", 0, 0 }, + { IMAGE_TIFF, "tiff,tif", "TIFF Image", 0, 0 }, + { APPLICATION_POSTSCRIPT, "ps,eps,ai", "Postscript File",0, 0 }, + { TEXT_RTF, "rtf", "Rich Text Format", 0, 0 }, { TEXT_CPP, "cpp", "CPP file", 'TEXT','CWIE' }, - { "application/x-arj", "arj", "ARJ file", PRUint32(0x3F3F3F3F), PRUint32(0x3F3F3F3F) }, + { "application/x-arj", "arj", "ARJ file", 0,0 }, { APPLICATION_XPINSTALL, "xpi", "XPInstall Install", 'xpi*','MOSS' }, };