Bug 306471 part 2 - Do not query handler service for content-type of file extension. r=bz

MozReview-Commit-ID: FP1J6Qk3fsM

--HG--
extra : rebase_source : b223c630266294dc157e88d1a6090a1c99dd8746
This commit is contained in:
Xidorn Quan 2016-08-12 20:58:31 +10:00
parent f95f57c3c2
commit bef532f153

View File

@ -2728,11 +2728,12 @@ nsExternalHelperAppService::GetTypeFromExtension(const nsACString& aFileExt,
{
// OK. We want to try the following sources of mimetype information, in this order:
// 1. defaultMimeEntries array
// 2. User-set preferences (managed by the handler service)
// 3. OS-provided information
// 4. our "extras" array
// 5. Information from plugins
// 6. The "ext-to-type-mapping" category
// 2. OS-provided information
// 3. our "extras" array
// 4. Information from plugins
// 5. The "ext-to-type-mapping" category
// Note that, we are intentionally not looking at the handler service, because
// that can be affected by websites, which leads to undesired behavior.
// Early return if called with an empty extension parameter
if (aFileExt.IsEmpty()) {
@ -2747,15 +2748,6 @@ nsExternalHelperAppService::GetTypeFromExtension(const nsACString& aFileExt,
}
}
// Check user-set prefs
nsCOMPtr<nsIHandlerService> handlerSvc = do_GetService(NS_HANDLERSERVICE_CONTRACTID);
if (handlerSvc) {
nsresult rv = handlerSvc->GetTypeFromExtension(aFileExt, aContentType);
if (NS_SUCCEEDED(rv) && !aContentType.IsEmpty()) {
return NS_OK;
}
}
// Ask OS.
bool found = false;
nsCOMPtr<nsIMIMEInfo> mi = GetMIMEInfoFromOS(EmptyCString(), aFileExt, &found);