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 08:23:13 +00:00
Родитель a7b3240475
Коммит fe5c819390
2 изменённых файлов: 25 добавлений и 7 удалений

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

@ -151,15 +151,23 @@ 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;
}
PRBool tableExists = PR_FALSE;
mDBConn->TableExists(NS_LITERAL_CSTRING("moz_hosts"), &tableExists);
if (!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) {