| Index: chrome/common/extensions/url_pattern.cc
|
| diff --git a/chrome/common/extensions/url_pattern.cc b/chrome/common/extensions/url_pattern.cc
|
| index d854be49731263b71d08e9f4693e72d35d32303a..91664f5dbebc8d52e5b614b76a1cbf7414048f22 100644
|
| --- a/chrome/common/extensions/url_pattern.cc
|
| +++ b/chrome/common/extensions/url_pattern.cc
|
| @@ -307,24 +307,25 @@ bool URLPattern::SetPort(const std::string& port) {
|
| return false;
|
| }
|
|
|
| -bool URLPattern::MatchesURL(const GURL &test) const {
|
| +bool URLPattern::MatchesURL(const GURL& test) const {
|
| if (!MatchesScheme(test.scheme()))
|
| return false;
|
|
|
| if (match_all_urls_)
|
| return true;
|
|
|
| - // Ignore hostname if scheme is file://.
|
| - if (scheme_ != chrome::kFileScheme && !MatchesHost(test))
|
| - return false;
|
| + return MatchesSecurityOriginHelper(test) &&
|
| + MatchesPath(test.PathForRequest());
|
| +}
|
|
|
| - if (!MatchesPath(test.PathForRequest()))
|
| +bool URLPattern::MatchesSecurityOrigin(const GURL& test) const {
|
| + if (!MatchesScheme(test.scheme()))
|
| return false;
|
|
|
| - if (!MatchesPort(test.EffectiveIntPort()))
|
| - return false;
|
| + if (match_all_urls_)
|
| + return true;
|
|
|
| - return true;
|
| + return MatchesSecurityOriginHelper(test);
|
| }
|
|
|
| bool URLPattern::MatchesScheme(const std::string& test) const {
|
| @@ -463,6 +464,17 @@ bool URLPattern::MatchesAnyScheme(
|
| return false;
|
| }
|
|
|
| +bool URLPattern::MatchesSecurityOriginHelper(const GURL& test) const {
|
| + // Ignore hostname if scheme is file://.
|
| + if (scheme_ != chrome::kFileScheme && !MatchesHost(test))
|
| + return false;
|
| +
|
| + if (!MatchesPort(test.EffectiveIntPort()))
|
| + return false;
|
| +
|
| + return true;
|
| +}
|
| +
|
| std::vector<std::string> URLPattern::GetExplicitSchemes() const {
|
| std::vector<std::string> result;
|
|
|
|
|