Changeset 57208 in webkit


Ignore:
Timestamp:
Apr 7, 2010 7:14:27 AM (14 years ago)
Author:
Simon Hausmann
Message:

https://bugs.webkit.org/show_bug.cgi?id=36827

Patch by Dawit Alemayehu <adawit@kde.org> on 2010-04-07
Reviewed by Simon Hausmann.

WebCore:

Replaced the 'shouldTreatAsAttachment' function with a more generic
function that returns the content disposition type.

See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395

  • platform/network/HTTPParsers.cpp:

(WebCore::contentDispositionType):

  • platform/network/HTTPParsers.h:

(WebCore::):

WebKit/chromium:

Updated the WebCore::shouldTreatAsAttachement function call with the
new more generic replacement WebCore::contentDispositionType.

See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395

  • src/FrameLoaderClientImpl.cpp:

(WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType):

WebKit/qt:

Updated the WebCore::shouldTreatAsAttachement function call with the
new more generic replacement WebCore::contentDispositionType.

See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395

  • WebCoreSupport/FrameLoaderClientQt.cpp:

(WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType):

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57207 r57208  
     12010-04-07  Dawit Alemayehu  <adawit@kde.org>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=36827
     6
     7        Replaced the 'shouldTreatAsAttachment' function with a more generic
     8        function that returns the content disposition type.
     9
     10        See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395
     11
     12        * platform/network/HTTPParsers.cpp:
     13        (WebCore::contentDispositionType):
     14        * platform/network/HTTPParsers.h:
     15        (WebCore::):
     16
    1172010-04-07  Vitaly Repeshko  <vitalyr@chromium.org>
    218
  • trunk/WebCore/platform/network/HTTPParsers.cpp

    r56825 r57208  
    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 ContentDispositionNone;
    8179
    8280    // Some broken sites just send
     
    8482    // screen those out here.
    8583    if (contentDisposition.startsWith(";"))
    86         return false;
     84        return ContentDispositionNone;
    8785
    8886    if (contentDisposition.startsWith("inline", false))
    89         return false;
     87        return ContentDispositionInline;
    9088
    9189    // Some broken sites just send
     
    9391    // without a disposition token... screen those out.
    9492    if (contentDisposition.startsWith("filename", false))
    95         return false;
     93        return ContentDispositionNone;
    9694
    9795    // Also in use is Content-Disposition: name="file"
    9896    if (contentDisposition.startsWith("name", false))
    99         return false;
     97        return ContentDispositionNone;
    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 ContentDispositionAttachment
    105103}
    106104
  • trunk/WebCore/platform/network/HTTPParsers.h

    r56750 r57208  
    4242};
    4343
     44typedef enum {
     45    ContentDispositionNone,
     46    ContentDispositionInline,
     47    ContentDispositionAttachment,
     48    ContentDispositionOther
     49} ContentDispositionType;
    4450
    45 bool shouldTreatAsAttachment(const ResourceResponseBase& response);
     51ContentDispositionType contentDispositionType(const String&);
    4652bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url);
    4753double parseDate(const String&);
  • trunk/WebKit/chromium/ChangeLog

    r57197 r57208  
     12010-04-07  Dawit Alemayehu  <adawit@kde.org>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=36827
     6
     7        Updated the WebCore::shouldTreatAsAttachement function call with the
     8        new more generic replacement WebCore::contentDispositionType.
     9
     10        See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395
     11
     12        * src/FrameLoaderClientImpl.cpp:
     13        (WebKit::FrameLoaderClientImpl::dispatchDecidePolicyForMIMEType):
     14
    1152010-04-07  Jochen Eisinger  <jochen@chromium.org>
    216
  • trunk/WebKit/chromium/src/FrameLoaderClientImpl.cpp

    r56849 r57208  
    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::ContentDispositionAttachment) {
    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
  • trunk/WebKit/qt/ChangeLog

    r57202 r57208  
     12010-04-07  Dawit Alemayehu  <adawit@kde.org>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=36827
     6
     7        Updated the WebCore::shouldTreatAsAttachement function call with the
     8        new more generic replacement WebCore::contentDispositionType.
     9
     10        See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395
     11
     12        * WebCoreSupport/FrameLoaderClientQt.cpp:
     13        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType):
     14
    1152010-04-07  Andreas Kling  <andreas.kling@nokia.com>
    216
  • trunk/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

    r57202 r57208  
    970970{
    971971    // we need to call directly here
    972     if (WebCore::shouldTreatAsAttachment(m_frame->loader()->activeDocumentLoader()->response()))
    973         callPolicyFunction(function, PolicyDownload);   
     972    const ResourceResponse& response = m_frame->loader()->activeDocumentLoader()->response();
     973    if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment)
     974        callPolicyFunction(function, PolicyDownload);
    974975    else if (canShowMIMEType(MIMEType))
    975976        callPolicyFunction(function, PolicyUse);
Note: See TracChangeset for help on using the changeset viewer.