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:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93923
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-08-26 Nate Chapin <japhet@chromium.org>
+
+ 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:
+
2011-08-26 Ojan Vafai <ojan@chromium.org>
change the default preferred width of the flex() function to 0px per the new spec
m_client->didFail(error);
}
-bool DocumentThreadableLoader::getShouldUseCredentialStorage(SubresourceLoader* loader, bool& shouldUseCredentialStorage)
-{
- ASSERT_UNUSED(loader, loader == m_loader || !m_loader);
-
- if (m_options.allowCredentials == DoNotAllowStoredCredentials) {
- shouldUseCredentialStorage = false;
- return true;
- }
-
- return false; // Only FrameLoaderClient can ultimately permit credential use.
-}
-
void DocumentThreadableLoader::didReceiveAuthenticationChallenge(SubresourceLoader* loader, const AuthenticationChallenge& challenge)
{
ASSERT(loader == m_loader);
virtual void didFinishLoading(SubresourceLoader*, double);
virtual void didFail(SubresourceLoader*, const ResourceError&);
- virtual bool getShouldUseCredentialStorage(SubresourceLoader*, bool& shouldUseCredentialStorage);
virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&);
void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
namespace WebCore {
MainResourceLoader::MainResourceLoader(Frame* frame)
- : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData))
+ : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials))
, m_dataLoadTimer(this, &MainResourceLoader::handleDataLoadNow)
, m_loadingMultipartContent(false)
, m_waitingForContentPolicy(false)
namespace WebCore {
NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, NetscapePlugInStreamLoaderClient* client)
- : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData))
+ : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials))
, m_client(client)
{
}
public:
friend ResourceLoadScheduler* resourceLoadScheduler();
- PassRefPtr<SubresourceLoader> scheduleSubresourceLoad(Frame*, SubresourceLoaderClient*, const ResourceRequest&, ResourceLoadPriority = ResourceLoadPriorityLow, SecurityCheckPolicy = DoSecurityCheck, const ResourceLoaderOptions& = ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData));
+ PassRefPtr<SubresourceLoader> scheduleSubresourceLoad(Frame*, SubresourceLoaderClient*, const ResourceRequest&, ResourceLoadPriority = ResourceLoadPriorityLow, SecurityCheckPolicy = DoSecurityCheck, const ResourceLoaderOptions& = ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials));
PassRefPtr<NetscapePlugInStreamLoader> schedulePluginStreamLoad(Frame*, NetscapePlugInStreamLoaderClient*, const ResourceRequest&);
void addMainResourceLoad(ResourceLoader*);
void remove(ResourceLoader*);
#endif
if (!fastMallocSize(documentLoader()->frame()))
CRASH();
+
+ if (m_options.allowCredentials == DoNotAllowStoredCredentials)
+ return false;
+
RefPtr<ResourceLoader> protector(this);
return frameLoader()->client()->shouldUseCredentialStorage(documentLoader(), identifier());
}
#ifndef ResourceLoaderOptions_h
#define ResourceLoaderOptions_h
+#include "ResourceHandle.h"
+
namespace WebCore {
enum SendCallbackPolicy {
};
struct ResourceLoaderOptions {
- ResourceLoaderOptions() : sendLoadCallbacks(DoNotSendCallbacks), sniffContent(DoNotSniffContent), shouldBufferData(BufferData) { }
- ResourceLoaderOptions(SendCallbackPolicy sendLoadCallbacksArg, ContentSniffingPolicy sniffContentArg, DataBufferingPolicy shouldBufferDataArg) : sendLoadCallbacks(sendLoadCallbacksArg), sniffContent(sniffContentArg), shouldBufferData(shouldBufferDataArg) { }
+ ResourceLoaderOptions() : sendLoadCallbacks(DoNotSendCallbacks), sniffContent(DoNotSniffContent), shouldBufferData(BufferData), allowCredentials(DoNotAllowStoredCredentials) { }
+ ResourceLoaderOptions(SendCallbackPolicy sendLoadCallbacksArg, ContentSniffingPolicy sniffContentArg, DataBufferingPolicy shouldBufferDataArg, StoredCredentials allowCredentialsArg) : sendLoadCallbacks(sendLoadCallbacksArg), sniffContent(sniffContentArg), shouldBufferData(shouldBufferDataArg), allowCredentials(allowCredentialsArg) { }
SendCallbackPolicy sendLoadCallbacks;
ContentSniffingPolicy sniffContent;
DataBufferingPolicy shouldBufferData;
+ StoredCredentials allowCredentials; // Whether HTTP credentials and cookies are sent with the request.
};
} // namespace WebCore
m_documentLoader->removeSubresourceLoader(this);
}
-bool SubresourceLoader::shouldUseCredentialStorage()
-{
- RefPtr<SubresourceLoader> protect(this);
-
- bool shouldUse;
- if (m_client && m_client->getShouldUseCredentialStorage(this, shouldUse))
- return shouldUse;
-
- return ResourceLoader::shouldUseCredentialStorage();
-}
-
void SubresourceLoader::didReceiveAuthenticationChallenge(const AuthenticationChallenge& challenge)
{
RefPtr<SubresourceLoader> protect(this);
virtual void didReceiveCachedMetadata(const char*, int);
virtual void didFinishLoading(double finishTime);
virtual void didFail(const ResourceError&);
- virtual bool shouldUseCredentialStorage();
virtual void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
virtual void willCancel(const ResourceError&);
virtual void didCancel(const ResourceError&);
virtual void didFinishLoading(SubresourceLoader*, double /*finishTime*/) { }
virtual void didFail(SubresourceLoader*, const ResourceError&) { }
- virtual bool getShouldUseCredentialStorage(SubresourceLoader*, bool& /*shouldUseCredentialStorage*/) { return false; }
virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&) { }
};
};
struct ThreadableLoaderOptions : public ResourceLoaderOptions {
- ThreadableLoaderOptions() : allowCredentials(DoNotAllowStoredCredentials), preflightPolicy(ConsiderPreflight), crossOriginRequestPolicy(DenyCrossOriginRequests) { }
- StoredCredentials allowCredentials; // Whether HTTP credentials and cookies are sent with the request.
+ ThreadableLoaderOptions() : preflightPolicy(ConsiderPreflight), crossOriginRequestPolicy(DenyCrossOriginRequests) { }
PreflightPolicy preflightPolicy; // If AccessControl is used, how to determine if a preflight is needed.
CrossOriginRequestPolicy crossOriginRequestPolicy;
RefPtr<SecurityOrigin> securityOrigin;
resourceRequest.setPriority(priority);
RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->document()->frame(), request.get(), resourceRequest, priority, securityCheck,
- ResourceLoaderOptions(sendResourceLoadCallbacks ? SendCallbacks : DoNotSendCallbacks, SniffContent, BufferData));
+ ResourceLoaderOptions(sendResourceLoadCallbacks ? SendCallbacks : DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials));
if (!loader || loader->reachedTerminalState()) {
// FIXME: What if resources in other frames were waiting for this revalidation?
LOG(ResourceLoading, "Cannot start loading '%s'", resource->url().string().latin1().data());