Changeset 93182 in webkit


Ignore:
Timestamp:
Aug 16, 2011 5:16:22 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Make it possible to explicitly prevent a preflight via ThreadableLoaderOptions
https://bugs.webkit.org/show_bug.cgi?id=65694

Patch by Per-Erik Brodin <per-erik.brodin@ericsson.com> on 2011-08-16
Reviewed by Alexey Proskuryakov.

Source/WebCore:

No new tests since there is no change in behavior.

  • fileapi/FileReaderLoader.cpp:

(WebCore::FileReaderLoader::start):

  • loader/DocumentThreadableLoader.cpp:

(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
(WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):

  • loader/ThreadableLoader.h:

(WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):

  • notifications/Notification.cpp:

(WebCore::Notification::startLoading):

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::createRequest):

Source/WebKit/chromium:

  • src/AssociatedURLLoader.cpp:

(WebKit::AssociatedURLLoader::loadAsynchronously):

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r93174 r93182  
     12011-08-16  Per-Erik Brodin  <per-erik.brodin@ericsson.com>
     2
     3        Make it possible to explicitly prevent a preflight via ThreadableLoaderOptions
     4        https://bugs.webkit.org/show_bug.cgi?id=65694
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        No new tests since there is no change in behavior.
     9
     10        * fileapi/FileReaderLoader.cpp:
     11        (WebCore::FileReaderLoader::start):
     12        * loader/DocumentThreadableLoader.cpp:
     13        (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
     14        (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
     15        * loader/ThreadableLoader.h:
     16        (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
     17        * notifications/Notification.cpp:
     18        (WebCore::Notification::startLoading):
     19        * xml/XMLHttpRequest.cpp:
     20        (WebCore::XMLHttpRequest::createRequest):
     21
    1222011-08-16  Scott Byer  <scottbyer@chromium.org>
    223
  • trunk/Source/WebCore/fileapi/FileReaderLoader.cpp

    r89036 r93182  
    8989    options.sendLoadCallbacks = true;
    9090    options.sniffContent = false;
    91     options.forcePreflight = false;
     91    options.preflightPolicy = ConsiderPreflight;
    9292    options.allowCredentials = true;
    9393    options.crossOriginRequestPolicy = DenyCrossOriginRequests;
  • trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp

    r92691 r93182  
    9999    updateRequestForAccessControl(*crossOriginRequest, securityOrigin(), m_options.allowCredentials);
    100100
    101     if (!m_options.forcePreflight && isSimpleCrossOriginAccessRequest(crossOriginRequest->httpMethod(), crossOriginRequest->httpHeaderFields()))
     101    if ((m_options.preflightPolicy == ConsiderPreflight && isSimpleCrossOriginAccessRequest(crossOriginRequest->httpMethod(), crossOriginRequest->httpHeaderFields())) || m_options.preflightPolicy == PreventPreflight)
    102102        makeSimpleCrossOriginAccessRequest(*crossOriginRequest);
    103103    else {
     
    113113void DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest(const ResourceRequest& request)
    114114{
    115     ASSERT(isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields()));
     115    ASSERT(m_options.preflightPolicy != ForcePreflight);
     116    ASSERT(m_options.preflightPolicy == PreventPreflight || isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields()));
    116117
    117118    // Cross-origin requests are only defined for HTTP. We would catch this when checking response headers later, but there is no reason to send a request that's guaranteed to be denied.
  • trunk/Source/WebCore/loader/ThreadableLoader.h

    r87423 r93182  
    5656        AllowCrossOriginRequests
    5757    };
    58    
     58
     59    enum PreflightPolicy {
     60        ConsiderPreflight,
     61        ForcePreflight,
     62        PreventPreflight
     63    };
     64
    5965    struct ThreadableLoaderOptions {
    60         ThreadableLoaderOptions() : sendLoadCallbacks(false), sniffContent(false), allowCredentials(false), forcePreflight(false), crossOriginRequestPolicy(DenyCrossOriginRequests), shouldBufferData(true) { }
     66        ThreadableLoaderOptions() : sendLoadCallbacks(false), sniffContent(false), allowCredentials(false), preflightPolicy(ConsiderPreflight), crossOriginRequestPolicy(DenyCrossOriginRequests), shouldBufferData(true) { }
    6167        bool sendLoadCallbacks;
    6268        bool sniffContent;
    6369        bool allowCredentials;  // Whether HTTP credentials and cookies are sent with the request.
    64         bool forcePreflight;  // If AccessControl is used, whether to force a preflight.
     70        PreflightPolicy preflightPolicy; // If AccessControl is used, how to determine if a preflight is needed.
    6571        CrossOriginRequestPolicy crossOriginRequestPolicy;
    6672        bool shouldBufferData;
  • trunk/Source/WebCore/notifications/Notification.cpp

    r92691 r93182  
    169169    options.sendLoadCallbacks = false;
    170170    options.sniffContent = false;
    171     options.forcePreflight = false;
     171    options.preflightPolicy = ConsiderPreflight;
    172172    options.allowCredentials = AllowStoredCredentials;
    173173    options.crossOriginRequestPolicy = AllowCrossOriginRequests;
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r92691 r93182  
    653653    options.sendLoadCallbacks = true;
    654654    options.sniffContent = false;
    655     options.forcePreflight = uploadEvents;
     655    options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight;
    656656    options.allowCredentials = m_sameOriginRequest || m_includeCredentials;
    657657    options.crossOriginRequestPolicy = UseAccessControl;
  • trunk/Source/WebKit/chromium/ChangeLog

    r93169 r93182  
     12011-08-16  Per-Erik Brodin  <per-erik.brodin@ericsson.com>
     2
     3        Make it possible to explicitly prevent a preflight via ThreadableLoaderOptions
     4        https://bugs.webkit.org/show_bug.cgi?id=65694
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * src/AssociatedURLLoader.cpp:
     9        (WebKit::AssociatedURLLoader::loadAsynchronously):
     10
    1112011-08-12  John Abd-El-Malek  <jam@chromium.org>
    212
  • trunk/Source/WebKit/chromium/src/AssociatedURLLoader.cpp

    r92083 r93182  
    230230    options.sniffContent = m_options.sniffContent;
    231231    options.allowCredentials = m_options.allowCredentials;
    232     options.forcePreflight = m_options.forcePreflight;
     232    options.preflightPolicy = m_options.forcePreflight ? ForcePreflight : ConsiderPreflight;
    233233    options.crossOriginRequestPolicy = static_cast<WebCore::CrossOriginRequestPolicy>(m_options.crossOriginRequestPolicy);
    234234    options.shouldBufferData = false;
Note: See TracChangeset for help on using the changeset viewer.