Bug 1430123 - Add vendor capability for old Pointer Origin behavior. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 18 Jan 2018 11:22:15 +0100
changeset 722122 5d08166383d66c6f96732430f696a4a8c7779a97
parent 721678 d2e350ad4b9133b4ccf52c883ce62e63060d5350
child 746530 2d096160a9b68dd91a615c261d352e128e57e09b
push id96057
push userbmo:hskupin@gmail.com
push dateThu, 18 Jan 2018 13:48:48 +0000
bugs1430123
milestone59.0a1
Bug 1430123 - Add vendor capability for old Pointer Origin behavior. With the WebDriver spec the calculation of the pointer origin position will no longer be done based on the top and left position of the referenced element, but based on the center point of the viewport. This capability allows to turn on and off the new behavior in Firefox 59 and following. MozReview-Commit-ID: Ir3HpgvVg6Y
testing/geckodriver/CHANGES.md
testing/geckodriver/README.md
testing/geckodriver/src/capabilities.rs
--- a/testing/geckodriver/CHANGES.md
+++ b/testing/geckodriver/CHANGES.md
@@ -1,25 +1,31 @@
 Change log
 ==========
 
 All notable changes to this program is documented in this file.
 
 Unreleased
 ----------
 
+### Added
+
+- Introduced the temporary, boolean capability
+  `moz:useNonSpecCompliantPointerOrigin` to
+  disable the WebDriver conforming behavior of calculating the Pointer Origin.
+
 ### Changed
 
 - HTTP status code for the [`StaleElementReference`] error changed
   from 400 (Bad Request) to 404 (Not Found)
 
 - Backtraces from geckodriver no longer substitute for missing
   Marionette stacktraces
 
-- `Delete Session` now allows Firefox to safely shutdown within 130s before
+- `Delete Session` now allows Firefox to safely shutdown within 70s before
   force-killing the process
 
 
 0.19.1 (2017-10-30)
 -------------------
 
 ### Changed
 
--- a/testing/geckodriver/README.md
+++ b/testing/geckodriver/README.md
@@ -275,16 +275,33 @@ and run. It may contain any of the follo
  <tr id=capability-prefs>
   <td><code>prefs</code>
   <td><a href=#prefs-object><code>prefs</code></a>&nbsp;object
   <td>Map of preference name to preference value, which can be a
    string, a boolean or an integer.
  </tr>
 </table>
 
+moz:useNonSpecCompliantPointerOrigin
+------------------------------------
+
+A boolean value to indicate how the pointer origin for an action command
+will be calculated.
+
+With Firefox 59 the calculation will be based on the requirements by the
+[WebDriver] specification. This means that the pointer origin is no longer
+computed based on the top and left position of the referenced element, but
+on the in-view center point.
+
+To temporarily disable the WebDriver conformant behavior use `false` as value
+for this capability.
+
+Please note that this capability exists only temporarily, and that it will be
+removed once all Selenium bindings can handle the new behavior.
+
 moz:webdriverClick
 ------------------
 
 A boolean value to indicate which kind of interactability checks to run
 when performing a click or sending keys to an elements. For Firefoxen prior to
 version 58.0 some legacy code as imported from an older version of
 [FirefoxDriver] was in use.
 
--- a/testing/geckodriver/src/capabilities.rs
+++ b/testing/geckodriver/src/capabilities.rs
@@ -154,23 +154,16 @@ impl<'a> BrowserCapabilities for Firefox
         Ok(true)
     }
 
     fn validate_custom(&self, name: &str,  value: &Json) -> WebDriverResult<()> {
         if !name.starts_with("moz:") {
             return Ok(())
         }
         match name {
-            "moz:webdriverClick" => {
-                if !value.is_boolean() {
-                    return Err(WebDriverError::new(
-                        ErrorStatus::InvalidArgument,
-                        "moz:webdriverClick is not a boolean"));
-                }
-            }
             "moz:firefoxOptions" => {
                 let data = try_opt!(value.as_object(),
                                     ErrorStatus::InvalidArgument,
                                     "moz:firefoxOptions is not an object");
                 for (key, value) in data.iter() {
                     match &**key {
                         "binary" => {
                             if !value.is_string() {
@@ -232,16 +225,30 @@ impl<'a> BrowserCapabilities for Firefox
                                 }
                         }
                         x => return Err(WebDriverError::new(
                             ErrorStatus::InvalidArgument,
                             format!("Invalid moz:firefoxOptions field {}", x)))
                     }
                 }
             }
+            "moz:useNonSpecCompliantPointerOrigin" => {
+                if !value.is_boolean() {
+                    return Err(WebDriverError::new(
+                        ErrorStatus::InvalidArgument,
+                        "moz:useNonSpecCompliantPointerOrigin is not a boolean"));
+                }
+            }
+            "moz:webdriverClick" => {
+                if !value.is_boolean() {
+                    return Err(WebDriverError::new(
+                        ErrorStatus::InvalidArgument,
+                        "moz:webdriverClick is not a boolean"));
+                }
+            }
             _ => return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
                                                 format!("Unrecognised option {}", name)))
         }
         Ok(())
     }
 
     fn accept_custom(&mut self, _: &str, _: &Json, _: &Capabilities) -> WebDriverResult<bool> {
         Ok(true)