diff options
author | Ben Murdoch <benm@google.com> | 2011-10-25 08:55:54 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-25 08:55:54 -0700 |
commit | 2a9675cb0ba09718f308bc6edff3e2b6a5170383 (patch) | |
tree | 1592b61d76ff5061f3e1ef3ee9767a87e8fc0a40 /Source/WebKit | |
parent | 5b0ee46e1ba2b63f6601cf65f96a75ba5991d768 (diff) | |
parent | e82298dad5b93e668a6dae26da91a7d2f942d0bb (diff) | |
download | external_webkit-2a9675cb0ba09718f308bc6edff3e2b6a5170383.zip external_webkit-2a9675cb0ba09718f308bc6edff3e2b6a5170383.tar.gz external_webkit-2a9675cb0ba09718f308bc6edff3e2b6a5170383.tar.bz2 |
Merge "Report a load error when network loads blocked."
Diffstat (limited to 'Source/WebKit')
4 files changed, 26 insertions, 19 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp index 2ede1ca..663ded8 100644 --- a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp @@ -34,22 +34,33 @@ using namespace WebCore; namespace android { -WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceRequest) +WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceRequest, bool shouldBlockNetworkLoads) { // Set the load flags based on the WebCore request. m_loadFlags = net::LOAD_NORMAL; - switch (resourceRequest.cachePolicy()) { - case ReloadIgnoringCacheData: - m_loadFlags |= net::LOAD_VALIDATE_CACHE; - break; - case ReturnCacheDataElseLoad: - m_loadFlags |= net::LOAD_PREFERRING_CACHE; - break; - case ReturnCacheDataDontLoad: + + if (shouldBlockNetworkLoads) { + // In the case that the embedder has blocked network loads, we only + // ever try to serve content out of the cache. If WebCore has set + // ReloadIgnoringCacheData, we would normally attempt to validate + // the cached data before serving it. In the absence of network + // we can't do that, so we will just return whatever we have in the + // cache (which may well be nothing). m_loadFlags |= net::LOAD_ONLY_FROM_CACHE; - break; - case UseProtocolCachePolicy: - break; + } else { + switch (resourceRequest.cachePolicy()) { + case ReloadIgnoringCacheData: + m_loadFlags |= net::LOAD_VALIDATE_CACHE; + break; + case ReturnCacheDataElseLoad: + m_loadFlags |= net::LOAD_PREFERRING_CACHE; + break; + case ReturnCacheDataDontLoad: + m_loadFlags |= net::LOAD_ONLY_FROM_CACHE; + break; + case UseProtocolCachePolicy: + break; + } } // TODO: We should consider setting these flags and net::LOAD_DO_NOT_SEND_AUTH_DATA diff --git a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.h b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.h index 38f37b5..7911f02 100644 --- a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.h +++ b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.h @@ -39,7 +39,7 @@ namespace android { class WebResourceRequest { public: - WebResourceRequest(const WebCore::ResourceRequest&); + WebResourceRequest(const WebCore::ResourceRequest&, bool shouldBlockNetworkLoads); const std::string& method() const { diff --git a/Source/WebKit/android/WebCoreSupport/WebUrlLoader.cpp b/Source/WebKit/android/WebCoreSupport/WebUrlLoader.cpp index 0c90bc5..f81fa34 100644 --- a/Source/WebKit/android/WebCoreSupport/WebUrlLoader.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebUrlLoader.cpp @@ -50,11 +50,6 @@ PassRefPtr<WebUrlLoader> WebUrlLoader::start(FrameLoaderClient* client, WebCore: FrameLoaderClientAndroid* androidClient = static_cast<FrameLoaderClientAndroid*>(client); WebFrame* webFrame = androidClient->webFrame(); - if (webFrame->blockNetworkLoads() && - (resourceRequest.url().protocolIs("http") || - resourceRequest.url().protocolIs("https"))) - return NULL; - webFrame->maybeSavePassword(androidClient->getFrame(), resourceRequest); RefPtr<WebUrlLoader> loader = WebUrlLoader::create(webFrame, resourceHandle, resourceRequest); diff --git a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp index 56a9539..a6e58c8 100644 --- a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp @@ -110,7 +110,8 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand , m_sync(false) , m_finished(false) { - WebResourceRequest webResourceRequest(resourceRequest); + bool block = webFrame->blockNetworkLoads() && (resourceRequest.url().protocolIs("http") || resourceRequest.url().protocolIs("https")); + WebResourceRequest webResourceRequest(resourceRequest, block); UrlInterceptResponse* intercept = webFrame->shouldInterceptRequest(resourceRequest.url().string()); if (intercept) { m_request = new WebRequest(this, webResourceRequest, intercept); |