OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script> | |
5 function startTest() { | |
6 if (window.testRunner) { | |
7 testRunner.dumpAsText(); | |
8 testRunner.waitUntilDone(); | |
9 } | |
10 | |
11 // Access all objects/properties that we're going to use later in th
e test so that JS | |
12 // allocations only happen when we expect. | |
13 var body = document.body; | |
14 body.removeChild; | |
15 var plugin = body.getElementsByTagName('embed')[0]; | |
16 var testObject = plugin.testObject; | |
17 setTimeout; | |
18 | |
19 testObject = null; | |
20 | |
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 m
ake later. | |
23 var array = new Array(10000); | |
24 for (var i = 0; i < 10000; ++i) | |
25 array[i] = new Object(); | |
26 | |
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); | |
31 } | |
32 | |
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(); | |
37 | |
38 document.body.appendChild(document.createTextNode('PASSED')); | |
39 | |
40 if (window.testRunner) | |
41 testRunner.notifyDone(); | |
42 } | |
43 | |
44 addEventListener('load', startTest, false); | |
45 </script> | |
46 </head> | |
47 <body> | |
48 <p>This test will only work in DumpRenderTree/WebKitTestRunner.</p> | |
49 <embed type="application/x-webkit-test-netscape"> | |
50 </body> | |
51 </html> | |
OLD | NEW |