Changeset 93923 in webkit


Ignore:
Timestamp:
Aug 26, 2011 4:31:55 PM (13 years ago)
Author:
Nate Chapin
Message:

Move allowCredentials from ThreadableLoaderOptions down
to ResourceLoaderOptions. This allows us to remove
getShouldUseCredentialStorage() from SubresourceLoaderClient
and check allowCredentials in ResourceLoader.
https://bugs.webkit.org/show_bug.cgi?id=65330

Reviewed by Alexey Proskuryakov.

No new tests, refractor only.

  • loader/DocumentThreadableLoader.cpp:
  • loader/DocumentThreadableLoader.h:
  • loader/MainResourceLoader.cpp:
  • loader/NetscapePlugInStreamLoader.cpp:
  • loader/ResourceLoadScheduler.h:
  • loader/ResourceLoader.cpp:

(WebCore::ResourceLoader::shouldUseCredentialStorage): Check

m_options.allowCredentials instead of calling a client.

  • loader/ResourceLoaderOptions.h:
  • loader/SubresourceLoader.cpp:
  • loader/SubresourceLoader.h:
  • loader/SubresourceLoaderClient.h:
  • loader/ThreadableLoader.h:
  • loader/cache/CachedResourceRequest.cpp:
Location:
trunk/Source/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r93921 r93923  
     12011-08-26  Nate Chapin  <japhet@chromium.org>
     2
     3        Move allowCredentials from ThreadableLoaderOptions down
     4        to ResourceLoaderOptions. This allows us to remove
     5        getShouldUseCredentialStorage() from SubresourceLoaderClient
     6        and check allowCredentials in ResourceLoader.
     7        https://bugs.webkit.org/show_bug.cgi?id=65330
     8
     9        Reviewed by Alexey Proskuryakov.
     10
     11        No new tests, refractor only.
     12
     13        * loader/DocumentThreadableLoader.cpp:
     14        * loader/DocumentThreadableLoader.h:
     15        * loader/MainResourceLoader.cpp:
     16        * loader/NetscapePlugInStreamLoader.cpp:
     17        * loader/ResourceLoadScheduler.h:
     18        * loader/ResourceLoader.cpp:
     19        (WebCore::ResourceLoader::shouldUseCredentialStorage): Check
     20            m_options.allowCredentials instead of calling a client.
     21        * loader/ResourceLoaderOptions.h:
     22        * loader/SubresourceLoader.cpp:
     23        * loader/SubresourceLoader.h:
     24        * loader/SubresourceLoaderClient.h:
     25        * loader/ThreadableLoader.h:
     26        * loader/cache/CachedResourceRequest.cpp:
     27
    1282011-08-26  Ojan Vafai  <ojan@chromium.org>
    229
  • trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp

    r93886 r93923  
    289289}
    290290
    291 bool DocumentThreadableLoader::getShouldUseCredentialStorage(SubresourceLoader* loader, bool& shouldUseCredentialStorage)
    292 {
    293     ASSERT_UNUSED(loader, loader == m_loader || !m_loader);
    294 
    295     if (m_options.allowCredentials == DoNotAllowStoredCredentials) {
    296         shouldUseCredentialStorage = false;
    297         return true;
    298     }
    299 
    300     return false; // Only FrameLoaderClient can ultimately permit credential use.
    301 }
    302 
    303291void DocumentThreadableLoader::didReceiveAuthenticationChallenge(SubresourceLoader* loader, const AuthenticationChallenge& challenge)
    304292{
  • trunk/Source/WebCore/loader/DocumentThreadableLoader.h

    r92691 r93923  
    8383        virtual void didFail(SubresourceLoader*, const ResourceError&);
    8484
    85         virtual bool getShouldUseCredentialStorage(SubresourceLoader*, bool& shouldUseCredentialStorage);
    8685        virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&);
    8786
  • trunk/Source/WebCore/loader/MainResourceLoader.cpp

    r93886 r93923  
    6161
    6262MainResourceLoader::MainResourceLoader(Frame* frame)
    63     : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData))
     63    : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials))
    6464    , m_dataLoadTimer(this, &MainResourceLoader::handleDataLoadNow)
    6565    , m_loadingMultipartContent(false)
  • trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp

    r93886 r93923  
    3737
    3838NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, NetscapePlugInStreamLoaderClient* client)
    39     : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData))
     39    : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials))
    4040    , m_client(client)
    4141{
  • trunk/Source/WebCore/loader/ResourceLoadScheduler.h

    r93886 r93923  
    5252    friend ResourceLoadScheduler* resourceLoadScheduler();
    5353
    54     PassRefPtr<SubresourceLoader> scheduleSubresourceLoad(Frame*, SubresourceLoaderClient*, const ResourceRequest&, ResourceLoadPriority = ResourceLoadPriorityLow, SecurityCheckPolicy = DoSecurityCheck, const ResourceLoaderOptions& = ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData));
     54    PassRefPtr<SubresourceLoader> scheduleSubresourceLoad(Frame*, SubresourceLoaderClient*, const ResourceRequest&, ResourceLoadPriority = ResourceLoadPriorityLow, SecurityCheckPolicy = DoSecurityCheck, const ResourceLoaderOptions& = ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials));
    5555    PassRefPtr<NetscapePlugInStreamLoader> schedulePluginStreamLoad(Frame*, NetscapePlugInStreamLoaderClient*, const ResourceRequest&);
    5656    void addMainResourceLoad(ResourceLoader*);
  • trunk/Source/WebCore/loader/ResourceLoader.cpp

    r93886 r93923  
    518518    if (!fastMallocSize(documentLoader()->frame()))
    519519        CRASH();
     520
     521    if (m_options.allowCredentials == DoNotAllowStoredCredentials)
     522        return false;
     523   
    520524    RefPtr<ResourceLoader> protector(this);
    521525    return frameLoader()->client()->shouldUseCredentialStorage(documentLoader(), identifier());
  • trunk/Source/WebCore/loader/ResourceLoaderOptions.h

    r93886 r93923  
    3232#define ResourceLoaderOptions_h
    3333
     34#include "ResourceHandle.h"
     35
    3436namespace WebCore {
    3537   
     
    5052
    5153struct ResourceLoaderOptions {
    52     ResourceLoaderOptions() : sendLoadCallbacks(DoNotSendCallbacks), sniffContent(DoNotSniffContent), shouldBufferData(BufferData) { }
    53     ResourceLoaderOptions(SendCallbackPolicy sendLoadCallbacksArg, ContentSniffingPolicy sniffContentArg, DataBufferingPolicy shouldBufferDataArg) : sendLoadCallbacks(sendLoadCallbacksArg), sniffContent(sniffContentArg), shouldBufferData(shouldBufferDataArg) { }
     54    ResourceLoaderOptions() : sendLoadCallbacks(DoNotSendCallbacks), sniffContent(DoNotSniffContent), shouldBufferData(BufferData), allowCredentials(DoNotAllowStoredCredentials) { }
     55    ResourceLoaderOptions(SendCallbackPolicy sendLoadCallbacksArg, ContentSniffingPolicy sniffContentArg, DataBufferingPolicy shouldBufferDataArg, StoredCredentials allowCredentialsArg) : sendLoadCallbacks(sendLoadCallbacksArg), sniffContent(sniffContentArg), shouldBufferData(shouldBufferDataArg), allowCredentials(allowCredentialsArg) { }
    5456    SendCallbackPolicy sendLoadCallbacks;
    5557    ContentSniffingPolicy sniffContent;
    5658    DataBufferingPolicy shouldBufferData;
     59    StoredCredentials allowCredentials; // Whether HTTP credentials and cookies are sent with the request.
    5760};
    5861
  • trunk/Source/WebCore/loader/SubresourceLoader.cpp

    r93811 r93923  
    235235}
    236236
    237 bool SubresourceLoader::shouldUseCredentialStorage()
    238 {
    239     RefPtr<SubresourceLoader> protect(this);
    240 
    241     bool shouldUse;
    242     if (m_client && m_client->getShouldUseCredentialStorage(this, shouldUse))
    243         return shouldUse;
    244 
    245     return ResourceLoader::shouldUseCredentialStorage();
    246 }
    247 
    248237void SubresourceLoader::didReceiveAuthenticationChallenge(const AuthenticationChallenge& challenge)
    249238{
  • trunk/Source/WebCore/loader/SubresourceLoader.h

    r93811 r93923  
    5757        virtual void didFinishLoading(double finishTime);
    5858        virtual void didFail(const ResourceError&);
    59         virtual bool shouldUseCredentialStorage();
    6059        virtual void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
    6160        virtual void willCancel(const ResourceError&);
  • trunk/Source/WebCore/loader/SubresourceLoaderClient.h

    r92691 r93923  
    5252    virtual void didFail(SubresourceLoader*, const ResourceError&) { }
    5353   
    54     virtual bool getShouldUseCredentialStorage(SubresourceLoader*, bool& /*shouldUseCredentialStorage*/) { return false; }
    5554    virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&) { }
    5655};
  • trunk/Source/WebCore/loader/ThreadableLoader.h

    r93886 r93923  
    6161
    6262    struct ThreadableLoaderOptions : public ResourceLoaderOptions {
    63         ThreadableLoaderOptions() : allowCredentials(DoNotAllowStoredCredentials), preflightPolicy(ConsiderPreflight), crossOriginRequestPolicy(DenyCrossOriginRequests) { }
    64         StoredCredentials allowCredentials; // Whether HTTP credentials and cookies are sent with the request.
     63        ThreadableLoaderOptions() : preflightPolicy(ConsiderPreflight), crossOriginRequestPolicy(DenyCrossOriginRequests) { }
    6564        PreflightPolicy preflightPolicy; // If AccessControl is used, how to determine if a preflight is needed.
    6665        CrossOriginRequestPolicy crossOriginRequestPolicy;
  • trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp

    r93886 r93923  
    126126
    127127    RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->document()->frame(), request.get(), resourceRequest, priority, securityCheck,
    128                                                                                         ResourceLoaderOptions(sendResourceLoadCallbacks ? SendCallbacks : DoNotSendCallbacks, SniffContent, BufferData));
     128                                                                                        ResourceLoaderOptions(sendResourceLoadCallbacks ? SendCallbacks : DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials));
    129129    if (!loader || loader->reachedTerminalState()) {
    130130        // FIXME: What if resources in other frames were waiting for this revalidation?
Note: See TracChangeset for help on using the changeset viewer.