Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/workers/support/Timer.js

Issue 2418853003: Worker: Import "imported/wpt/workers" tests (Retry) (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 var count = 0;
2 var id;
3
4 onmessage = function(evt)
5 {
6 try
7 {
8 switch(evt.data)
9 {
10 case "TimeoutHandler":
11 count = 0;
12 id = setTimeout("TimeoutHandler()", 10);
13 postMessage('hello');
14 break;
15 case "IntervalHandler":
16 count = 0;
17 id = setInterval("IntervalHandler()", 10);
18 postMessage('hello');
19 break;
20 }
21 }
22 catch(ex)
23 {
24 postMessage("Fail");
25 }
26 }
27
28 function TimeoutHandler()
29 {
30 count++;
31 postMessage("worker");
32
33 id = setTimeout("TimeoutHandler()", 10);
34
35 if (count >= 2)
36 {
37 clearTimeout(id);
38 }
39 }
40
41 function IntervalHandler()
42 {
43 count++;
44 postMessage("worker");
45
46 if (count >= 2)
47 {
48 clearInterval(id);
49 }
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698