1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../../resources/js-test.js"></script>
9 description("This checks that setTimeout() and setInterval() return unique results within their script execution context.");
11 function checkTimeoutIDs(tID1
, tID2
, tID3
)
13 debug("Checking the results of setTimeout:");
14 shouldBeTrue("tID1 > 0");
15 shouldBeTrue("tID2 > 0");
16 shouldBeTrue("tID3 > 0");
17 shouldBeTrue("tID1 !== tID2");
18 shouldBeTrue("tID1 !== tID3");
19 shouldBeTrue("tID2 !== tID3");
26 function checkIntervalIDs(iID1
, iID2
, iID3
)
28 debug("Checking the results of setInterval:");
29 shouldBeTrue("iID1 > 0");
30 shouldBeTrue("iID2 > 0");
31 shouldBeTrue("iID3 > 0");
32 shouldBeTrue("iID1 !== iID2");
33 shouldBeTrue("iID1 !== iID3");
34 shouldBeTrue("iID2 !== iID3");
41 var tID1
= setTimeout('echo("timeout 1")', 0);
42 var tID2
= setTimeout('echo("timeout 2")', 0);
43 var iID1
= setInterval('echo("interval 1")', 0);
44 var iID2
= setInterval('echo("interval 2")', 0);
45 var tID3
= setTimeout('echo("timeout 3")', 0);
46 var iID3
= setInterval('echo("interval 3")', 0);
48 checkTimeoutIDs(tID1
, tID2
, tID3
);
49 checkIntervalIDs(iID1
, iID2
, iID3
);