2010-06-18 02:18:42 -07:00
|
|
|
var topElements = document.getElementsByClassName("scrollTop");
|
|
|
|
if (!topElements.length) {
|
2011-02-10 00:58:11 -08:00
|
|
|
topElements = [document.documentElement];
|
2010-06-18 02:18:42 -07:00
|
|
|
}
|
|
|
|
|
2011-02-10 00:58:11 -08:00
|
|
|
var failed = false;
|
|
|
|
|
2010-06-18 02:18:42 -07:00
|
|
|
function doScroll(d)
|
|
|
|
{
|
2011-02-10 00:58:11 -08:00
|
|
|
if (failed)
|
|
|
|
return;
|
2010-06-18 02:18:42 -07:00
|
|
|
for (var i = 0; i < topElements.length; ++i) {
|
2011-02-10 00:58:11 -08:00
|
|
|
var e = topElements[i];
|
|
|
|
e.scrollTop = d;
|
|
|
|
if (e.scrollTop != d) {
|
|
|
|
document.documentElement.textContent =
|
|
|
|
"Scrolling failed on " + e.tagName + " element, " +
|
|
|
|
"tried to scroll to " + d + ", got " + e.scrollTop +
|
|
|
|
" (Random number: " + Math.random() + ")";
|
|
|
|
failed = true;
|
|
|
|
}
|
2010-06-18 02:18:42 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (document.location.search == '?ref') {
|
|
|
|
doScroll(20);
|
|
|
|
} else {
|
|
|
|
doScroll(1);
|
|
|
|
document.documentElement.setAttribute("class", "reftest-wait");
|
|
|
|
window.addEventListener("MozReftestInvalidate", function() {
|
|
|
|
document.documentElement.removeAttribute("class");
|
|
|
|
doScroll(20);
|
|
|
|
}, false);
|
|
|
|
}
|