diff options
Diffstat (limited to 'net/base/cookie_monster.cc')
-rw-r--r-- | net/base/cookie_monster.cc | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index 2c2f21d..01b68a1 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -792,12 +792,27 @@ void CookieMonster::DeleteCookie(const GURL& url, if (!HasCookieableScheme(url)) return; - for (CookieMapItPair its = cookies_.equal_range(url.host()); - its.first != its.second; ++its.first) { - if (its.first->second->Name() == cookie_name) { - InternalDeleteCookie(its.first, true); - return; - } + CookieOptions options; + options.set_include_httponly(); + // Get the cookies for this host and its domain(s). + std::vector<CanonicalCookie*> cookies; + 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) + continue; + if (url.path().find((*it)->Path())) + continue; + matching_cookies.insert(*it); + } + + for (CookieMap::iterator it = cookies_.begin(); it != cookies_.end();) { + CookieMap::iterator curit = it; + ++it; + if (matching_cookies.find(curit->second) != matching_cookies.end()) + InternalDeleteCookie(curit, true); } } |