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

Unified Diff: extensions/browser/extension_protocols.cc

Issue 2771953003: Fix content verification code for undreadable and deleted files. (Closed)
Patch Set: address comments change DCHECK Created 3 years, 9 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: extensions/browser/extension_protocols.cc
diff --git a/extensions/browser/extension_protocols.cc b/extensions/browser/extension_protocols.cc
index 551064cbd784250c1073044c80fd3b3f5fb5c512..ccd37cdfb6cafef3d4e8bd48b3db145099482c03 100644
--- a/extensions/browser/extension_protocols.cc
+++ b/extensions/browser/extension_protocols.cc
@@ -237,6 +237,20 @@ class URLRequestExtensionJob : public net::URLRequestFileJob {
URLRequestFileJob::SetExtraRequestHeaders(headers);
}
+ void OnOpenComplete(int result) override {
+ if (result < 0) {
+ // This can happen when the file is unreadable (which can happen during
+ // corruption or third-party interaction). We need to be sure to inform
+ // the verification job that we've finished reading so that it can
+ // proceed; see crbug.com/703888.
+ if (verify_job_.get()) {
+ std::string tmp;
+ verify_job_->BytesRead(0, base::string_as_array(&tmp));
+ verify_job_->DoneReading();
+ }
+ }
+ }
+
void OnSeekComplete(int64_t result) override {
DCHECK_EQ(seek_position_, 0);
seek_position_ = result;
« no previous file with comments | « extensions/browser/content_verify_job_unittest.cc ('k') | extensions/browser/scoped_ignore_content_verifier_for_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698