blob: 416193b3886f9aa59b82e9310755c1cf9900010b [file] [log] [blame]
function test()
if (window.testRunner) {
var counter = 0;
var worker = new Worker("resources/wrapper-map-gc.js");
// Post the message from worker back to the worker.
// This will fire another onmessage event in the Worker and allocate more data.
worker.onmessage = function(evt)
// This appears to be enough to reliably trigger GC in a Worker (about 20Mb strings allocated).
if (++counter > 20) {
document.getElementById("result").innerText = "PASS";
if (window.testRunner) {
<body onload=test()>
<p>This test tries to cause GC in Worker context. It also fires events in the Worker, which allocates JS DOM Wrappers for Event object. As a result of GC, the maps that map wrappers to DOM Objects will be cleaned up. Test succeeds if it does not crash and prints 'PASS' at the end.</p>
<pre id="result"></pre>