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

Unified Diff: extensions/browser/content_hash_reader.cc

Issue 512573003: Content verification: Don't fail on non-existence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « extensions/browser/content_hash_reader.h ('k') | extensions/browser/content_verify_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/content_hash_reader.cc
diff --git a/extensions/browser/content_hash_reader.cc b/extensions/browser/content_hash_reader.cc
index c1e6e95642caba875dd3115abf413eb6a120219c..1c9ae97c62a1602022435057313f3bcf198d9b0d 100644
--- a/extensions/browser/content_hash_reader.cc
+++ b/extensions/browser/content_hash_reader.cc
@@ -35,6 +35,7 @@ ContentHashReader::ContentHashReader(const std::string& extension_id,
relative_path_(relative_path),
key_(key),
status_(NOT_INITIALIZED),
+ content_exists_(false),
have_verified_contents_(false),
have_computed_hashes_(false),
block_size_(0) {
@@ -50,6 +51,13 @@ bool ContentHashReader::Init() {
base::FilePath verified_contents_path =
file_util::GetVerifiedContentsPath(extension_root_);
+ // Check that this is a valid resource to verify (i.e., it exists).
+ base::FilePath content_path = extension_root_.Append(relative_path_);
+ if (!base::PathExists(content_path))
+ return false;
+
+ content_exists_ = true;
+
if (!base::PathExists(verified_contents_path))
return false;
« no previous file with comments | « extensions/browser/content_hash_reader.h ('k') | extensions/browser/content_verify_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698