Bug 961215 - Fix intermittent browser_tabview_bug625269.js failures by taking into account that window.resizeTo() can fail to change the window size sometimes. r=MattN, a=test-only
authorTim Taubert <ttaubert@mozilla.com>
Thu, 07 May 2015 20:27:52 +0200
changeset 260457 97b29f79be5c
parent 260456 5081fb1d38f0
child 260458 ad9164105253
push id786
push userryanvm@gmail.com
push date2015-05-11 14:41 +0000
treeherdermozilla-release@85229fbaf017 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, test-only
bugs961215, 625269
milestone38.0.5
Bug 961215 - Fix intermittent browser_tabview_bug625269.js failures by taking into account that window.resizeTo() can fail to change the window size sometimes. r=MattN, a=test-only
browser/components/tabview/test/browser_tabview_bug625269.js
--- a/browser/components/tabview/test/browser_tabview_bug625269.js
+++ b/browser/components/tabview/test/browser_tabview_bug625269.js
@@ -61,16 +61,21 @@ function onTabViewShown(win) {
 
 // ----------
 function resizeWindow(win, diffX, diffY, callback) {
   let targetWidth = win.outerWidth + diffX;
   let targetHeight = win.outerHeight + diffY;
 
   (function tryResize() {
     let {outerWidth: width, outerHeight: height} = win;
-    if (width != targetWidth || height != targetHeight) {
-      win.resizeTo(targetWidth, targetHeight);
+    if (width == targetWidth && height == targetHeight) {
+      executeSoon(callback);
+      return;
+    }
+
+    win.addEventListener("resize", function onResize() {
+      win.removeEventListener("resize", onResize);
       executeSoon(tryResize);
-    } else {
-      callback();
-    }
+    });
+
+    win.resizeTo(targetWidth, targetHeight);
   })();
 }