Bug 939084 - Intermittent browser_social_chatwindow_resize.js, r=felipe

--HG--
extra : rebase_source : 4a9bc4113584492fd9ff76dd58824d0d13d6b4ff
This commit is contained in:
Olli Pettay 2013-12-10 13:38:38 +02:00
parent 9b8a8f628f
commit 087271ab47

View File

@ -555,12 +555,24 @@ function resizeAndCheckWidths(first, second, third, checks, cb) {
resizeWindowToChatAreaWidth(width, function(sizedOk) {
checkPopup();
ok(sizedOk, count+": window resized correctly");
if (sizedOk) {
let numVisible = [first, second, third].filter(function(item) !item.collapsed).length;
is(numVisible, numExpectedVisible, count + ": " + "correct number of chats visible");
function collapsedObserver(r, m) {
if ([first, second, third].filter(function(item) !item.collapsed).length == numExpectedVisible) {
if (m) {
m.disconnect();
}
ok(true, count + ": " + "correct number of chats visible");
info(">> Check " + count);
resizeAndCheckWidths(first, second, third, checks, cb);
return true;
}
return false;
}
if (!collapsedObserver()) {
let m = new MutationObserver(collapsedObserver);
m.observe(first, {attributes: true });
m.observe(second, {attributes: true });
m.observe(third, {attributes: true });
}
info(">> Check " + count);
resizeAndCheckWidths(first, second, third, checks, cb);
}, count);
}