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

Unified Diff: net/cookies/cookie_monster.cc

Issue 1746303002: Replace std::string::find with base::StartsWith when comparing cookie paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove new test case Created 4 years, 10 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
Index: net/cookies/cookie_monster.cc
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index e9eccd2c907f94a20025d4a5dc6925105db46d2c..b62f635b52f63e456c14600970317f660ca2814a 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -1211,13 +1211,12 @@ void CookieMonster::DeleteCookie(const GURL& url,
FindCookiesForHostAndDomain(url, options, &cookies);
std::set<CanonicalCookie*> matching_cookies;
- for (std::vector<CanonicalCookie*>::const_iterator it = cookies.begin();
- it != cookies.end(); ++it) {
- if ((*it)->Name() != cookie_name)
+ for (const auto& cookie : cookies) {
+ if (cookie->Name() != cookie_name)
continue;
- if (url.path().find((*it)->Path()))
+ if (!cookie->IsOnPath(url.path()))
mmenke 2016/03/02 20:02:01 Just happened to notice this bug when cleaning up
Mike West 2016/03/03 18:56:28 \o/
continue;
- matching_cookies.insert(*it);
+ matching_cookies.insert(cookie);
}
for (CookieMap::iterator it = cookies_.begin(); it != cookies_.end();) {

Powered by Google App Engine
This is Rietveld 408576698