From c684aeb1372c97acc849a5a07aa8cbf4aae74555 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 22 Oct 2008 22:11:40 -0400 Subject: [PATCH] Moving closing paren to make it clearer what the logic really is and removing redundant comment. No behavior change. --- browser/components/feeds/src/nsFeedSniffer.cpp | 11 ++++------- uriloader/base/nsURILoader.cpp | 17 +++++++---------- .../exthandler/nsExternalHelperAppService.cpp | 17 +++++++---------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/browser/components/feeds/src/nsFeedSniffer.cpp b/browser/components/feeds/src/nsFeedSniffer.cpp index ddca03edac4b..19aa0fb2f01a 100644 --- a/browser/components/feeds/src/nsFeedSniffer.cpp +++ b/browser/components/feeds/src/nsFeedSniffer.cpp @@ -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; } diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index f1ba46252862..770bcaac25b0 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -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; } diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index cb5fc87cf4ea..1a07f2d849ec 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -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;