summaryrefslogtreecommitdiffstats
path: root/chrome/browser/privacy_blacklist
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 14:09:33 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 14:09:33 +0000
commit1fbe08754b21f96809a8832e29f74b6031afbfe7 (patch)
tree4da9266c6641c2a550c8af7b606eb4b72067b75f /chrome/browser/privacy_blacklist
parent2b62e7cbe99eb04b775ca8cf3c5a576bca907319 (diff)
downloadchromium_src-1fbe08754b21f96809a8832e29f74b6031afbfe7.zip
chromium_src-1fbe08754b21f96809a8832e29f74b6031afbfe7.tar.gz
chromium_src-1fbe08754b21f96809a8832e29f74b6031afbfe7.tar.bz2
revert 35785. TBR=phajdan.jr@
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35787 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/privacy_blacklist')
-rw-r--r--chrome/browser/privacy_blacklist/blacklist.cc5
-rw-r--r--chrome/browser/privacy_blacklist/blacklist_unittest.cc34
2 files changed, 3 insertions, 36 deletions
diff --git a/chrome/browser/privacy_blacklist/blacklist.cc b/chrome/browser/privacy_blacklist/blacklist.cc
index 60a8e40..1bec742 100644
--- a/chrome/browser/privacy_blacklist/blacklist.cc
+++ b/chrome/browser/privacy_blacklist/blacklist.cc
@@ -182,13 +182,10 @@ Blacklist::Match* Blacklist::findMatch(const GURL& url) const {
!url.SchemeIs(chrome::kHttpsScheme) &&
!url.SchemeIs(chrome::kFtpScheme))
return 0;
- std::string url_spec = url.host() + url.path();
- if (!url.query().empty())
- url_spec = url_spec + "?" + url.query();
Match* match = NULL;
for (EntryList::const_iterator i = blacklist_.begin();
i != blacklist_.end(); ++i) {
- if (Matches((*i)->pattern(), url_spec)) {
+ if (Matches((*i)->pattern(), url.host() + url.path())) {
if (!match)
match = new Match;
match->AddEntry(i->get());
diff --git a/chrome/browser/privacy_blacklist/blacklist_unittest.cc b/chrome/browser/privacy_blacklist/blacklist_unittest.cc
index 19d0312..2331319 100644
--- a/chrome/browser/privacy_blacklist/blacklist_unittest.cc
+++ b/chrome/browser/privacy_blacklist/blacklist_unittest.cc
@@ -20,7 +20,7 @@ TEST(BlacklistTest, Generic) {
Blacklist blacklist;
ASSERT_TRUE(BlacklistIO::ReadBinary(&blacklist, input));
-
+
Blacklist::EntryList entries(blacklist.entries_begin(),
blacklist.entries_end());
@@ -59,7 +59,7 @@ TEST(BlacklistTest, Generic) {
Blacklist::ProviderList providers(blacklist.providers_begin(),
blacklist.providers_end());
-
+
ASSERT_EQ(1U, providers.size());
EXPECT_EQ("Sample", providers[0]->name());
EXPECT_EQ("http://www.google.com", providers[0]->url());
@@ -169,36 +169,6 @@ TEST(BlacklistTest, Generic) {
EXPECT_TRUE(header4 == Blacklist::StripCookies(header3));
}
-TEST(BlacklistTest, QueryStringMatch) {
- Blacklist blacklist;
-
- Blacklist::Provider *provider = new Blacklist::Provider("test",
- "http://test.com/");
- blacklist.AddProvider(provider);
- blacklist.AddEntry(new Blacklist::Entry("@/script?@", provider));
- blacklist.AddEntry(new Blacklist::Entry("@?badparam@", provider));
-
- // No matches for URLs without query string
- EXPECT_FALSE(blacklist.findMatch(GURL("http://badparam.com/")));
- EXPECT_FALSE(blacklist.findMatch(GURL("http://script.bad.org/")));
-
- // Expected rule matches.
- Blacklist::Match* match;
- match = blacklist.findMatch(GURL("http://host.com/script?q=x"));
- EXPECT_TRUE(match);
- if (match) {
- EXPECT_EQ(1U, match->entries().size());
- delete match;
- }
-
- match = blacklist.findMatch(GURL("http://host.com/img?badparam=x"));
- EXPECT_TRUE(match);
- if (match) {
- EXPECT_EQ(1U, match->entries().size());
- delete match;
- }
-}
-
TEST(BlacklistTest, PatternMatch) {
// @ matches all but empty strings.
EXPECT_TRUE(Blacklist::Matches("@", "foo.com"));