Chromium Code Reviews| Index: webkit/appcache/appcache_host.cc |
| diff --git a/webkit/appcache/appcache_host.cc b/webkit/appcache/appcache_host.cc |
| index cb040ef0dd681472f9197704dc415344240c1379..882c9f4161b584ed17dde9b88fc8750b9bd0bdc7 100644 |
| --- a/webkit/appcache/appcache_host.cc |
| +++ b/webkit/appcache/appcache_host.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/stringprintf.h" |
| #include "webkit/appcache/appcache.h" |
| #include "webkit/appcache/appcache_backend_impl.h" |
| +#include "webkit/appcache/appcache_policy.h" |
| #include "webkit/appcache/appcache_request_handler.h" |
| #include "webkit/quota/quota_manager.h" |
| @@ -95,6 +96,12 @@ void AppCacheHost::SelectCache(const GURL& document_url, |
| if (!manifest_url.is_empty() && |
| (manifest_url.GetOrigin() == document_url.GetOrigin())) { |
|
michaeln
2011/08/31 23:42:08
maybe DCHECK(!first_party_url_.empty());
marja
2011/09/02 13:40:24
Done. For this, I also needed to add a call to Cre
|
| + AppCachePolicy* policy = service()->appcache_policy(); |
| + if (policy && |
| + !policy->CanCreateAppCache(manifest_url, first_party_url_)) { |
|
michaeln
2011/08/31 23:42:08
We need to call FinishCacheSelection(NULL,NULL) in
marja
2011/09/02 13:40:24
Done.
|
| + return; |
| + } |
| + |
| // Note: The client detects if the document was not loaded using HTTP GET |
| // and invokes SelectCache without a manifest url, so that detection step |
| // is also skipped here. See WebApplicationCacheHostImpl.cc |
| @@ -260,6 +267,10 @@ AppCacheHost* AppCacheHost::GetParentAppCacheHost() const { |
| AppCacheRequestHandler* AppCacheHost::CreateRequestHandler( |
| net::URLRequest* request, |
| ResourceType::Type resource_type) { |
| + // Store the first party origin so that it can be used later in SelectCache |
| + // for checking whether the creation of the appcache is allowed. |
| + first_party_url_ = request->first_party_for_cookies(); |
|
michaeln
2011/08/31 23:42:08
Can this be moved down into the if (IsMainResource
marja
2011/09/02 13:40:24
Done.
|
| + |
| if (is_for_dedicated_worker()) { |
| AppCacheHost* parent_host = GetParentAppCacheHost(); |
| if (parent_host) |
| @@ -267,8 +278,9 @@ AppCacheRequestHandler* AppCacheHost::CreateRequestHandler( |
| return NULL; |
| } |
| - if (AppCacheRequestHandler::IsMainResourceType(resource_type)) |
| + if (AppCacheRequestHandler::IsMainResourceType(resource_type)) { |
| return new AppCacheRequestHandler(this, resource_type); |
| + } |
| if ((associated_cache() && associated_cache()->is_complete()) || |
| is_selection_pending()) { |