Backed out 5 changesets (bug 1494613) for failing at testing/geckodriver/src/marionette.rs
authorGurzau Raul <rgurzau@mozilla.com>
Thu, 27 Sep 2018 18:49:58 +0300
changeset 486912 af12b0d1495408ede4ddadd92835763168ebc534
parent 486911 92076b801e6b2720d7959645706f0917e9d7dc07
child 486913 e828cf7c367e0c1e73ef537f1dd5dec4bf7e43cf
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
bugs1494613
milestone64.0a1
backs out09e9cefc19ca63fe9e6d78133d45a05b70285cdc
f9f4e7c55d61c215d94166c14da24e8f9fcf3f1e
457da8a172be5d4ad04d78c9e5ebbf3dfc5d87c1
8d26a58f754e139f6bd91a239f87157728f3067f
729d8f3e134162b600e7087c5a96950e420647bb
Backed out 5 changesets (bug 1494613) for failing at testing/geckodriver/src/marionette.rs Backed out changeset 09e9cefc19ca (bug 1494613) Backed out changeset f9f4e7c55d61 (bug 1494613) Backed out changeset 457da8a172be (bug 1494613) Backed out changeset 8d26a58f754e (bug 1494613) Backed out changeset 729d8f3e1341 (bug 1494613)
testing/geckodriver/src/marionette.rs
testing/mozbase/rust/mozprofile/src/preferences.rs
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -94,37 +94,39 @@ impl MarionetteHandler {
 
     pub fn create_connection(
         &mut self,
         session_id: &Option<String>,
         new_session_parameters: &NewSessionParameters,
     ) -> WebDriverResult<Map<String, Value>> {
         let (options, capabilities) = {
             let mut fx_capabilities = FirefoxCapabilities::new(self.settings.binary.as_ref());
-            let mut capabilities = new_session_parameters
-                .match_browser(&mut fx_capabilities)?
-                .ok_or(WebDriverError::new(
-                    ErrorStatus::SessionNotCreated,
-                    "Unable to find a matching set of capabilities",
-                ))?;
+            let mut capabilities = try!(
+                try!(new_session_parameters.match_browser(&mut fx_capabilities)).ok_or(
+                    WebDriverError::new(
+                        ErrorStatus::SessionNotCreated,
+                        "Unable to find a matching set of capabilities",
+                    ),
+                )
+            );
 
-            let options = FirefoxOptions::from_capabilities(
+            let options = try!(FirefoxOptions::from_capabilities(
                 fx_capabilities.chosen_binary,
-                &mut capabilities,
-            )?;
+                &mut capabilities
+            ));
             (options, capabilities)
         };
 
         if let Some(l) = options.log.level {
             logging::set_max_level(l);
         }
 
         let port = self.settings.port.unwrap_or(get_free_port()?);
         if !self.settings.connect_existing {
-            self.start_browser(port, options)?;
+            try!(self.start_browser(port, options));
         }
 
         let mut connection = MarionetteConnection::new(port, session_id.clone());
         connection.connect(&mut self.browser).or_else(|e| {
             if let Some(ref mut runner) = self.browser {
                 runner.kill()?;
             }
             Err(e)
@@ -203,31 +205,34 @@ impl MarionetteHandler {
             if !custom_profile || !prefs.contains_key(name) {
                 prefs.insert((*name).clone(), (*value).clone());
             }
         }
 
         prefs.insert_slice(&extra_prefs[..]);
 
         if self.settings.jsdebugger {
-            prefs.insert("devtools.browsertoolbox.panel", Pref::new("jsdebugger"));
+            prefs.insert(
+                "devtools.browsertoolbox.panel",
+                Pref::new("jsdebugger".to_owned()),
+            );
             prefs.insert("devtools.debugger.remote-enabled", Pref::new(true));
             prefs.insert("devtools.chrome.enabled", Pref::new(true));
             prefs.insert("devtools.debugger.prompt-connection", Pref::new(false));
             prefs.insert("marionette.debugging.clicktostart", Pref::new(true));
         }
 
-        prefs.insert("marionette.log.level", logging::max_level().into());
+        prefs.insert(
+            "marionette.log.level",
+            Pref::new(logging::max_level().to_string()),
+        );
         prefs.insert("marionette.port", Pref::new(port));
 
-        prefs.write().map_err(|e| {
-            WebDriverError::new(
-                ErrorStatus::UnknownError,
-                format!("Unable to write Firefox profile: {}", e),
-            )
+        prefs.write().map_err(|_| {
+            WebDriverError::new(ErrorStatus::UnknownError, "Unable to write Firefox profile")
         })
     }
 }
 
 impl WebDriverHandler<GeckoExtensionRoute> for MarionetteHandler {
     fn handle_command(
         &mut self,
         _: &Option<Session>,
@@ -1478,25 +1483,9 @@ impl ToMarionette for WindowRectParamete
             serde_json::to_value(self)?.as_object(),
             ErrorStatus::UnknownError,
             "Expected an object"
         ).clone())
     }
 }
 
 #[cfg(test)]
-mod tests {
-    use mozprofile::preferences::Pref;
-    use mozprofile::profile::Profile;
-    use super::{MarionetteHandler, MarionetteSettings};
-
-    // This is not a pretty test, mostly due to the nature of
-    // mozprofile's and MarionetteHandler's APIs, but we have had
-    // several regressions related to marionette.log.level.
-    #[test]
-    fn test_marionette_log_level() {
-        let mut profile = Profile::new(None).unwrap();
-        let handler = MarionetteHandler::new(MarionetteSettings::default());
-        handler.set_prefs(2828, &mut profile, false, vec![]);
-        let user_prefs = profile.user_prefs().unwrap();
-        assert_eq!(user_prefs.get("marionette.log.level"), Some(&Pref::new("Fatal")));
-    }
-}
+mod tests {}
--- a/testing/mozbase/rust/mozprofile/src/preferences.rs
+++ b/testing/mozbase/rust/mozprofile/src/preferences.rs
@@ -74,29 +74,26 @@ impl From<i64> for PrefValue {
 
 #[derive(Debug, PartialEq, Clone)]
 pub struct Pref {
     pub value: PrefValue,
     pub sticky: bool,
 }
 
 impl Pref {
-    /// Create a new preference with `value`.
     pub fn new<T>(value: T) -> Pref
     where
         T: Into<PrefValue>,
     {
         Pref {
             value: value.into(),
             sticky: false,
         }
     }
 
-    /// Create a new sticky, or locked, preference with `value`.
-    /// These cannot be changed by the user in `about:config`.
     pub fn new_sticky<T>(value: T) -> Pref
     where
         T: Into<PrefValue>,
     {
         Pref {
             value: value.into(),
             sticky: true,
         }