Index: webkit/browser/appcache/appcache_request_handler.cc |
diff --git a/webkit/browser/appcache/appcache_request_handler.cc b/webkit/browser/appcache/appcache_request_handler.cc |
index d2367ceb00d33842f1427b1de199f7653d95c145..2bb0aefffc02f45e88b04bb5362381cb11cc7852 100644 |
--- a/webkit/browser/appcache/appcache_request_handler.cc |
+++ b/webkit/browser/appcache/appcache_request_handler.cc |
@@ -36,7 +36,8 @@ AppCacheStorage* AppCacheRequestHandler::storage() const { |
void AppCacheRequestHandler::GetExtraResponseInfo( |
int64* cache_id, GURL* manifest_url) { |
- if (job_.get() && job_->is_delivering_appcache_response()) { |
+ if (job_.get() && (job_->is_delivering_appcache_response() || |
+ job_->is_delivering_synthesized_response())) { |
*cache_id = job_->cache_id(); |
*manifest_url = job_->manifest_url(); |
} |
@@ -56,13 +57,16 @@ AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadResource( |
// which will call thru to our interception layer again. |
// This time thru, we return NULL so the request hits the wire. |
if (job_.get()) { |
- DCHECK(job_->is_delivering_network_response() || |
- job_->cache_entry_not_found()); |
+ // Note: no longer valid since we can generate 302s now. |
+ //DCHECK(job_->is_delivering_network_response() || |
+ // job_->cache_entry_not_found()); |
+ bool use_network = job_->is_delivering_network_response(); |
if (job_->cache_entry_not_found()) |
cache_entry_not_found_ = true; |
job_ = NULL; |
storage()->CancelDelegateCallbacks(this); |
- return NULL; |
+ if (use_network) |
+ return NULL; |
} |
// Clear out our 'found' fields since we're starting a request for a |
@@ -192,6 +196,11 @@ void AppCacheRequestHandler::DeliverAppCachedResponse( |
if (ResourceType::IsFrame(resource_type_) && !namespace_entry_url.is_empty()) |
host_->NotifyMainResourceIsNamespaceEntry(namespace_entry_url); |
+ // Executable handler hackery to distinguish between main vs sub resource |
+ // loads in the handler script. |
+ if (entry.IsExecutable()) |
+ job_->set_is_main_resource_load(is_main_resource()); |
+ |
job_->DeliverAppCachedResponse(manifest_url, group_id, cache_id, |
entry, is_fallback); |
} |
@@ -317,6 +326,22 @@ void AppCacheRequestHandler::ContinueMaybeLoadSubResource() { |
DCHECK(job_.get()); |
DCHECK(host_->associated_cache() && host_->associated_cache()->is_complete()); |
+ // Hackery for navcontroller semantics where the controller gets a crack |
+ // and any and all subresource requests <period>. |
+ if (host_->associated_cache()->owning_group()->IsFakeNavControllerGroup()) { |
+ // We assume there's one entry and its the controller script. |
+ AppCache* cache = host_->associated_cache(); |
+ found_cache_id_ = cache->cache_id(); |
+ found_group_id_ = cache->owning_group()->group_id(); |
+ found_manifest_url_ = cache->owning_group()->manifest_url(); |
+ found_entry_ = cache->entries().begin()->second; |
+ DCHECK(found_entry_.IsExecutable()); |
+ DeliverAppCachedResponse( |
+ found_entry_, found_cache_id_, found_group_id_, found_manifest_url_, |
+ false, GURL()); |
+ return; |
+ } |
+ |
const GURL& url = job_->request()->url(); |
AppCache* cache = host_->associated_cache(); |
storage()->FindResponseForSubRequest( |