Diff
Modified: trunk/Source/WebCore/ChangeLog (93922 => 93923)
--- trunk/Source/WebCore/ChangeLog 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/ChangeLog 2011-08-26 23:31:55 UTC (rev 93923)
@@ -1,3 +1,30 @@
+2011-08-26 Nate Chapin <[email protected]>
+
+ 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 <[email protected]>
change the default preferred width of the flex() function to 0px per the new spec
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (93922 => 93923)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2011-08-26 23:31:55 UTC (rev 93923)
@@ -288,18 +288,6 @@
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);
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.h (93922 => 93923)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.h 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.h 2011-08-26 23:31:55 UTC (rev 93923)
@@ -82,7 +82,6 @@
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&);
Modified: trunk/Source/WebCore/loader/MainResourceLoader.cpp (93922 => 93923)
--- trunk/Source/WebCore/loader/MainResourceLoader.cpp 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/MainResourceLoader.cpp 2011-08-26 23:31:55 UTC (rev 93923)
@@ -60,7 +60,7 @@
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)
Modified: trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp (93922 => 93923)
--- trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp 2011-08-26 23:31:55 UTC (rev 93923)
@@ -36,7 +36,7 @@
namespace WebCore {
NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, NetscapePlugInStreamLoaderClient* client)
- : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData))
+ : ResourceLoader(frame, ResourceLoaderOptions(SendCallbacks, SniffContent, DoNotBufferData, AllowStoredCredentials))
, m_client(client)
{
}
Modified: trunk/Source/WebCore/loader/ResourceLoadScheduler.h (93922 => 93923)
--- trunk/Source/WebCore/loader/ResourceLoadScheduler.h 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/ResourceLoadScheduler.h 2011-08-26 23:31:55 UTC (rev 93923)
@@ -51,7 +51,7 @@
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*);
Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (93922 => 93923)
--- trunk/Source/WebCore/loader/ResourceLoader.cpp 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp 2011-08-26 23:31:55 UTC (rev 93923)
@@ -517,6 +517,10 @@
#endif
if (!fastMallocSize(documentLoader()->frame()))
CRASH();
+
+ if (m_options.allowCredentials == DoNotAllowStoredCredentials)
+ return false;
+
RefPtr<ResourceLoader> protector(this);
return frameLoader()->client()->shouldUseCredentialStorage(documentLoader(), identifier());
}
Modified: trunk/Source/WebCore/loader/ResourceLoaderOptions.h (93922 => 93923)
--- trunk/Source/WebCore/loader/ResourceLoaderOptions.h 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/ResourceLoaderOptions.h 2011-08-26 23:31:55 UTC (rev 93923)
@@ -31,6 +31,8 @@
#ifndef ResourceLoaderOptions_h
#define ResourceLoaderOptions_h
+#include "ResourceHandle.h"
+
namespace WebCore {
enum SendCallbackPolicy {
@@ -49,11 +51,12 @@
};
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
Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (93922 => 93923)
--- trunk/Source/WebCore/loader/SubresourceLoader.cpp 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp 2011-08-26 23:31:55 UTC (rev 93923)
@@ -234,17 +234,6 @@
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);
Modified: trunk/Source/WebCore/loader/SubresourceLoader.h (93922 => 93923)
--- trunk/Source/WebCore/loader/SubresourceLoader.h 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/SubresourceLoader.h 2011-08-26 23:31:55 UTC (rev 93923)
@@ -56,7 +56,6 @@
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&);
Modified: trunk/Source/WebCore/loader/SubresourceLoaderClient.h (93922 => 93923)
--- trunk/Source/WebCore/loader/SubresourceLoaderClient.h 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/SubresourceLoaderClient.h 2011-08-26 23:31:55 UTC (rev 93923)
@@ -51,7 +51,6 @@
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&) { }
};
Modified: trunk/Source/WebCore/loader/ThreadableLoader.h (93922 => 93923)
--- trunk/Source/WebCore/loader/ThreadableLoader.h 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/ThreadableLoader.h 2011-08-26 23:31:55 UTC (rev 93923)
@@ -60,8 +60,7 @@
};
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;
Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (93922 => 93923)
--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2011-08-26 22:55:01 UTC (rev 93922)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2011-08-26 23:31:55 UTC (rev 93923)
@@ -125,7 +125,7 @@
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());