<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>
description("This checks that setTimeout() and setInterval() return unique results within their script execution context.");
function checkTimeoutIDs(tID1, tID2, tID3)
{
debug("Checking the results of setTimeout:");
shouldBeTrue("tID1 > 0");
shouldBeTrue("tID2 > 0");
shouldBeTrue("tID3 > 0");
shouldBeTrue("tID1 !== tID2");
shouldBeTrue("tID1 !== tID3");
shouldBeTrue("tID2 !== tID3");
clearTimeout(tID1);
clearTimeout(tID2);
clearTimeout(tID3);
debug("");
}
function checkIntervalIDs(iID1, iID2, iID3)
{
debug("Checking the results of setInterval:");
shouldBeTrue("iID1 > 0");
shouldBeTrue("iID2 > 0");
shouldBeTrue("iID3 > 0");
shouldBeTrue("iID1 !== iID2");
shouldBeTrue("iID1 !== iID3");
shouldBeTrue("iID2 !== iID3");
clearInterval(iID1);
clearInterval(iID2);
clearInterval(iID3);
debug("");
}
var tID1 = setTimeout('echo("timeout 1")', 0);
var tID2 = setTimeout('echo("timeout 2")', 0);
var iID1 = setInterval('echo("interval 1")', 0);
var iID2 = setInterval('echo("interval 2")', 0);
var tID3 = setTimeout('echo("timeout 3")', 0);
var iID3 = setInterval('echo("interval 3")', 0);
checkTimeoutIDs(tID1, tID2, tID3);
checkIntervalIDs(iID1, iID2, iID3);
</script>
</body>
</html>