зеркало из https://github.com/mozilla/gecko-dev.git
Bug 416207 - Update cookie/permission services from changes to mozIStorageService::OpenDatabase. r=sdwilsh, sr=mconnor, a=beltzner
This commit is contained in:
Родитель
3c1f6c498f
Коммит
cd7f7e893e
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче