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 0f123a134bb52fe16ad9d8da5966f7b9e4a89d9d..a50005c92d347200890a7c5e1baa17d9a60fa981 100644 |
| --- a/webkit/appcache/appcache_request_handler.cc |
| +++ b/webkit/appcache/appcache_request_handler.cc |
| @@ -17,7 +17,7 @@ AppCacheRequestHandler::AppCacheRequestHandler( |
| : host_(host), resource_type_(resource_type), |
| is_waiting_for_cache_selection_(false), found_group_id_(0), |
| found_cache_id_(0), found_network_namespace_(false), |
| - cache_entry_not_found_(false) { |
| + cache_entry_not_found_(false), maybe_load_resource_executed_(false) { |
| DCHECK(host_); |
| host_->AddObserver(this); |
| } |
| @@ -44,6 +44,7 @@ void AppCacheRequestHandler::GetExtraResponseInfo( |
| AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadResource( |
| net::URLRequest* request) { |
| + maybe_load_resource_executed_ = true; |
| if (!host_ || !IsSchemeAndMethodSupported(request) || cache_entry_not_found_) |
| return NULL; |
| @@ -99,6 +100,14 @@ AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect( |
| DCHECK(!job_); // our jobs never generate redirects |
| + if (!maybe_load_resource_executed_) { |
| + // If MaybeLoadResource was not executed, we did not see this request |
| + // before redirect. We need to call MaybeLoadResource to fill our 'found' |
| + // data members and handle things we should have chance to handle before |
| + // the redirect. |
| + return MaybeLoadResource(request); |
|
michaeln
2012/08/25 01:33:41
How is the 'fallback' behavior triggered if we go
|
| + } |
| + |
| if (found_fallback_entry_.has_response_id()) { |
| // 6.9.6, step 4: If this results in a redirect to another origin, |
| // get the resource of the fallback entry. |
| @@ -305,7 +314,7 @@ void AppCacheRequestHandler::ContinueMaybeLoadSubResource() { |
| DCHECK(host_->associated_cache() && |
| host_->associated_cache()->is_complete()); |
| - const GURL& url = job_->request()->url(); |
| + const GURL& url = job_->request()->original_url(); |
|
michaeln
2012/08/25 01:33:42
It doesn't look like will work when following a ch
|
| AppCache* cache = host_->associated_cache(); |
| storage()->FindResponseForSubRequest( |
| host_->associated_cache(), url, |
| @@ -325,6 +334,16 @@ void AppCacheRequestHandler::ContinueMaybeLoadSubResource() { |
| } |
| if (found_fallback_entry_.has_response_id()) { |
| + // First check whether this is in fact a redirected request. If it is then |
| + // we were got here through MaybeLoadFallbackForRedirect. |
| + if (job_->request()->url_chain().size() > 1) { |
| + // 6.9.6, step 4: If this results in a redirect to another origin, |
| + // get the resource of the fallback entry. |
| + DeliverAppCachedResponse( |
| + found_fallback_entry_, found_cache_id_, found_group_id_, |
| + found_manifest_url_, true, found_namespace_entry_url_); |
| + return; |
| + } |
| // Step 4: Fetch the resource normally, if this results |
| // in certain conditions, then use the fallback. |
| DCHECK(!found_network_namespace_ && |