Bug 1366728 - Allow Window Rect dimensions to pass through after Set Window Rect; r?jgraham draft
authorDavid Burns <dburns@mozilla.com>
Tue, 23 May 2017 11:51:07 +0100
changeset 582969 df7d1844329802f6528a4dff756978bd80af13db
parent 582968 bf6ee973f04e83f419c12f93e4f194e26b0bbf47
child 629914 4673a5bc119456d3338efc87ed9ee2fce3f80748
push id60239
push userbmo:dburns@mozilla.com
push dateTue, 23 May 2017 10:51:54 +0000
reviewersjgraham
bugs1366728
milestone55.0a1
Bug 1366728 - Allow Window Rect dimensions to pass through after Set Window Rect; r?jgraham By allowing the data to pass through we become conformant on the final step of https://w3c.github.io/webdriver/webdriver-spec.html#set-window-rect MozReview-Commit-ID: HZjrvQSUbRr
testing/geckodriver/src/marionette.rs
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -632,17 +632,17 @@ impl MarionetteSession {
             return Err(WebDriverError::new(status, error.message));
         }
 
         try!(self.update(msg, &resp));
 
         Ok(match msg.command {
             // Everything that doesn't have a response value
             Get(_) | GoBack | GoForward | Refresh | SetTimeouts(_) |
-            SetWindowRect(_) | MaximizeWindow | SwitchToWindow(_) | SwitchToFrame(_) |
+            MaximizeWindow | SwitchToWindow(_) | SwitchToFrame(_) |
             SwitchToParentFrame | AddCookie(_) | DeleteCookies | DeleteCookie(_) |
             DismissAlert | AcceptAlert | SendAlertText(_) | ElementClick(_) |
             ElementTap(_) | ElementClear(_) | ElementSendKeys(_, _) |
             PerformActions(_) | ReleaseActions => {
                 WebDriverResponse::Void
             },
             // Things that simply return the contents of the marionette "value" property
             GetCurrentUrl | GetTitle | GetPageSource | GetWindowHandle | IsDisplayed(_) |
@@ -765,16 +765,47 @@ impl MarionetteSession {
                     try_opt!(resp.result.find("height"),
                              ErrorStatus::UnknownError,
                              "Failed to find height field").as_f64(),
                     ErrorStatus::UnknownError,
                     "Failed to interpret width as float");
 
                 WebDriverResponse::ElementRect(ElementRectResponse::new(x, y, width, height))
             },
+            SetWindowRect(_) => {
+                let x = try_opt!(
+                    try_opt!(resp.result.find("x"),
+                             ErrorStatus::UnknownError,
+                             "Failed to find x field").as_f64(),
+                    ErrorStatus::UnknownError,
+                    "Failed to interpret x as float");
+
+                let y = try_opt!(
+                    try_opt!(resp.result.find("y"),
+                             ErrorStatus::UnknownError,
+                             "Failed to find y field").as_f64(),
+                    ErrorStatus::UnknownError,
+                    "Failed to interpret y as float");
+
+                let width = try_opt!(
+                    try_opt!(resp.result.find("width"),
+                             ErrorStatus::UnknownError,
+                             "Failed to find width field").as_f64(),
+                    ErrorStatus::UnknownError,
+                    "Failed to interpret width as float");
+
+                let height = try_opt!(
+                    try_opt!(resp.result.find("height"),
+                             ErrorStatus::UnknownError,
+                             "Failed to find height field").as_f64(),
+                    ErrorStatus::UnknownError,
+                    "Failed to interpret width as float");
+
+                WebDriverResponse::ElementRect(ElementRectResponse::new(x, y, width, height))
+            },
             GetCookies => {
                 let cookies = try!(self.process_cookies(&resp.result));
                 WebDriverResponse::Cookie(CookieResponse::new(cookies))
             },
             GetNamedCookie(ref name) => {
                 let mut cookies = try!(self.process_cookies(&resp.result));
                 cookies.retain(|x| x.name == *name);
                 WebDriverResponse::Cookie(CookieResponse::new(cookies))