Bug 628949 - Update visible region / glass regions after we paint. r=roc a=2.0.
[mozilla-central.git] / dom / tests / js / timer.js
blobac1ed1ef34f2e8916e88786771540ea4c60bf6ff
2 function oneShot(testNum, str)
4   dump("Test #" + testNum + " successful:" + str + "\n");
7 setTimeout(oneShot, 1000, 1, "one shot timer with function argument");
8 setTimeout("oneShot(2, 'one shot timer with string argument');", 2000);
10 function reschedule(testNum, numTimes)
12   if (numTimes == 4) { 
13     dump("Test #" + testNum + " successful: Creating a timeout in a timeout\n");
14     kickoff4();
15   }
16   else {
17     dump("Test #" + testNum + " in progress: " + numTimes + "\n");
18     setTimeout(reschedule, 500, 3, numTimes+1);
19   }
22 setTimeout(reschedule, 3000, 3, 0); 
24 var count = 0;
25 var repeat_timer = null;
26 function repeat(testNum, numTimes, str, func, delay)
28   dump("Test #" + testNum + " in progress: interval delayed by " + delay + " milliseconds\n");
29   if (count++ > numTimes) {
30     clearInterval(repeat_timer);
31     dump("Test #" + testNum + " successful: " + str + "\n");
32     if (func != null) {
33       func();
34     }
35   }
38 function kickoff4()
40   repeat_timer = setInterval(repeat, 500, 4, 5, "interval test", kickoff5);
43 //setTimeout(kickoff4, 5000);
45 function oneShot2(testNum)
47   dump("Test #" + testNum + " in progress: one shot timer\n");
48   if (count++ == 4) {
49     dump("Test #" + testNum + " in progress: end of one shots\n");
50   }
51   else {
52     setTimeout(oneShot2, 500, 5);
53   }
56 function kickoff5()
58   count = 0;
59   setTimeout(oneShot2, 500, 5);
60   repeat_timer = setInterval("repeat(5, 8, 'multiple timer test', kickoff6)", 600);
63 //setTimeout(kickoff5, 12000);
65 function kickoff6()
67   dump("Test #6: Interval timeout should end when you go to a new page\n");
68   setInterval(repeat, 1000, 6, 1000, "endless timer test", null);
71 //setTimeout(kickoff6, 18000);