53 lines
1.3 KiB
HTML
53 lines
1.3 KiB
HTML
<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;
|
|
setTimeout(fastTimeoutHandler, 1);
|
|
}
|
|
|
|
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);
|
|
|
|
setTimeout(slowTimeoutHandler, 1000);
|
|
setTimeout(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>
|