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

This commit is contained in:
dwitte@stanford.edu 2008-02-28 00:23:12 -08:00
Родитель 3c1f6c498f
Коммит cd7f7e893e
2 изменённых файлов: 25 добавлений и 7 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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) {