Bug 1381876 - Return window rect from Context#rect consistently. r?automatedtester draft
authorAndreas Tolfsen <ato@sny.no>
Tue, 01 Aug 2017 18:17:29 +0100
changeset 641115 47f87dca3d5cea827c7449eb0ecb97442f5610a1
parent 641114 97a530a7dc42ca3886d896d7355b90dcfdf56321
child 641116 66db374659c9b940e5d86214206e69cca1b52d43
push id72440
push userbmo:ato@sny.no
push dateSat, 05 Aug 2017 16:47:34 +0000
reviewersautomatedtester
bugs1381876
milestone57.0a1
Bug 1381876 - Return window rect from Context#rect consistently. r?automatedtester MozReview-Commit-ID: D5pCPK2PEr3
testing/marionette/driver.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2906,36 +2906,27 @@ GeckoDriver.prototype.setScreenOrientati
  * @throws {UnexpectedAlertOpenError}
  *     A modal dialog is open, blocking this operation.
  */
 GeckoDriver.prototype.minimizeWindow = function* (cmd, resp) {
   assert.firefox();
   const win = assert.window(this.getCurrentWindow());
   assert.noUserPrompt(this.dialog);
 
-  let state;
   yield new Promise(resolve => {
     win.addEventListener("sizemodechange", resolve, {once: true});
 
     if (win.windowState == win.STATE_MINIMIZED) {
       win.restore();
-      state = "normal";
     } else {
       win.minimize();
-      state = "minimized";
     }
   });
 
-  resp.body = {
-    x: win.screenX,
-    y: win.screenY,
-    width: win.outerWidth,
-    height: win.outerHeight,
-    state,
-  };
+  return this.curBrowser.rect;
 };
 
 /**
  * Synchronously maximizes the user agent window as if the user pressed
  * the maximize button, or restores it if it is already maximized.
  *
  * Not supported on Fennec.
  *
@@ -2959,22 +2950,17 @@ GeckoDriver.prototype.maximizeWindow = f
 
     if (win.windowState == win.STATE_MAXIMIZED) {
       win.restore();
     } else {
       win.maximize();
     }
   });
 
-  resp.body = {
-    x: win.screenX,
-    y: win.screenY,
-    width: win.outerWidth,
-    height: win.outerHeight,
-  };
+  return this.curBrowser.rect;
 };
 
 /**
  * Synchronously sets the user agent window to full screen as if the user
  * had done "View > Enter Full Screen", or restores it if it is already
  * in full screen.
  *
  * Not supported on Fennec.
@@ -2991,26 +2977,20 @@ GeckoDriver.prototype.maximizeWindow = f
  */
 GeckoDriver.prototype.fullscreen = function* (cmd, resp) {
   assert.firefox();
   const win = assert.window(this.getCurrentWindow());
   assert.noUserPrompt(this.dialog);
 
   yield new Promise(resolve => {
     win.addEventListener("sizemodechange", resolve, {once: true});
-
     win.fullScreen = !win.fullScreen;
   });
 
-  resp.body = {
-    x: win.screenX,
-    y: win.screenY,
-    width: win.outerWidth,
-    height: win.outerHeight,
-  };
+  return this.curBrowser.rect;
 };
 
 /**
  * Dismisses a currently displayed tab modal, or returns no such alert if
  * no modal is displayed.
  */
 GeckoDriver.prototype.dismissDialog = function(cmd, resp) {
   assert.window(this.getCurrentWindow());