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