Bug 948092, Random failure in test_largemenu.xul, r=roc

--HG--
extra : rebase_source : 178c57b3dff9012ef9e95e379e668da4186bac6b
This commit is contained in:
Olli Pettay 2014-01-15 14:00:44 +02:00
parent be78778251
commit abaf2209f3
2 changed files with 29 additions and 3 deletions

View File

@ -43,6 +43,16 @@ function getScreenXY(element)
return [screenX, screenY];
}
function hidePopup() {
window.requestAnimationFrame(
function() {
setTimeout(
function() {
document.getElementById("popup").hidePopup();
}, 0);
});
}
function runTests()
{
[, gScreenY] = getScreenXY(document.documentElement);
@ -73,7 +83,12 @@ function nextTest()
popup.removeChild(popup.lastChild);
}
popup.openPopupAtScreen(100, y, false);
window.requestAnimationFrame(function() {
setTimeout(
function() {
popup.openPopupAtScreen(100, y, false);
}, 0);
});
}
function popupShown()
@ -134,7 +149,7 @@ function popupShown()
sbo.getPosition(sx, sy);
is(sy.value, expectedScrollPos, "menu scroll position");
popup.hidePopup();
hidePopup();
}
function is(l, r, n) { window.opener.wrappedJSObject.SimpleTest.is(l,r,n); }
@ -224,7 +239,7 @@ function contextMenuPopupShown()
break;
}
popup.hidePopup();
hidePopup();
}
function contextMenuPopupHidden()

View File

@ -209,6 +209,17 @@ function goNextStep()
}
function goNext()
{
// We want to continue after the next animation frame so that
// we're in a stable state and don't get spurious mouse events at unexpected targets.
window.requestAnimationFrame(
function() {
setTimeout(goNextStepSync, 0);
}
);
}
function goNextStepSync()
{
if (gTestIndex >= 0 && "end" in gPopupTests[gTestIndex] && gPopupTests[gTestIndex].end) {
finish();