summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/plugins/npruntime/leak-window-scriptable-object.html
blob: ec29bed23dcb1ddebc5d78b0e943a9807b5e280b (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
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Test that a plugin that fails to release the window script object doesn't result in the window's document being leaked");

if (window.internals) {
    // Test that the live document count returns to the initial value, rather than to a specific value, so this test is robust to leaks in preceding tests.
    gc();
    gc(); // FIXME: Unclear why this is needed, see crbug.com/307614
    var initialLiveDocumentCount = window.internals.numberOfLiveDocuments();

    var iframe = document.createElement('iframe');
    document.body.appendChild(iframe);
    iframe.contentWindow.document.documentElement.innerHTML = '<embed id="plugin" type="application/x-webkit-test-netscape" test="leak-window-scriptable-object"></embed>';

    shouldBeTrue("window.internals.numberOfLiveDocuments() > initialLiveDocumentCount");

    document.body.removeChild(iframe);

    gc();
    shouldBeTrue("window.internals.numberOfLiveDocuments() == initialLiveDocumentCount");
}

var successfullyParsed = true;
</script>
</body>
</html>