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

Unified Diff: chrome/browser/content_settings/content_settings_pattern.cc

Issue 7059016: Content settings pattern trim trailing dots from hostnames before matching a URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add one more test Created 9 years, 7 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 | chrome/browser/content_settings/content_settings_pattern_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/content_settings/content_settings_pattern.cc
diff --git a/chrome/browser/content_settings/content_settings_pattern.cc b/chrome/browser/content_settings/content_settings_pattern.cc
index d47eb5ff83628062456eb764b1318824ba027169..ee155646ec3ef9dc9e6dca79ff1d8c2e673a8521 100644
--- a/chrome/browser/content_settings/content_settings_pattern.cc
+++ b/chrome/browser/content_settings/content_settings_pattern.cc
@@ -8,6 +8,7 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/content_settings/content_settings_pattern_parser.h"
#include "chrome/common/url_constants.h"
+#include "net/base/dns_util.h"
#include "net/base/net_util.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_canon.h"
@@ -122,7 +123,8 @@ void ContentSettingsPattern::Builder::Canonicalize(PatternParts* parts) {
// Canonicalize the host part.
const std::string host(parts->host);
url_canon::CanonHostInfo host_info;
- const std::string canonicalized_host(net::CanonicalizeHost(host, &host_info));
+ std::string canonicalized_host(net::CanonicalizeHost(host, &host_info));
+ canonicalized_host = net::TrimEndingDot(canonicalized_host);
parts->host = "";
if ((host.find('*') == std::string::npos) &&
@@ -301,7 +303,7 @@ bool ContentSettingsPattern::Matches(
}
// Match the host part.
- const std::string host(url.host());
+ const std::string host(net::TrimEndingDot(url.host()));
if (!parts_.has_domain_wildcard) {
if (parts_.host != host)
return false;
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_pattern_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698