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

Unified Diff: chrome/common/extensions/url_pattern.cc

Issue 6772022: Make <all_urls> and file:///* in permissions trigger "Allow file access" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 9 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
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | chrome/common/extensions/user_script.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/url_pattern.cc
diff --git a/chrome/common/extensions/url_pattern.cc b/chrome/common/extensions/url_pattern.cc
index 5eb0bebf79adf2644f4f059036a97418214e0e79..ac5a8eb4971f2fd423abf56cb094747ba49366d5 100644
--- a/chrome/common/extensions/url_pattern.cc
+++ b/chrome/common/extensions/url_pattern.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -230,10 +230,10 @@ bool URLPattern::MatchesUrl(const GURL &test) const {
}
bool URLPattern::MatchesScheme(const std::string& test) const {
- if (scheme_ == "*")
- return IsValidScheme(test);
+ if (!IsValidScheme(test))
+ return false;
- return test == scheme_;
+ return scheme_ == "*" || test == scheme_;
}
bool URLPattern::MatchesHost(const std::string& host) const {
@@ -333,7 +333,7 @@ bool URLPattern::OverlapsWith(const URLPattern& other) const {
std::vector<URLPattern> URLPattern::ConvertToExplicitSchemes() const {
std::vector<URLPattern> result;
- if (scheme_ != "*" && !match_all_urls_) {
+ if (scheme_ != "*" && !match_all_urls_ && IsValidScheme(scheme_)) {
result.push_back(*this);
return result;
}
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | chrome/common/extensions/user_script.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698