diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 14:48:15 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 14:48:15 +0000 |
commit | 6e2efc0462d72267c5a524411e4771e67da206e1 (patch) | |
tree | 4a04584732416447adae2132ec391c6ea5b8bde1 /net/base/cookie_monster.cc | |
parent | 08c0f98e3c63880dd0975afa9cd6a10c1f10c94e (diff) | |
download | chromium_src-6e2efc0462d72267c5a524411e4771e67da206e1.zip chromium_src-6e2efc0462d72267c5a524411e4771e67da206e1.tar.gz chromium_src-6e2efc0462d72267c5a524411e4771e67da206e1.tar.bz2 |
DevTools: Allow deleting cookies.
Review URL: http://codereview.chromium.org/350001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30578 0039d316-1c4b-4281-b951-d872f2087c98
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); } } |