Bug 1452024 - [geckodriver] Update vendor specific commands to use custom prefixes. draft
authorHenrik Skupin <mail@hskupin.info>
Wed, 11 Apr 2018 13:47:21 +0200
changeset 780891 19e4d4314a8a33ccee29a0499f5a9aa7a161fc5d
parent 780890 f45d40da38064dc58b10b9df213b5e5044d9100d
child 780892 9ae83b11a34bdce9374e18bb6ae914c02dee1ac2
push id106156
push userbmo:hskupin@gmail.com
push dateThu, 12 Apr 2018 07:08:42 +0000
bugs1452024
milestone61.0a1
Bug 1452024 - [geckodriver] Update vendor specific commands to use custom prefixes. Commands which are not defined by the WebDriver spec have to use the "Marionette" prefix. Exceptions are only allowed for chrome specific commands which share the same request URL with the content one. MozReview-Commit-ID: L47inQ3e8it
testing/geckodriver/src/marionette.rs
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -1022,17 +1022,17 @@ impl MarionetteCommand {
                 let mut data = BTreeMap::new();
                 data.insert("name".to_string(), x.to_json());
                 (Some("WebDriver:DeleteCookie"), Some(Ok(data)))
             }
             DeleteCookies => (Some("WebDriver:DeleteAllCookies"), None),
             DeleteSession => {
                 let mut body = BTreeMap::new();
                 body.insert("flags".to_owned(), vec!["eForceQuit".to_json()].to_json());
-                (Some("quit"), Some(Ok(body)))
+                (Some("Marionette:Quit"), Some(Ok(body)))
             }
             DismissAlert => (Some("WebDriver:DismissAlert"), None),
             ElementClear(ref x) => (Some("WebDriver:ElementClear"), Some(x.to_marionette())),
             ElementClick(ref x) => (Some("WebDriver:ElementClick"), Some(x.to_marionette())),
             ElementSendKeys(ref e, ref x) => {
                 let mut data = BTreeMap::new();
                 data.insert("id".to_string(), e.id.to_json());
                 data.insert("text".to_string(), x.text.to_json());
@@ -1155,44 +1155,40 @@ impl MarionetteCommand {
             }
             TakeScreenshot => {
                 let mut data = BTreeMap::new();
                 data.insert("id".to_string(), Json::Null);
                 data.insert("highlights".to_string(), Json::Array(vec![]));
                 data.insert("full".to_string(), Json::Boolean(false));
                 (Some("WebDriver:TakeScreenshot"), Some(Ok(data)))
             }
-            Extension(ref extension) => {
-                match extension {
-                    &GeckoExtensionCommand::GetContext => {
-                        (Some("getContext"), None)
-                    },
-                    &GeckoExtensionCommand::InstallAddon(ref x) => {
-                        (Some("addon:install"), Some(x.to_marionette()))
-                    },
-                    &GeckoExtensionCommand::SetContext(ref x) => {
-                        (Some("setContext"), Some(x.to_marionette()))
-                    },
-                    &GeckoExtensionCommand::UninstallAddon(ref x) => {
-                        (Some("addon:uninstall"), Some(x.to_marionette()))
-                    },
-                    &GeckoExtensionCommand::XblAnonymousByAttribute(ref e, ref x) => {
-                        let mut data = try!(x.to_marionette());
-                        data.insert("element".to_string(), e.id.to_json());
-                        (Some("findElement"), Some(Ok(data)))
-                    },
-                    &GeckoExtensionCommand::XblAnonymousChildren(ref e) => {
-                        let mut data = BTreeMap::new();
-                        data.insert("using".to_owned(), "anon".to_json());
-                        data.insert("value".to_owned(), Json::Null);
-                        data.insert("element".to_string(), e.id.to_json());
-                        (Some("findElements"), Some(Ok(data)))
-                    }
+            Extension(ref extension) => match extension {
+                &GeckoExtensionCommand::GetContext => (Some("Marionette:GetContext"), None),
+                &GeckoExtensionCommand::InstallAddon(ref x) => {
+                    (Some("Addon:Install"), Some(x.to_marionette()))
+                }
+                &GeckoExtensionCommand::SetContext(ref x) => {
+                    (Some("Marionette:SetContext"), Some(x.to_marionette()))
+                }
+                &GeckoExtensionCommand::UninstallAddon(ref x) => {
+                    (Some("Addon:Uninstall"), Some(x.to_marionette()))
                 }
-            }
+                &GeckoExtensionCommand::XblAnonymousByAttribute(ref e, ref x) => {
+                    let mut data = try!(x.to_marionette());
+                    data.insert("element".to_string(), e.id.to_json());
+                    (Some("WebDriver:FindElement"), Some(Ok(data)))
+                }
+                &GeckoExtensionCommand::XblAnonymousChildren(ref e) => {
+                    let mut data = BTreeMap::new();
+                    data.insert("using".to_owned(), "anon".to_json());
+                    data.insert("value".to_owned(), Json::Null);
+                    data.insert("element".to_string(), e.id.to_json());
+                    (Some("WebDriver:FindElements"), Some(Ok(data)))
+                }
+            },
         };
 
         let name = try_opt!(opt_name,
                             ErrorStatus::UnsupportedOperation,
                             "Operation not supported");
         let parameters = try!(opt_parameters.unwrap_or(Ok(BTreeMap::new())));
 
         Ok(MarionetteCommand::new(id, name.into(), parameters))