Bug 1366728 - Allow Window Rect dimensions to pass through after Set Window Rect; r=jgraham
authorDavid Burns <dburns@mozilla.com>
Tue, 23 May 2017 11:51:07 +0100
changeset 360157 48baf93a251eb0d2e0c20dd94c059a025b259707
parent 360156 a8d70b131270b07c448f4f32a888d34c1ac546e0
child 360158 7308157309aebd6a8a889adc70298adec7bd5691
push id31871
push userryanvm@gmail.com
push dateTue, 23 May 2017 22:02:07 +0000
treeherdermozilla-central@545ffce30eac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1366728
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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))