OLD | NEW |
1 <body> | 1 <body> |
2 <p>Test Worker.terminate().</p> | 2 <p>Test Worker.terminate().</p> |
3 <div id=result></div> | 3 <div id=result></div> |
| 4 <script src="../../resources/gc.js"></script> |
4 <script> | 5 <script> |
5 function log(message) | 6 function log(message) |
6 { | 7 { |
7 document.getElementById("result").innerHTML += message + "<br>"; | 8 document.getElementById("result").innerHTML += message + "<br>"; |
8 } | 9 } |
9 | 10 |
10 function gc() | |
11 { | |
12 if (window.GCController) | |
13 return GCController.collect(); | |
14 | |
15 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires
about 9K allocations before a collect) | |
16 var s = new String("abc"); | |
17 } | |
18 } | |
19 | |
20 if (window.testRunner) { | 11 if (window.testRunner) { |
21 testRunner.dumpAsText(); | 12 testRunner.dumpAsText(); |
22 testRunner.waitUntilDone(); | 13 testRunner.waitUntilDone(); |
23 } | 14 } |
24 | 15 |
25 var worker = new Worker('resources/worker-common.js'); | 16 var worker = new Worker('resources/worker-common.js'); |
26 worker.terminate(); | 17 worker.terminate(); |
27 | 18 |
28 var worker2 = new Worker('resources/worker-common.js'); | 19 var worker2 = new Worker('resources/worker-common.js'); |
29 worker2.terminate(); | 20 worker2.terminate(); |
(...skipping 13 matching lines...) Expand all Loading... |
43 worker4.postMessage("eval true"); | 34 worker4.postMessage("eval true"); |
44 worker4.terminate(); | 35 worker4.terminate(); |
45 log("Received message from worker4."); | 36 log("Received message from worker4."); |
46 setTimeout("log('DONE'); if (window.testRunner) testRunner.notifyDone()", 10
00); | 37 setTimeout("log('DONE'); if (window.testRunner) testRunner.notifyDone()", 10
00); |
47 } | 38 } |
48 worker4.postMessage("eval true"); | 39 worker4.postMessage("eval true"); |
49 | 40 |
50 </script> | 41 </script> |
51 </body> | 42 </body> |
52 </html> | 43 </html> |
OLD | NEW |