Bug 784878 - Use version 2 by default when no version in found in permissions.sqlite. r=sicking

This is a patch to workaround the fact that talos has wrongly gerenated
permissions.sqlite files which don't have a user_version and are version 2.
This is going to be replaced by a MOZ_ASSERT by bug 784884.
This commit is contained in:
Mounir Lamouri 2012-08-23 11:42:52 -07:00
parent 8111973e06
commit 3ed95c9cd2

View File

@ -408,6 +408,8 @@ nsPermissionManager::InitDB(bool aRemoveFile)
// fall through to the next upgrade
// TODO: we want to make default version as version 2 in order to fix bug 784875.
case 0:
case 2:
{
// Add appId/isInBrowserElement fields.
@ -429,20 +431,6 @@ nsPermissionManager::InitDB(bool aRemoveFile)
case HOSTS_SCHEMA_VERSION:
break;
case 0:
{
NS_WARNING("couldn't get schema version!");
// the table may be usable; someone might've just clobbered the schema
// version. we can treat this case like a downgrade using the codepath
// below, by verifying the columns we care about are all there. for now,
// re-set the schema version in the db, in case the checks succeed (if
// they don't, we're dropping the table anyway).
rv = mDBConn->SetSchemaVersion(HOSTS_SCHEMA_VERSION);
NS_ENSURE_SUCCESS(rv, rv);
}
// fall through to downgrade check
// downgrading.
// if columns have been added to the table, we can still use the ones we
// understand safely. if columns have been deleted or altered, just