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 FIREFOX_BETA_39_BASE
authorTim Taubert <ttaubert@mozilla.com>
Thu, 07 May 2015 20:27:52 +0200
changeset 267191 5e851d50fb9b8d5a28e4fcd4731dd0f17e8fb4b9
parent 267190 55ee778e1bed4d8e936a210ac1ebe8b6c8313417
child 267192 eead3ccdf2d11feefc12907467cebbe07aa91ea9
push id2233
push usermozilla@noorenberghe.ca
push dateFri, 22 May 2015 21:06:00 +0000
reviewersMattN, test-only
bugs961215, 625269
milestone39.0a2
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);
   })();
 }