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

Unified Diff: webkit/browser/appcache/appcache_update_job.cc

Issue 276093003: appcache content-type check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: webkit/browser/appcache/appcache_update_job.cc
diff --git a/webkit/browser/appcache/appcache_update_job.cc b/webkit/browser/appcache/appcache_update_job.cc
index 0cd087ec80d6af499eab44dede9ef55bf981988e..83aa857b4e14976b1e750b42604d1f46aa12784a 100644
--- a/webkit/browser/appcache/appcache_update_job.cc
+++ b/webkit/browser/appcache/appcache_update_job.cc
@@ -339,6 +339,7 @@ AppCacheUpdateJob::AppCacheUpdateJob(AppCacheService* service,
master_entries_completed_(0),
url_fetches_completed_(0),
manifest_fetcher_(NULL),
+ manifest_has_valid_mime_type_(false),
stored_state_(UNSTORED),
storage_(service->storage()) {
service_->AddObserver(this);
@@ -489,6 +490,11 @@ void AppCacheUpdateJob::HandleManifestFetchCompleted(
if (request->status().is_success()) {
response_code = request->GetResponseCode();
is_valid_response_code = (response_code / 100 == 2);
+
+ std::string mime_type;
+ request->GetMimeType(&mime_type);
+ const char kManifestMimeType[] = "text/cache-manifest";
+ manifest_has_valid_mime_type_ = (mime_type == kManifestMimeType);
darin (slow to review) 2014/05/12 23:45:32 nit: I probably wouldn't have bothered with the na
}
if (is_valid_response_code) {
@@ -561,7 +567,8 @@ void AppCacheUpdateJob::ContinueHandleManifestFetchCompleted(bool changed) {
Manifest manifest;
if (!ParseManifest(manifest_url_, manifest_data_.data(),
- manifest_data_.length(), manifest)) {
+ manifest_data_.length(), manifest_has_valid_mime_type_,
+ manifest)) {
const char* kFormatString = "Failed to parse manifest %s";
const std::string message = base::StringPrintf(kFormatString,
manifest_url_.spec().c_str());

Powered by Google App Engine
This is Rietveld 408576698