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
--- 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))