mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 10:08:41 +00:00
Bug 903022 - nsExternalHelperAppService::DoContent whitespace cleanup. r=bz
This commit is contained in:
parent
5cf091bc06
commit
ce9e3be334
@ -696,7 +696,6 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
|
||||
aForceSave, aStreamListener);
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsAutoString fileName;
|
||||
nsAutoCString fileExtension;
|
||||
uint32_t reason = nsIHelperAppLauncherDialog::REASON_CANTHANDLE;
|
||||
@ -733,16 +732,19 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
|
||||
nsAutoCString query;
|
||||
|
||||
// We only care about the query for HTTP and HTTPS URLs
|
||||
nsresult rv;
|
||||
bool isHTTP, isHTTPS;
|
||||
rv = uri->SchemeIs("http", &isHTTP);
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv)) {
|
||||
isHTTP = false;
|
||||
}
|
||||
rv = uri->SchemeIs("https", &isHTTPS);
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv)) {
|
||||
isHTTPS = false;
|
||||
|
||||
if (isHTTP || isHTTPS)
|
||||
}
|
||||
if (isHTTP || isHTTPS) {
|
||||
url->GetQuery(query);
|
||||
}
|
||||
|
||||
// Only get the extension if the query is empty; if it isn't, then the
|
||||
// extension likely belongs to a cgi script and isn't helpful
|
||||
@ -756,16 +758,17 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
|
||||
LOG(("Found extension '%s' (filename is '%s', handling attachment: %i)",
|
||||
fileExtension.get(), NS_ConvertUTF16toUTF8(fileName).get(),
|
||||
isAttachment));
|
||||
if (isAttachment)
|
||||
if (isAttachment) {
|
||||
reason = nsIHelperAppLauncherDialog::REASON_SERVERREQUEST;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(("HelperAppService::DoContent: mime '%s', extension '%s'\n",
|
||||
PromiseFlatCString(aMimeContentType).get(), fileExtension.get()));
|
||||
|
||||
// we get the mime service here even though we're the default implementation of it,
|
||||
// so it's possible to override only the mime service and not need to reimplement the
|
||||
// whole external helper app service itself
|
||||
// We get the mime service here even though we're the default implementation
|
||||
// of it, so it's possible to override only the mime service and not need to
|
||||
// reimplement the whole external helper app service itself.
|
||||
nsCOMPtr<nsIMIMEService> mimeSvc(do_GetService(NS_MIMESERVICE_CONTRACTID));
|
||||
NS_ENSURE_TRUE(mimeSvc, NS_ERROR_FAILURE);
|
||||
|
||||
@ -789,21 +792,25 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
|
||||
getter_AddRefs(mimeInfo));
|
||||
mimeType.AssignLiteral(APPLICATION_OCTET_STREAM);
|
||||
}
|
||||
if (channel)
|
||||
|
||||
if (channel) {
|
||||
channel->SetContentType(mimeType);
|
||||
}
|
||||
|
||||
// Don't overwrite SERVERREQUEST
|
||||
if (reason == nsIHelperAppLauncherDialog::REASON_CANTHANDLE)
|
||||
if (reason == nsIHelperAppLauncherDialog::REASON_CANTHANDLE) {
|
||||
reason = nsIHelperAppLauncherDialog::REASON_TYPESNIFFED;
|
||||
}
|
||||
else {
|
||||
}
|
||||
} else {
|
||||
mimeSvc->GetFromTypeAndExtension(aMimeContentType, fileExtension,
|
||||
getter_AddRefs(mimeInfo));
|
||||
}
|
||||
LOG(("Type/Ext lookup found 0x%p\n", mimeInfo.get()));
|
||||
|
||||
// No mimeinfo -> we can't continue. probably OOM.
|
||||
if (!mimeInfo)
|
||||
if (!mimeInfo) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
*aStreamListener = nullptr;
|
||||
// We want the mimeInfo's primary extension to pass it to
|
||||
@ -818,10 +825,11 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
|
||||
fileName,
|
||||
reason,
|
||||
aForceSave);
|
||||
if (!handler)
|
||||
if (!handler) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aStreamListener = handler);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user