| testRunner.waitUntilDone(); |
| // Access all objects/properties that we're going to use later in the test so that JS |
| // allocations only happen when we expect. |
| var body = document.body; |
| var plugin = body.getElementsByTagName('embed')[0]; |
| var testObject = plugin.testObject; |
| // Allocate a bunch of JS memory. This should cause testObject to be finalized, but it's |
| // destructor shouldn't run until the GCController.collect call we make later. |
| var array = new Array(10000); |
| for (var i = 0; i < 10000; ++i) |
| // Remove the plugin and wait for a little bit to ensure it has been unloaded (WebKit1 |
| // on Windows unloads plugins after a delay). |
| body.removeChild(plugin); |
| setTimeout(finishTest, 250); |
| // Force a GC. If we don't crash here, we've passed the test. |
| document.body.appendChild(document.createTextNode('PASSED')); |
| addEventListener('load', startTest, false); |
| <p>This test will only work in DumpRenderTree/WebKitTestRunner.</p> |
| <embed type="application/x-webkit-test-netscape"> |