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

This commit is contained in:
Tim Taubert 2015-05-07 20:27:52 +02:00
parent 9191fc7264
commit 7740e246cf

View File

@ -66,11 +66,16 @@ function resizeWindow(win, diffX, diffY, callback) {
(function tryResize() {
let {outerWidth: width, outerHeight: height} = win;
if (width != targetWidth || height != targetHeight) {
win.resizeTo(targetWidth, targetHeight);
executeSoon(tryResize);
} else {
callback();
if (width == targetWidth && height == targetHeight) {
executeSoon(callback);
return;
}
win.addEventListener("resize", function onResize() {
win.removeEventListener("resize", onResize);
executeSoon(tryResize);
});
win.resizeTo(targetWidth, targetHeight);
})();
}