blob: 7309617c5363920e94747b665dc746af88f8f960 [file] [log] [blame]
<html>
<head>
<script>
function log(msg) {
var element = document.createElement("div");
element.textContent = msg;
document.body.appendChild(element);
document.body.appendChild(document.createElement("br"));
}
var count = 0;
function fastTimeoutHandler() {
++count;
}
function slowTimeoutHandler() {
// Note: the count threshold is tied somewhat to the
// maxTimerNestingLevel in DOMTimer.cpp.
if (count > 10)
log("PASS");
else
log("FAIL -- timeout ran " + count + " times");
testRunner.notifyDone();
}
function runTest() {
if (!window.testRunner) {
log("This test requires the LayoutTestController");
return;
}
testRunner.dumpAsText();
testRunner.waitUntilDone();
// Make timers run no more often than once every two seconds.
internals.settings.setMinimumTimerInterval(2.0);
setInterval(slowTimeoutHandler, 1000);
setInterval(fastTimeoutHandler, 1);
// Allow timers to run quickly again.
// If this doesn't cause timers to get re-evaluated immediately,
// the fast timeout handler won't get called for up to two seconds,
// which would lead to poor responsiveness.
internals.settings.setMinimumTimerInterval(0.004);
}
</script>
</head>
<body onload="runTest()">
</body>
</html>