summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/sqlite_persistent_cookie_store.cc
diff options
context:
space:
mode:
authorrdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-07 19:33:26 +0000
committerrdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-07 19:33:26 +0000
commit7a964a7f1edad8c8b9ef4391073b10cd84821485 (patch)
tree6be12440f93fd023a751af1de4a056f3acf3307f /chrome/browser/net/sqlite_persistent_cookie_store.cc
parent61855fc2c781be3419e159e959078670ec6a6483 (diff)
downloadchromium_src-7a964a7f1edad8c8b9ef4391073b10cd84821485.zip
chromium_src-7a964a7f1edad8c8b9ef4391073b10cd84821485.tar.gz
chromium_src-7a964a7f1edad8c8b9ef4391073b10cd84821485.tar.bz2
This CL changes our per-domain limits to be per-effective domain.
This matches FireFox behavior and is for denial of service protection when we go to FireFox expiry behavior (keeping cookies around indefinitely if they don't have a max-age and are being used); see issue (8850) for details. BUG=8850 TEST=net_unittests/net_perftests on Linux with CookieMonsterTest.* filter Review URL: http://codereview.chromium.org/3122013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/sqlite_persistent_cookie_store.cc')
-rw-r--r--chrome/browser/net/sqlite_persistent_cookie_store.cc25
1 files changed, 8 insertions, 17 deletions
diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc
index f8d46d3..72b7f71 100644
--- a/chrome/browser/net/sqlite_persistent_cookie_store.cc
+++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc
@@ -34,8 +34,7 @@ class SQLitePersistentCookieStore::Backend
}
// Batch a cookie addition.
- void AddCookie(const std::string& key,
- const net::CookieMonster::CanonicalCookie& cc);
+ void AddCookie(const net::CookieMonster::CanonicalCookie& cc);
// Batch a cookie access time update.
void UpdateCookieAccessTime(const net::CookieMonster::CanonicalCookie& cc);
@@ -65,24 +64,20 @@ class SQLitePersistentCookieStore::Backend
} OperationType;
PendingOperation(OperationType op,
- const std::string& key,
const net::CookieMonster::CanonicalCookie& cc)
- : op_(op), key_(key), cc_(cc) { }
+ : op_(op), cc_(cc) { }
OperationType op() const { return op_; }
- const std::string& key() const { return key_; }
const net::CookieMonster::CanonicalCookie& cc() const { return cc_; }
private:
OperationType op_;
- std::string key_; // Only used for OP_ADD
net::CookieMonster::CanonicalCookie cc_;
};
private:
// Batch a cookie operation (add or delete)
void BatchOperation(PendingOperation::OperationType op,
- const std::string& key,
const net::CookieMonster::CanonicalCookie& cc);
// Commit our pending operations to the database.
void Commit();
@@ -100,24 +95,22 @@ class SQLitePersistentCookieStore::Backend
};
void SQLitePersistentCookieStore::Backend::AddCookie(
- const std::string& key,
const net::CookieMonster::CanonicalCookie& cc) {
- BatchOperation(PendingOperation::COOKIE_ADD, key, cc);
+ BatchOperation(PendingOperation::COOKIE_ADD, cc);
}
void SQLitePersistentCookieStore::Backend::UpdateCookieAccessTime(
const net::CookieMonster::CanonicalCookie& cc) {
- BatchOperation(PendingOperation::COOKIE_UPDATEACCESS, std::string(), cc);
+ BatchOperation(PendingOperation::COOKIE_UPDATEACCESS, cc);
}
void SQLitePersistentCookieStore::Backend::DeleteCookie(
const net::CookieMonster::CanonicalCookie& cc) {
- BatchOperation(PendingOperation::COOKIE_DELETE, std::string(), cc);
+ BatchOperation(PendingOperation::COOKIE_DELETE, cc);
}
void SQLitePersistentCookieStore::Backend::BatchOperation(
PendingOperation::OperationType op,
- const std::string& key,
const net::CookieMonster::CanonicalCookie& cc) {
// Commit every 30 seconds.
static const int kCommitIntervalMs = 30 * 1000;
@@ -126,8 +119,7 @@ void SQLitePersistentCookieStore::Backend::BatchOperation(
DCHECK(!ChromeThread::CurrentlyOn(ChromeThread::DB));
// We do a full copy of the cookie here, and hopefully just here.
- scoped_ptr<PendingOperation> po(new PendingOperation(op, key, cc));
- CHECK(po.get());
+ scoped_ptr<PendingOperation> po(new PendingOperation(op, cc));
PendingOperationsList::size_type num_pending;
{
@@ -197,7 +189,7 @@ void SQLitePersistentCookieStore::Backend::Commit() {
case PendingOperation::COOKIE_ADD:
add_smt.Reset();
add_smt.BindInt64(0, po->cc().CreationDate().ToInternalValue());
- add_smt.BindString(1, po->key());
+ add_smt.BindString(1, po->cc().Domain());
add_smt.BindString(2, po->cc().Name());
add_smt.BindString(3, po->cc().Value());
add_smt.BindString(4, po->cc().Path());
@@ -429,10 +421,9 @@ bool SQLitePersistentCookieStore::EnsureDatabaseVersion(sql::Connection* db) {
}
void SQLitePersistentCookieStore::AddCookie(
- const std::string& key,
const net::CookieMonster::CanonicalCookie& cc) {
if (backend_.get())
- backend_->AddCookie(key, cc);
+ backend_->AddCookie(cc);
}
void SQLitePersistentCookieStore::UpdateCookieAccessTime(