Moving closing paren to make it clearer what the logic really is and removing redundant comment. No behavior change.

This commit is contained in:
Boris Zbarsky 2008-10-22 22:11:40 -04:00
Родитель 08325408e7
Коммит f31e7d19a6
3 изменённых файлов: 18 добавлений и 27 удалений

Просмотреть файл

@ -161,17 +161,14 @@ HasAttachmentDisposition(nsIHttpChannel* httpChannel)
// XXXbz this code is duplicated in GetFilenameAndExtensionFromChannel in
// nsExternalHelperAppService. Factor it out!
if (NS_FAILED(rv) ||
(// Some broken sites just send
// Content-Disposition: ; filename="file"
// screen those out here.
!dispToken.IsEmpty() &&
(!dispToken.IsEmpty() &&
!StringBeginsWithLowercaseLiteral(dispToken, "inline") &&
// Broken sites just send
// Content-Disposition: filename="file"
// without a disposition token... screen those out.
!StringBeginsWithLowercaseLiteral(dispToken, "filename")) &&
// Also in use is Content-Disposition: name="file"
!StringBeginsWithLowercaseLiteral(dispToken, "name"))
!StringBeginsWithLowercaseLiteral(dispToken, "filename") &&
// Also in use is Content-Disposition: name="file"
!StringBeginsWithLowercaseLiteral(dispToken, "name")))
// We have a content-disposition of "attachment" or unknown
return PR_TRUE;
}

Просмотреть файл

@ -402,17 +402,14 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports *
// XXXbz this code is duplicated in GetFilenameAndExtensionFromChannel in
// nsExternalHelperAppService. Factor it out!
if (NS_FAILED(rv) ||
(// Some broken sites just send
// Content-Disposition: ; filename="file"
// screen those out here.
!dispToken.IsEmpty() &&
(!dispToken.IsEmpty() &&
!dispToken.LowerCaseEqualsLiteral("inline") &&
// Broken sites just send
// Content-Disposition: filename="file"
// without a disposition token... screen those out.
!dispToken.EqualsIgnoreCase("filename", 8)) &&
// Also in use is Content-Disposition: name="file"
!dispToken.EqualsIgnoreCase("name", 4))
// Broken sites just send
// Content-Disposition: filename="file"
// without a disposition token... screen those out.
!dispToken.EqualsIgnoreCase("filename", 8) &&
// Also in use is Content-Disposition: name="file"
!dispToken.EqualsIgnoreCase("name", 4)))
// We have a content-disposition of "attachment" or unknown
forceExternalHandling = PR_TRUE;
}

Просмотреть файл

@ -316,17 +316,14 @@ static PRBool GetFilenameAndExtensionFromChannel(nsIChannel* aChannel,
// XXXbz this code is duplicated in nsDocumentOpenInfo::DispatchContent.
// Factor it out! Maybe store it in the nsDocumentOpenInfo?
if (NS_FAILED(rv) ||
(// Some broken sites just send
// Content-Disposition: ; filename="file"
// screen those out here.
!dispToken.IsEmpty() &&
(!dispToken.IsEmpty() &&
!dispToken.LowerCaseEqualsLiteral("inline") &&
// Broken sites just send
// Content-Disposition: filename="file"
// without a disposition token... screen those out.
!dispToken.EqualsIgnoreCase("filename", 8)) &&
// Also in use is Content-Disposition: name="file"
!dispToken.EqualsIgnoreCase("name", 4))
// Broken sites just send
// Content-Disposition: filename="file"
// without a disposition token... screen those out.
!dispToken.EqualsIgnoreCase("filename", 8) &&
// Also in use is Content-Disposition: name="file"
!dispToken.EqualsIgnoreCase("name", 4)))
{
// We have a content-disposition of "attachment" or unknown
handleExternally = PR_TRUE;