Bug 416207 - Update cookie/permission services from changes to mozIStorageService::OpenDatabase. r=sdwilsh, sr=mconnor, a=beltzner

git-svn-id: svn://10.0.0.236/trunk@246710 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dwitte%stanford.edu 2008-02-28 08:23:13 +00:00
parent 53902af1f3
commit 9db38d55d2
2 changed files with 25 additions and 7 deletions

View File

@ -151,14 +151,22 @@ nsPermissionManager::InitDB()
// cache a connection to the hosts database
rv = storage->OpenDatabase(permissionsFile, getter_AddRefs(mDBConn));
if (rv == NS_ERROR_FILE_CORRUPTED) {
NS_ENSURE_SUCCESS(rv, rv);
PRBool ready;
mDBConn->GetConnectionReady(&ready);
if (!ready) {
// delete and try again
rv = permissionsFile->Remove(PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
rv = storage->OpenDatabase(permissionsFile, getter_AddRefs(mDBConn));
NS_ENSURE_SUCCESS(rv, rv);
mDBConn->GetConnectionReady(&ready);
if (!ready)
return NS_ERROR_UNEXPECTED;
}
NS_ENSURE_SUCCESS(rv, rv);
PRBool tableExists = PR_FALSE;
mDBConn->TableExists(NS_LITERAL_CSTRING("moz_hosts"), &tableExists);

View File

@ -467,13 +467,23 @@ nsCookieService::InitDB()
// cache a connection to the cookie database
rv = storage->OpenDatabase(cookieFile, getter_AddRefs(mDBConn));
if (rv == NS_ERROR_FILE_CORRUPTED) {
// delete and try again
cookieFile->Remove(PR_FALSE);
rv = storage->OpenDatabase(cookieFile, getter_AddRefs(mDBConn));
}
NS_ENSURE_SUCCESS(rv, rv);
PRBool ready;
mDBConn->GetConnectionReady(&ready);
if (!ready) {
// delete and try again
rv = cookieFile->Remove(PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
rv = storage->OpenDatabase(cookieFile, getter_AddRefs(mDBConn));
NS_ENSURE_SUCCESS(rv, rv);
mDBConn->GetConnectionReady(&ready);
if (!ready)
return NS_ERROR_UNEXPECTED;
}
PRBool tableExists = PR_FALSE;
mDBConn->TableExists(NS_LITERAL_CSTRING("moz_cookies"), &tableExists);
if (!tableExists) {