| <body> |
| <p>Test shared worker garbage collection. Should print "PASS" followed by "DONE".</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.layoutTestController) { |
| layoutTestController.dumpAsText(); |
| layoutTestController.waitUntilDone(); |
| } |
| |
| var worker = new SharedWorker('resources/shared-worker-common.js', 'name'); |
| worker.port.onmessage = handleMessage; |
| worker.port.postMessage("ping"); |
| worker = 0; |
| gc(); |
| |
| function handleMessage(event) { |
| log(event.data); |
| log("DONE"); |
| if (window.layoutTestController) |
| layoutTestController.notifyDone(); |
| }; |
| </script> |
| </body> |