blob: ccf4b0d04a90f8e74e5a1e499aa0730502f98235 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<!DOCTYPE html>
<html>
<head>
<script>
function startTest() {
if (window.testRunner) {
testRunner.dumpAsText();
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;
body.removeChild;
var plugin = body.getElementsByTagName('embed')[0];
var testObject = plugin.testObject;
setTimeout;
testObject = null;
// 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)
array[i] = new Object();
// 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);
}
function finishTest() {
// Force a GC. If we don't crash here, we've passed the test.
if (window.GCController)
GCController.collect();
document.body.appendChild(document.createTextNode('PASSED'));
if (window.testRunner)
testRunner.notifyDone();
}
addEventListener('load', startTest, false);
</script>
</head>
<body>
<p>This test will only work in DumpRenderTree/WebKitTestRunner.</p>
<embed type="application/x-webkit-test-netscape">
</body>
</html>
|