Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Unified Diff: webkit/appcache/appcache_request_handler.cc

Issue 7720022: Third-party appcache blocking. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Code review comments (not all). Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/appcache/appcache_request_handler.cc
diff --git a/webkit/appcache/appcache_request_handler.cc b/webkit/appcache/appcache_request_handler.cc
index a90d6d7c0ea96d9c8b659d935c19df5c1e75f93d..a096fe54ebaf46f540642db801373d66d79cdeaa 100644
--- a/webkit/appcache/appcache_request_handler.cc
+++ b/webkit/appcache/appcache_request_handler.cc
@@ -7,6 +7,7 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job.h"
#include "webkit/appcache/appcache.h"
+#include "webkit/appcache/appcache_policy.h"
#include "webkit/appcache/appcache_url_request_job.h"
namespace appcache {
@@ -216,19 +217,22 @@ void AppCacheRequestHandler::MaybeLoadMainResource(net::URLRequest* request) {
void AppCacheRequestHandler::OnMainResponseFound(
const GURL& url, const AppCacheEntry& entry,
const GURL& fallback_url, const AppCacheEntry& fallback_entry,
- int64 cache_id, const GURL& manifest_url,
- bool was_blocked_by_policy) {
+ int64 cache_id, const GURL& manifest_url) {
DCHECK(host_);
DCHECK(is_main_resource());
DCHECK(!entry.IsForeign());
DCHECK(!fallback_entry.IsForeign());
DCHECK(!(entry.has_response_id() && fallback_entry.has_response_id()));
+ AppCachePolicy* policy = host_->service()->appcache_policy();
+ bool was_blocked_by_policy = policy &&
+ !policy->CanLoadAppCache(manifest_url, host_->first_party_url());
+
if (ResourceType::IsFrame(resource_type_)) {
if (was_blocked_by_policy)
host_->NotifyMainResourceBlocked(manifest_url);
- if (cache_id != kNoCacheId) {
+ else if (cache_id != kNoCacheId) {
// AppCacheHost loads and holds a reference to the main resource cache
// for two reasons, firstly to preload the cache into the working set
// in advance of subresource loads happening, secondly to prevent the
@@ -242,6 +246,11 @@ void AppCacheRequestHandler::OnMainResponseFound(
host_->frontend()->OnContentBlocked(host_->host_id(), manifest_url);
}
+ if (was_blocked_by_policy) {
+ DeliverNetworkResponse();
+ return;
+ }
+
// 6.11.1 Navigating across documents, steps 10 and 14.
found_entry_ = entry;

Powered by Google App Engine
This is Rietveld 408576698