summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-24 19:15:32 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-24 19:15:32 +0000
commitdc033989801c1233e5488bbcfcd878dcb4fc3c1c (patch)
tree5a6bd50071b337bd553def9adb36a58359c4b43d /webkit/appcache
parent0956a677730969bcb31216147999bf66894eaa21 (diff)
downloadchromium_src-dc033989801c1233e5488bbcfcd878dcb4fc3c1c.zip
chromium_src-dc033989801c1233e5488bbcfcd878dcb4fc3c1c.tar.gz
chromium_src-dc033989801c1233e5488bbcfcd878dcb4fc3c1c.tar.bz2
When an individual entry is lost from the appache's diskcache, attempts to load that resource will fallthru to the network instead of promptly failing. See bug 50657. This is just a first step, a repair step will follow on in a future change.
BUG=50657 TEST=none Review URL: http://codereview.chromium.org/3187017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache_request_handler.cc3
-rw-r--r--webkit/appcache/appcache_url_request_job.cc13
-rw-r--r--webkit/appcache/appcache_url_request_job.h6
3 files changed, 17 insertions, 5 deletions
diff --git a/webkit/appcache/appcache_request_handler.cc b/webkit/appcache/appcache_request_handler.cc
index 432534b..79f8909 100644
--- a/webkit/appcache/appcache_request_handler.cc
+++ b/webkit/appcache/appcache_request_handler.cc
@@ -53,7 +53,8 @@ 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_) {
- DCHECK(job_->is_delivering_network_response());
+ DCHECK(job_->is_delivering_network_response() ||
+ job_->cache_entry_not_found());
job_ = NULL;
return NULL;
}
diff --git a/webkit/appcache/appcache_url_request_job.cc b/webkit/appcache/appcache_url_request_job.cc
index b4be06a..50549e5 100644
--- a/webkit/appcache/appcache_url_request_job.cc
+++ b/webkit/appcache/appcache_url_request_job.cc
@@ -23,8 +23,8 @@ AppCacheURLRequestJob::AppCacheURLRequestJob(
: URLRequestJob(request), storage_(storage),
has_been_started_(false), has_been_killed_(false),
delivery_type_(AWAITING_DELIVERY_ORDERS),
- cache_id_(kNoCacheId),
- is_fallback_(false),
+ cache_id_(kNoCacheId), is_fallback_(false),
+ cache_entry_not_found_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_(
this, &AppCacheURLRequestJob::OnReadComplete)) {
DCHECK(storage_);
@@ -122,8 +122,13 @@ void AppCacheURLRequestJob::OnResponseInfoLoaded(
NotifyHeadersComplete();
} else {
- NotifyStartError(
- URLRequestStatus(URLRequestStatus::FAILED, net::ERR_FAILED));
+ // A resource that is expected to be in the appcache is missing.
+ // See http://code.google.com/p/chromium/issues/detail?id=50657
+ // Instead of failing the request, we restart the request. The retry
+ // attempt will fallthru to the network instead of trying to load
+ // from the appcache.
+ cache_entry_not_found_ = true;
+ NotifyRestartRequired();
}
storage_ = NULL; // no longer needed
}
diff --git a/webkit/appcache/appcache_url_request_job.h b/webkit/appcache/appcache_url_request_job.h
index 5e7dce2..8593ca1 100644
--- a/webkit/appcache/appcache_url_request_job.h
+++ b/webkit/appcache/appcache_url_request_job.h
@@ -69,6 +69,11 @@ class AppCacheURLRequestJob : public URLRequestJob,
return has_been_killed_;
}
+ // Returns true if the cache entry was not found in the disk cache.
+ bool cache_entry_not_found() const {
+ return cache_entry_not_found_;
+ }
+
private:
friend class AppCacheRequestHandlerTest;
friend class AppCacheURLRequestJobTest;
@@ -132,6 +137,7 @@ class AppCacheURLRequestJob : public URLRequestJob,
int64 cache_id_;
AppCacheEntry entry_;
bool is_fallback_;
+ bool cache_entry_not_found_;
scoped_refptr<AppCacheResponseInfo> info_;
net::HttpByteRange range_requested_;
scoped_ptr<net::HttpResponseInfo> range_response_info_;