Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: webkit/appcache/appcache_update_job.cc

Issue 3076005: A better error message for the mime type of a manifest file being off.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_update_job.cc
===================================================================
--- webkit/appcache/appcache_update_job.cc (revision 53742)
+++ webkit/appcache/appcache_update_job.cc (working copy)
@@ -507,12 +507,16 @@
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 @@
} 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);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698