Bug 448372 - Sensitive cookie data remains readable and on disk in cookies.sqlite after "Clear Private Data" and "Remove All Cookies"
This makes the cookie service now delete the database file if it cannot clear the table because of corruption. It then re-inits the database. r=dwitte
This commit is contained in:
Родитель
4b78723afb
Коммит
d45ebc1241
|
@ -780,15 +780,21 @@ NS_IMETHODIMP
|
|||
nsCookieService::RemoveAll()
|
||||
{
|
||||
RemoveAllFromMemory();
|
||||
NotifyChanged(nsnull, NS_LITERAL_STRING("cleared").get());
|
||||
|
||||
// clear the cookie file
|
||||
if (mDBConn) {
|
||||
nsresult rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING("DELETE FROM moz_cookies"));
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("db delete failed");
|
||||
if (NS_FAILED(rv)) {
|
||||
// Database must be corrupted, so remove it completely.
|
||||
nsCOMPtr<nsIFile> dbFile;
|
||||
mDBConn->GetDatabaseFile(getter_AddRefs(dbFile));
|
||||
mDBConn->Close();
|
||||
dbFile->Remove(PR_FALSE);
|
||||
InitDB();
|
||||
}
|
||||
}
|
||||
|
||||
NotifyChanged(nsnull, NS_LITERAL_STRING("cleared").get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче