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

Unified Diff: extensions/browser/extension_protocols.cc

Issue 585583003: Fix case-sensitivity problems in extension content verification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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: extensions/browser/extension_protocols.cc
diff --git a/extensions/browser/extension_protocols.cc b/extensions/browser/extension_protocols.cc
index 36218eb98825c0973200d134e258c19fd15e5648..65021944dfb7af38adca4e9cc4547ff3967360c9 100644
--- a/extensions/browser/extension_protocols.cc
+++ b/extensions/browser/extension_protocols.cc
@@ -169,14 +169,14 @@ class URLRequestExtensionJob : public net::URLRequestFileJob {
const std::string& content_security_policy,
bool send_cors_header,
bool follow_symlinks_anywhere,
- ContentVerifyJob* verify_job)
+ ContentVerifier* verifier)
: net::URLRequestFileJob(
request,
network_delegate,
base::FilePath(),
BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)),
- verify_job_(verify_job),
+ verifier_(verifier),
seek_position_(0),
bytes_read_(0),
directory_path_(directory_path),
@@ -262,6 +262,19 @@ class URLRequestExtensionJob : public net::URLRequestFileJob {
void OnFilePathAndLastModifiedTimeRead(base::FilePath* read_file_path,
base::Time* last_modified_time) {
file_path_ = *read_file_path;
+ if (verifier_.get()) {
+ // On case-insentivie filesystems, the relative path we got passed in at
+ // construction time might differ in case from the actual filename on
+ // disk, but we want to use the actual filename for content verification
+ // purposes.
+ base::FilePath actual_relative_path;
+ directory_path_.AppendRelativePath(file_path_, &actual_relative_path);
Ken Rockot(use gerrit already) 2014/09/19 18:03:05 It looks like this may not actually work on Window
+ verify_job_ = verifier_->CreateJobFor(
+ resource_.extension_id(), directory_path_, actual_relative_path);
+ if (verify_job_.get())
+ verify_job_->Start();
+ verifier_ = NULL;
+ }
response_info_.headers = BuildHttpHeaders(
content_security_policy_,
send_cors_header_,
@@ -269,6 +282,7 @@ class URLRequestExtensionJob : public net::URLRequestFileJob {
URLRequestFileJob::Start();
}
+ scoped_refptr<ContentVerifier> verifier_;
scoped_refptr<ContentVerifyJob> verify_job_;
scoped_ptr<base::ElapsedTimer> request_timer_;
@@ -508,15 +522,7 @@ ExtensionProtocolHandler::MaybeCreateJob(
return NULL;
}
}
- ContentVerifyJob* verify_job = NULL;
ContentVerifier* verifier = extension_info_map_->content_verifier();
- if (verifier) {
- verify_job =
- verifier->CreateJobFor(extension_id, directory_path, relative_path);
- if (verify_job)
- verify_job->Start();
- }
-
return new URLRequestExtensionJob(request,
network_delegate,
extension_id,
@@ -525,7 +531,7 @@ ExtensionProtocolHandler::MaybeCreateJob(
content_security_policy,
send_cors_header,
follow_symlinks_anywhere,
- verify_job);
+ verifier);
}
} // namespace
« 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