Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / workers / worker-init.html
blobddfdbb702c3e70bfc5470e73e69bf592c133e3e2
1 <body>
2 <p>Test that worker object is not garbage collected if there is a message from
3 worker context. Should print "SUCCESS".
4 <a href="https://bugs.webkit.org/show_bug.cgi?id=62446">Bug 62446</a></p>
5 <div id=result></div>
6 <script>
7 function log(message)
9 document.getElementById("result").innerHTML += message + "<br>";
12 function gc()
14 if (window.GCController)
15 return GCController.collect();
17 var head;
18 for (var i = 0; i < 10000; i++) {
19 var newHead = new Array(1000);
20 newHead[0] = head;
21 head = newHead;
25 if (window.testRunner) {
26 testRunner.dumpAsText();
27 testRunner.waitUntilDone();
30 var interval = setInterval(gc, 0);
32 var worker = new Worker('resources/worker-init.js');
33 worker.onmessage = function(evt) {
34 log(evt.data);
35 clearInterval(interval);
36 if (window.testRunner)
37 testRunner.notifyDone();
39 worker = 0;
40 gc();
41 </script>
42 </body>
43 </html>