Chromium Code Reviews| 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..44f4a22a104b4eece4125cca0bc3608022fe337e 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,21 @@ 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 = !manifest_url.is_empty() && policy && |
| + !policy->CanLoadAppCache(manifest_url, host_->first_party_url()); |
| + |
|
michaeln
2011/09/05 19:49:31
it may be more readable to hoist all of this was_b
marja
2011/09/06 09:09:28
Done.
|
| if (ResourceType::IsFrame(resource_type_)) { |
| if (was_blocked_by_policy) |
|
michaeln
2011/09/05 19:49:31
style: since the else clause needs {'s, this if cl
marja
2011/09/06 09:09:28
Gone.
|
| 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 +245,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; |