WebCore/ChangeLog

 12010-03-30 Dawit Alemayehu <adawit@kde.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Replaced the 'shouldTreatAsAttachment' function with a more generic
 6 function that returns the content disposition type.
 7
 8 See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395
 9
 10 * platform/network/HTTPParsers.cpp:
 11 (WebCore::contentDispositionType):
 12 * platform/network/HTTPParsers.h:
 13 (WebCore::):
 14
1152010-03-29 Janne Koskinen <janne.p.koskinen@digia.com>
216
317 Reviewed by Simon Hausmann.

WebCore/platform/network/HTTPParsers.cpp

@@static inline bool skipToken(const String& str, int& pos, const char* token)
7272 return true;
7373}
7474
75 bool shouldTreatAsAttachment(const ResourceResponseBase& response)
76 {
77  const String& contentDisposition = response.httpHeaderField("Content-Disposition");
78 
 75ContentDispositionType contentDispositionType(const String& contentDisposition)
 76{
7977 if (contentDisposition.isEmpty())
80  return false;
 78 return None;
8179
8280 // Some broken sites just send
8381 // Content-Disposition: ; filename="file"
8482 // screen those out here.
8583 if (contentDisposition.startsWith(";"))
86  return false;
 84 return None;
8785
8886 if (contentDisposition.startsWith("inline", false))
89  return false;
 87 return Inline;
9088
9189 // Some broken sites just send
9290 // Content-Disposition: filename="file"
9391 // without a disposition token... screen those out.
9492 if (contentDisposition.startsWith("filename", false))
95  return false;
 93 return None;
9694
9795 // Also in use is Content-Disposition: name="file"
9896 if (contentDisposition.startsWith("name", false))
99  return false;
 97 return None;
10098
10199 // We have a content-disposition of "attachment" or unknown.
102100 // RFC 2183, section 2.8 says that an unknown disposition
103101 // value should be treated as "attachment"
104  return true;
 102 return Attachment;
105103}
106104
107105bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url)

WebCore/platform/network/HTTPParsers.h

@@enum XSSProtectionDisposition {
4141 XSSProtectionBlockEnabled
4242};
4343
44 
45 bool shouldTreatAsAttachment(const ResourceResponseBase& response);
 44typedef enum {
 45 None,
 46 Inline,
 47 Attachment,
 48 Other
 49} ContentDispositionType;
 50
 51ContentDispositionType contentDispositionType(const String&);
4652bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url);
4753double parseDate(const String&);
4854String filenameFromHTTPContentDisposition(const String&);

WebKit/chromium/ChangeLog

 12010-03-30 Dawit Alemayehu <adawit@kde.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Updated the WebCore::shouldTreatAsAttachement function call with the
 6 new more generic replacement WebCore::contentDispositionType.
 7
 8 See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395
 9
 10 * src/FrameLoaderClientImpl.cpp:
 11 (WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType):
 12
1132010-03-29 Dawit Alemayehu <adawit@kde.org>
214
315 Reviewed by Simon Hausmann.

WebKit/chromium/src/FrameLoaderClientImpl.cpp

@@void FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType(
843843 if (statusCode == 204 || statusCode == 205) {
844844 // The server does not want us to replace the page contents.
845845 action = PolicyIgnore;
846  } else if (WebCore::shouldTreatAsAttachment(response)) {
 846 } else if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::Attachment) {
847847 // The server wants us to download instead of replacing the page contents.
848848 // Downloading is handled by the embedder, but we still get the initial
849849 // response so that we can ignore it and clean up properly.

WebKit/qt/ChangeLog

 12010-03-30 Dawit Alemayehu <adawit@kde.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Updated the WebCore::shouldTreatAsAttachement function call with the
 6 new more generic replacement WebCore::contentDispositionType.
 7
 8 See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395
 9
 10 * WebCoreSupport/FrameLoaderClientQt.cpp:
 11 (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType):
 12
1132010-03-26 Kenneth Rohde Christiansen <kenneth@webkit.org>
214
315 Reviewed by Antti Koivisto.

WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

@@WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage()
967967void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const WebCore::String& MIMEType, const WebCore::ResourceRequest&)
968968{
969969 // we need to call directly here
970  if (WebCore::shouldTreatAsAttachment(m_frame->loader()->activeDocumentLoader()->response()))
971  callPolicyFunction(function, PolicyDownload);
 970 const ResourceResponse& response = m_frame->loader()->activeDocumentLoader()->response();
 971 if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::Attachment)
 972 callPolicyFunction(function, PolicyDownload);
972973 else if (canShowMIMEType(MIMEType))
973974 callPolicyFunction(function, PolicyUse);
974975 else