Bug 508472, wait for load and paint events before starting test, r=dolske

This commit is contained in:
Neil Deakin 2009-08-12 10:04:51 -04:00
Родитель 0a052e2fa2
Коммит 8af8ba03ec
1 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -367,8 +367,24 @@ function startTest() {
// The frame causes an extra menu item, and prevents running the test // The frame causes an extra menu item, and prevents running the test
// standalone (ie, clicking the test name in the Mochitest window) to see // standalone (ie, clicking the test name in the Mochitest window) to see
// success/failure messages. // success/failure messages.
var painted = false, loaded = false;
function waitForEvents(event)
{
if (event.type == "MozAfterPaint")
painted = true;
else if (event.type == "load")
loaded = true;
if (painted && loaded) {
subwindow.removeEventListener("MozAfterPaint", waitForEvents, false);
subwindow.onload = null;
startTest();
}
}
var subwindow = window.open("./subtst_contextmenu.html", "contextmenu-subtext", "width=600,height=700"); var subwindow = window.open("./subtst_contextmenu.html", "contextmenu-subtext", "width=600,height=700");
subwindow.onload = startTest; subwindow.addEventListener("MozAfterPaint", waitForEvents, false);
subwindow.onload = waitForEvents;
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
</script> </script>