зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1529273 - replaces the current implementation of Profile::new with dedicated Profile::new and Profile::new_from_path. r=ato
Differential Revision: https://phabricator.services.mozilla.com/D23310 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cd795da219
Коммит
4438287276
|
@ -348,7 +348,7 @@ impl FirefoxOptions {
|
|||
let profile_zip = &*base64::decode(profile_base64)?;
|
||||
|
||||
// Create an emtpy profile directory
|
||||
let profile = Profile::new(None)?;
|
||||
let profile = Profile::new()?;
|
||||
unzip_buffer(
|
||||
profile_zip,
|
||||
profile
|
||||
|
|
|
@ -145,7 +145,7 @@ impl MarionetteHandler {
|
|||
|
||||
let mut profile = match options.profile {
|
||||
Some(x) => x,
|
||||
None => Profile::new(None)?,
|
||||
None => Profile::new()?,
|
||||
};
|
||||
|
||||
self.set_prefs(port, &mut profile, is_custom_profile, options.prefs)
|
||||
|
@ -1523,7 +1523,7 @@ mod tests {
|
|||
// several regressions related to marionette.log.level.
|
||||
#[test]
|
||||
fn test_marionette_log_level() {
|
||||
let mut profile = Profile::new(None).unwrap();
|
||||
let mut profile = Profile::new().unwrap();
|
||||
let handler = MarionetteHandler::new(MarionetteSettings::default());
|
||||
handler.set_prefs(2828, &mut profile, false, vec![]).ok();
|
||||
let user_prefs = profile.user_prefs().unwrap();
|
||||
|
|
|
@ -16,18 +16,21 @@ pub struct Profile {
|
|||
}
|
||||
|
||||
impl Profile {
|
||||
pub fn new(opt_path: Option<&Path>) -> IoResult<Profile> {
|
||||
let mut temp_dir = None;
|
||||
let path = match opt_path {
|
||||
Some(p) => p.to_path_buf(),
|
||||
None => {
|
||||
let dir = TempDir::new("rust_mozprofile")?;
|
||||
let temp_path = dir.path().to_path_buf();
|
||||
temp_dir = Some(dir);
|
||||
temp_path
|
||||
}
|
||||
};
|
||||
pub fn new() -> IoResult<Profile> {
|
||||
let dir = TempDir::new("rust_mozprofile")?;
|
||||
let path = dir.path().to_path_buf();
|
||||
let temp_dir = Some(dir);
|
||||
Ok(Profile {
|
||||
path,
|
||||
temp_dir,
|
||||
prefs: None,
|
||||
user_prefs: None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn new_from_path(p: &Path) -> IoResult<Profile> {
|
||||
let path = p.to_path_buf();
|
||||
let temp_dir = None;
|
||||
Ok(Profile {
|
||||
path,
|
||||
temp_dir,
|
||||
|
|
Загрузка…
Ссылка в новой задаче