зеркало из https://github.com/mozilla/pjs.git
Bug 599799 - Cookies are doubled when switching between FF3.6 and FF4beta. Part 1: remove NULL baseDomains. r=sdwilsh, a=betaN+
This commit is contained in:
Родитель
38f3272f09
Коммит
5a012b1145
|
@ -1502,7 +1502,8 @@ nsCookieService::Remove(const nsACString &aHost,
|
|||
nsresult
|
||||
nsCookieService::Read()
|
||||
{
|
||||
// Let the reading begin!
|
||||
// Let the reading begin! Note that our query specifies that 'baseDomain'
|
||||
// not be NULL -- see below for why.
|
||||
nsCOMPtr<mozIStorageStatement> stmt;
|
||||
nsresult rv = mDefaultDBState.dbConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"SELECT "
|
||||
|
@ -1516,7 +1517,8 @@ nsCookieService::Read()
|
|||
"isSecure, "
|
||||
"isHttpOnly, "
|
||||
"baseDomain "
|
||||
"FROM moz_cookies"), getter_AddRefs(stmt));
|
||||
"FROM moz_cookies "
|
||||
"WHERE baseDomain NOTNULL"), getter_AddRefs(stmt));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<ReadCookieDBListener> readListener = new ReadCookieDBListener;
|
||||
|
@ -1528,6 +1530,18 @@ nsCookieService::Read()
|
|||
if (!mDefaultDBState.readSet.IsInitialized())
|
||||
mDefaultDBState.readSet.Init();
|
||||
|
||||
// Queue up an operation to delete any rows with a NULL 'baseDomain'
|
||||
// column. This takes care of any cookies set by browsers that don't
|
||||
// understand the 'baseDomain' column, where the database schema version
|
||||
// is from one that does. (This would occur when downgrading.)
|
||||
rv = mDefaultDBState.dbConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"DELETE FROM moz_cookies WHERE baseDomain ISNULL"), getter_AddRefs(stmt));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<mozIStoragePendingStatement> handle;
|
||||
rv = stmt->ExecuteAsync(mRemoveListener, getter_AddRefs(handle));
|
||||
NS_ASSERT_SUCCESS(rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1640,7 +1654,12 @@ nsCookieService::GetSyncDBConn()
|
|||
|
||||
mStorageService->OpenUnsharedDatabase(cookieFile,
|
||||
getter_AddRefs(mDefaultDBState.syncConn));
|
||||
NS_ASSERTION(mDefaultDBState.syncConn, "can't open sync db connection");
|
||||
if (!mDefaultDBState.syncConn) {
|
||||
NS_ERROR("can't open sync db connection");
|
||||
COOKIE_LOGSTRING(PR_LOG_DEBUG,
|
||||
("GetSyncDBConn(): can't open sync db connection"));
|
||||
}
|
||||
|
||||
return mDefaultDBState.syncConn;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче