зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 0a7f56cabe97 (bug 1560211
) for failing in browser_startup_mainthreadio.js CLOSED TREE
This commit is contained in:
Родитель
5c199db0b2
Коммит
663a1c9ddc
|
@ -130,26 +130,11 @@ impl SecurityState {
|
||||||
// If opening initially fails, try to remove and recreate the database.
|
// If opening initially fails, try to remove and recreate the database.
|
||||||
// Consumers will repopulate the database as necessary if this happens.
|
// Consumers will repopulate the database as necessary if this happens.
|
||||||
// (See bug 1546361.)
|
// (See bug 1546361.)
|
||||||
let mut env = make_env(store_path.as_path()).or_else(|_| {
|
let env = make_env(store_path.as_path()).or_else(|_| {
|
||||||
remove_db(store_path.as_path())?;
|
remove_db(store_path.as_path())?;
|
||||||
make_env(store_path.as_path())
|
make_env(store_path.as_path())
|
||||||
})?;
|
})?;
|
||||||
|
let store = env.open_single("cert_storage", StoreOptions::create())?;
|
||||||
// It's possible that immediately writing data to a newly-created store
|
|
||||||
// triggers the crasher bug 1538541, which only occurs in this crate
|
|
||||||
// when we call SecurityState::migrate below. To try to work around
|
|
||||||
// that issue, we close and reopen the environment here if we have to
|
|
||||||
// create the store because it doesn't already exist.
|
|
||||||
let store = match env.open_single("cert_storage", StoreOptions::default()) {
|
|
||||||
Ok(store) => Ok(store),
|
|
||||||
Err(StoreError::LmdbError(lmdb::Error::NotFound)) => {
|
|
||||||
env.open_single("cert_storage", StoreOptions::create())?;
|
|
||||||
drop(env);
|
|
||||||
env = make_env(store_path.as_path())?;
|
|
||||||
env.open_single("cert_storage", StoreOptions::default())
|
|
||||||
}
|
|
||||||
Err(err) => Err(err),
|
|
||||||
}?;
|
|
||||||
|
|
||||||
// if the profile has a revocations.txt, migrate it and remove the file
|
// if the profile has a revocations.txt, migrate it and remove the file
|
||||||
let mut revocations_path = self.profile_path.clone();
|
let mut revocations_path = self.profile_path.clone();
|
||||||
|
@ -242,7 +227,7 @@ impl SecurityState {
|
||||||
drop(self.env_and_store.take());
|
drop(self.env_and_store.take());
|
||||||
|
|
||||||
let env = make_env(store_path.as_path())?;
|
let env = make_env(store_path.as_path())?;
|
||||||
let store = env.open_single("cert_storage", StoreOptions::default())?;
|
let store = env.open_single("cert_storage", StoreOptions::create())?;
|
||||||
self.env_and_store.replace(EnvAndStore { env, store });
|
self.env_and_store.replace(EnvAndStore { env, store });
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ pub(crate) fn get_database() -> XULStoreResult<Database> {
|
||||||
let xulstore_dir = get_xulstore_dir()?;
|
let xulstore_dir = get_xulstore_dir()?;
|
||||||
let xulstore_path = xulstore_dir.as_path();
|
let xulstore_path = xulstore_dir.as_path();
|
||||||
|
|
||||||
let mut env = match Rkv::new(xulstore_path) {
|
let env = match Rkv::new(xulstore_path) {
|
||||||
Ok(env) => Ok(env),
|
Ok(env) => Ok(env),
|
||||||
Err(StoreError::LmdbError(LmdbError::Invalid)) => {
|
Err(StoreError::LmdbError(LmdbError::Invalid)) => {
|
||||||
let temp_env = tempdir()?;
|
let temp_env = tempdir()?;
|
||||||
|
@ -66,21 +66,7 @@ pub(crate) fn get_database() -> XULStoreResult<Database> {
|
||||||
Err(err) => Err(err),
|
Err(err) => Err(err),
|
||||||
}?;
|
}?;
|
||||||
|
|
||||||
// It's possible that immediately writing data to a newly-created store
|
let store = env.open_single("db", StoreOptions::create())?;
|
||||||
// triggers the crasher bug 1538541, which only occurs in this crate
|
|
||||||
// when we call maybe_migrate_data below. To try to work around that issue,
|
|
||||||
// we close and reopen the environment here if we have to create the store
|
|
||||||
// because it doesn't already exist.
|
|
||||||
let store = match env.open_single("db", StoreOptions::default()) {
|
|
||||||
Ok(store) => Ok(store),
|
|
||||||
Err(StoreError::LmdbError(lmdb::Error::NotFound)) => {
|
|
||||||
env.open_single("db", StoreOptions::create())?;
|
|
||||||
drop(env);
|
|
||||||
env = Rkv::new(xulstore_path)?;
|
|
||||||
env.open_single("db", StoreOptions::default())
|
|
||||||
}
|
|
||||||
Err(err) => Err(err),
|
|
||||||
}?;
|
|
||||||
|
|
||||||
Ok(Database::new(env, store))
|
Ok(Database::new(env, store))
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче