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
parent d3fc632669
commit c684aeb137
3 changed files with 18 additions and 27 deletions

View File

@ -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")) &&
!StringBeginsWithLowercaseLiteral(dispToken, "filename") &&
// Also in use is Content-Disposition: name="file"
!StringBeginsWithLowercaseLiteral(dispToken, "name"))
!StringBeginsWithLowercaseLiteral(dispToken, "name")))
// We have a content-disposition of "attachment" or unknown
return PR_TRUE;
}

View File

@ -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)) &&
!dispToken.EqualsIgnoreCase("filename", 8) &&
// Also in use is Content-Disposition: name="file"
!dispToken.EqualsIgnoreCase("name", 4))
!dispToken.EqualsIgnoreCase("name", 4)))
// We have a content-disposition of "attachment" or unknown
forceExternalHandling = PR_TRUE;
}

View File

@ -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)) &&
!dispToken.EqualsIgnoreCase("filename", 8) &&
// Also in use is Content-Disposition: name="file"
!dispToken.EqualsIgnoreCase("name", 4))
!dispToken.EqualsIgnoreCase("name", 4)))
{
// We have a content-disposition of "attachment" or unknown
handleExternally = PR_TRUE;