summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_update_job.cc
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 01:18:33 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 01:18:33 +0000
commit309a0c3bc90e0348a13727c30c15f39d06896d84 (patch)
tree1fc86d18f25138240e0c122303f39eed7c776b38 /webkit/appcache/appcache_update_job.cc
parent8da48de08e490c3574dc0bd2f3585797c2cfe115 (diff)
downloadchromium_src-309a0c3bc90e0348a13727c30c15f39d06896d84.zip
chromium_src-309a0c3bc90e0348a13727c30c15f39d06896d84.tar.gz
chromium_src-309a0c3bc90e0348a13727c30c15f39d06896d84.tar.bz2
A better error message for the mime type of a manifest file being off.
BUG=none TEST=manual Review URL: http://codereview.chromium.org/3076005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_update_job.cc')
-rw-r--r--webkit/appcache/appcache_update_job.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc
index a112310..3cf5964 100644
--- a/webkit/appcache/appcache_update_job.cc
+++ b/webkit/appcache/appcache_update_job.cc
@@ -507,12 +507,16 @@ void AppCacheUpdateJob::HandleManifestFetchCompleted(URLRequest* request) {
int response_code = -1;
std::string mime_type;
+ bool is_valid_response_code = false;
+ bool is_valid_mime_type = false;
if (request->status().is_success()) {
response_code = request->GetResponseCode();
+ is_valid_response_code = (response_code / 100 == 2);
request->GetMimeType(&mime_type);
+ is_valid_mime_type = (mime_type == kManifestMimeType);
}
- if ((response_code / 100 == 2) && mime_type == kManifestMimeType) {
+ if (is_valid_response_code && is_valid_mime_type) {
manifest_response_info_.reset(
new net::HttpResponseInfo(request->response_info()));
if (update_type_ == UPGRADE_ATTEMPT)
@@ -524,9 +528,17 @@ void AppCacheUpdateJob::HandleManifestFetchCompleted(URLRequest* request) {
} else if (response_code == 404 || response_code == 410) {
service_->storage()->MakeGroupObsolete(group_, this); // async
} else {
- const char* kFormatString = "Manifest fetch failed (%d) %s";
- const std::string message = StringPrintf(kFormatString, response_code,
- manifest_url_.spec().c_str());
+ std::string message;
+ if (!is_valid_response_code) {
+ const char* kFormatString = "Manifest fetch failed (%d) %s";
+ message = StringPrintf(kFormatString, response_code,
+ manifest_url_.spec().c_str());
+ } else {
+ DCHECK(!is_valid_mime_type);
+ const char* kFormatString = "Invalid manifest mime type (%s) %s";
+ message = StringPrintf(kFormatString, mime_type.c_str(),
+ manifest_url_.spec().c_str());
+ }
HandleCacheFailure(message);
}
}