35 lines
1.1 KiB
HTML
35 lines
1.1 KiB
HTML
<body>
|
|
<p>Test Timeouts (setTimeout, setInterval, clearTimeout, clearInterval).</p>
|
|
<div id=result></div>
|
|
<script>
|
|
var logIsFrozen = false;
|
|
function log(message)
|
|
{
|
|
if (!logIsFrozen)
|
|
document.getElementById("result").innerHTML += message + "<br>";
|
|
}
|
|
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
testRunner.waitUntilDone();
|
|
}
|
|
|
|
var worker = new Worker('resources/worker-timeout.js');
|
|
|
|
worker.onmessage = function(evt) {
|
|
log(evt.data);
|
|
if (evt.data == "DONE") {
|
|
// This flag is needed because in Chromium port, the notifyDone() does not immediately snapshots
|
|
// the result and the still-firing timer in the worker may cause more messages to be logged before
|
|
// actual termination of the test. However one objective of the test is to keep active interval
|
|
// while the worker gets destroyed, so we freeze log rather then stop the interval from firing.
|
|
// See https://bugs.webkit.org/show_bug.cgi?id=31452 for more info.
|
|
logIsFrozen = true;
|
|
if (window.testRunner)
|
|
testRunner.notifyDone();
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|