Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / workers / shared-worker-gc.html
blobc2fbd2f2be67e6116bef14197408bb6228603bcb
1 <body>
2 <p>Test shared worker garbage collection. Should print "PASS" followed by "DONE".</p>
3 <div id=result></div>
4 <script>
5 function log(message)
7 document.getElementById("result").innerHTML += message + "<br>";
10 function gc()
12 if (window.GCController)
13 return GCController.collect();
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");
20 if (window.testRunner) {
21 testRunner.dumpAsText();
22 testRunner.waitUntilDone();
25 var worker = new SharedWorker('resources/shared-worker-common.js', 'name');
26 worker.port.onmessage = handleMessage;
27 worker.port.postMessage("ping");
28 worker = 0;
29 gc();
31 function handleMessage(event) {
32 log(event.data);
33 log("DONE");
34 if (window.testRunner)
35 testRunner.notifyDone();
37 </script>
38 </body>