Bug 1319237 - Calculate correct window position. r=automatedtester, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 21 Nov 2016 23:33:03 +0100
changeset 378499 0065cd32253c0bc80b696925bc57f48ba35e5b1a
parent 378498 a8a6d17f60aff28cfc92a6fc01cfc96a7f2e694d
child 378500 20b7c1a2b0ce4951b0645d1151f98f7ee73ef983
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester, test-only
bugs1319237
milestone53.0a2
Bug 1319237 - Calculate correct window position. r=automatedtester, a=test-only The testing/marionette/browser.js window getter does not return the same window as `GeckoDriver#getCurrentWindow`. This is a problem, but for now we can rely on `getCurrentWindow`. MozReview-Commit-ID: PT9M7boPM7
testing/marionette/browser.js
testing/marionette/driver.js
--- a/testing/marionette/browser.js
+++ b/testing/marionette/browser.js
@@ -366,26 +366,16 @@ browser.Context = class {
   executeWhenReady(cb) {
     if (this.hasRemotenessChange()) {
       this.pendingCommands.push(cb);
     } else {
       cb();
     }
   }
 
-  /**
-   * Returns the position of the OS window.
-   */
-  get position() {
-    return {
-      x: this.window.screenX,
-      y: this.window.screenY,
-    };
-  }
-
 };
 
 /**
  * The window storage is used to save outer window IDs mapped to weak
  * references of Window objects.
  *
  * Usage:
  *
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1151,17 +1151,21 @@ GeckoDriver.prototype.getChromeWindowHan
 
 /**
  * Get the current window position.
  *
  * @return {Object.<string, number>}
  *     Object with |x| and |y| coordinates.
  */
 GeckoDriver.prototype.getWindowPosition = function (cmd, resp) {
-  return this.curBrowser.position;
+  let win = this.getCurrentWindow();
+  return {
+    x: win.screenX,
+    y: win.screenY,
+  };
 };
 
 /**
  * Set the window position of the browser on the OS Window Manager
  *
  * @param {number} x
  *     X coordinate of the top/left of the window that it will be
  *     moved to.