6 if (window.layoutTestController) {
7 layoutTestController.dumpAsText();
8 layoutTestController.waitUntilDone();
11 // Access all objects/properties that we're going to use later in the test so that JS
12 // allocations only happen when we expect.
13 var body = document.body;
15 var plugin = body.getElementsByTagName('embed')[0];
16 var testObject = plugin.testObject;
21 // Allocate a bunch of JS memory. This should cause testObject to be finalized, but it's
22 // destructor shouldn't run until the GCController.collect call we make later.
23 var array = new Array(10000);
24 for (var i = 0; i < 10000; ++i)
25 array[i] = new Object();
27 // Remove the plugin and wait for a little bit to ensure it has been unloaded (WebKit1
28 // on Windows unloads plugins after a delay).
29 body.removeChild(plugin);
30 setTimeout(finishTest, 250);
33 function finishTest() {
34 // Force a GC. If we don't crash here, we've passed the test.
35 if (window.GCController)
36 GCController.collect();
38 document.body.appendChild(document.createTextNode('PASSED'));
40 if (window.layoutTestController)
41 layoutTestController.notifyDone();
44 addEventListener('load', startTest, false);
48 <p>This test will only work in DumpRenderTree/WebKitTestRunner.</p>
49 <embed type="application/x-webkit-test-netscape">