nsCOMPtr<nsIPref> thePrefsService(do_GetService(NS_PREF_CONTRACTID)); if (thePrefsService) { rv = thePrefsService->CopyUnicharPref("helpers.private_mailcap_file", getter_Copies(mailcapFileName));
rv = GetFileLocation("helpers.private_mailcap_file", "PERSONAL_MAILCAP", getter_Copies(mailcapFileName)); if (NS_SUCCEEDED(rv) && !mailcapFileName.IsEmpty()) { rv = GetHandlerAndDescriptionFromMailcapFile(mailcapFileName, aMajorType, aMinorType, aTypeOptions, aHandler, aDescription, aMozillaFlags); } else { rv = NS_ERROR_NOT_AVAILABLE; } if (NS_FAILED(rv) || aHandler.IsEmpty()) { rv = GetFileLocation("helpers.global_mailcap_file", "MAILCAP", getter_Copies(mailcapFileName));
LookUpHandlerAndDescription(const nsAString& aMajorType,                            const nsAString& aMinorType,                            nsHashtable& aTypeOptions,                            nsAString& aHandler,                            nsAString& aDescription,                            nsAString& aMozillaFlags) {  nsresult rv = NS_OK;  nsXPIDLString mailcapFileName;  nsCOMPtr<nsIPref> thePrefsService(do_GetService(NS_PREF_CONTRACTID));  if (thePrefsService) {    rv =      thePrefsService->CopyUnicharPref("helpers.private_mailcap_file",                                       getter_Copies(mailcapFileName));    if (NS_SUCCEEDED(rv) && !mailcapFileName.IsEmpty()) {      rv = GetHandlerAndDescriptionFromMailcapFile(mailcapFileName,                                                   aMajorType,                                                   aMinorType,                                                   aTypeOptions,                                                   aHandler,                                                   aDescription,                                                   aMozillaFlags);    }    if (aHandler.IsEmpty()) {      rv =        thePrefsService->CopyUnicharPref("helpers.global_mailcap_file",                                         getter_Copies(mailcapFileName));      if (NS_SUCCEEDED(rv) && !mailcapFileName.IsEmpty()) {        rv = GetHandlerAndDescriptionFromMailcapFile(mailcapFileName,                                                     aMajorType,                                                     aMinorType,                                                     aTypeOptions,                                                     aHandler,                                                     aDescription,                                                     aMozillaFlags);      }    }  } else {    rv = NS_ERROR_NOT_AVAILABLE;  }  return rv;}