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

Unified Diff: chrome/common/content_settings_pattern_parser.cc

Issue 8676020: Detect invalid content settings pattern that were not detected yet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move one more check to the Validate method Created 9 years, 1 month 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: chrome/common/content_settings_pattern_parser.cc
diff --git a/chrome/common/content_settings_pattern_parser.cc b/chrome/common/content_settings_pattern_parser.cc
index 437ecb1f1a9109962a18379bf22082d3389b60a8..d1b99fabfc2926302e2f4832a0c1399b5857676b 100644
--- a/chrome/common/content_settings_pattern_parser.cc
+++ b/chrome/common/content_settings_pattern_parser.cc
@@ -140,8 +140,9 @@ void PatternParser::Parse(const std::string& pattern_spec,
builder->WithDomainWildcard();
} else if (StartsWithASCII(host, kDomainWildcard, true)) {
host = host.substr(kDomainWildcardLength);
- // If the host still contains a wildcard symbol then it is invalid.
- if (host.find(kHostWildcard) != std::string::npos) {
+ // If the host contains a domain wildcard but no domain then it is
Bernhard Bauer 2011/11/24 15:50:32 This would be a pattern that's just "[*.]"? I thin
markusheintz_ 2011/11/24 16:37:51 True. Done
+ // invalid.
+ if (host.empty()) {
builder->Invalid();
return;
} else {

Powered by Google App Engine
This is Rietveld 408576698