Bug 1478358 - [marionette] Don't wait for resize events in "Set Window Rect". r=ato a=test-only
authorHenrik Skupin <mail@hskupin.info>
Mon, 14 Jan 2019 15:24:54 +0000
changeset 509473 2d63cb7c2cccb8e0884a3ce2de06b43d9b6990ef
parent 509472 c4617240dec57c705301dad0044afb5b2a319a12
child 509474 c52783e0d7e1e3ca9463e36a6b3de2a5ed04a563
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1478358
milestone65.0
Bug 1478358 - [marionette] Don't wait for resize events in "Set Window Rect". r=ato a=test-only Differential Revision: https://phabricator.services.mozilla.com/D16338
testing/marionette/driver.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1463,37 +1463,24 @@ GeckoDriver.prototype.setWindowRect = as
       break;
 
     case WindowState.Maximized:
     case WindowState.Minimized:
       await restoreWindow(win);
       break;
   }
 
-  if (height != null && width != null) {
+  if (width != null && height != null) {
     assert.positiveInteger(height);
     assert.positiveInteger(width);
 
-    let debounce = new DebounceCallback(() => {
-      win.dispatchEvent(new win.CustomEvent("resizeEnd"));
-    });
-
-    await new TimedPromise(async resolve => {
-      if (win.outerWidth == width && win.outerHeight == height) {
-        resolve();
-        return;
-      }
-
-      win.addEventListener("resize", debounce);
-      win.addEventListener("resizeEnd", resolve, {once: true});
+    if (win.outerWidth != width || win.outerHeight != height) {
       win.resizeTo(width, height);
       await new IdlePromise(win);
-    }, {timeout: 5000});
-
-    win.removeEventListener("resize", debounce);
+    }
   }
 
   if (x != null && y != null) {
     assert.integer(x);
     assert.integer(y);
 
     if (win.screenX != x || win.screenY != y) {
       win.moveTo(x, y);