Moving closing paren to make it clearer what the logic really is and removing redundant comment. No behavior change.
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 22 Oct 2008 22:11:40 -0400
changeset 20771 a31be49882fcbffb2420b58c2ef43b7eeda8b12e
parent 20770 74eac45136634b97847e9613527a855a3f1007e7
child 20772 d390f74453adef7f7d98de3de1598a04a86db625
push idunknown
push userunknown
push dateunknown
milestone1.9.1b2pre
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
uriloader/base/nsURILoader.cpp
uriloader/exthandler/nsExternalHelperAppService.cpp
--- a/browser/components/feeds/src/nsFeedSniffer.cpp
+++ b/browser/components/feeds/src/nsFeedSniffer.cpp
@@ -156,27 +156,24 @@ HasAttachmentDisposition(nsIHttpChannel*
       // Get the disposition type
       rv = mimehdrpar->GetParameter(contentDisposition, "", fallbackCharset,
                                     PR_TRUE, nsnull, dispToken);
       // RFC 2183, section 2.8 says that an unknown disposition
       // value should be treated as "attachment"
       // 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;
     }
   } 
   
   return PR_FALSE;
 }
 
--- a/uriloader/base/nsURILoader.cpp
+++ b/uriloader/base/nsURILoader.cpp
@@ -397,27 +397,24 @@ nsresult nsDocumentOpenInfo::DispatchCon
       // Get the disposition type
       rv = mimehdrpar->GetParameter(disposition, "", fallbackCharset,
                                     PR_TRUE, nsnull, dispToken);
       // RFC 2183, section 2.8 says that an unknown disposition
       // value should be treated as "attachment"
       // 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;
     }
   }
 
   LOG(("  forceExternalHandling: %s", forceExternalHandling ? "yes" : "no"));
     
   // We're going to try to find a contentListener that can handle our data
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -311,27 +311,24 @@ static PRBool GetFilenameAndExtensionFro
     nsAutoString dispToken;
     rv = mimehdrpar->GetParameter(disp, "", fallbackCharset, PR_TRUE, 
                                   nsnull, dispToken);
     // RFC 2183, section 2.8 says that an unknown disposition
     // value should be treated as "attachment"
     // 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;
     }
 
     // We may not have a disposition type listed; some servers suck.
     // But they could have listed a filename anyway.
     GetFilenameFromDisposition(aFileName, disp, uri, mimehdrpar);