summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/NodeList/childNodes-reset-cache.html
blob: de47e39cfef48d02459a6ba1371829b2e896c900 (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
<html>
<body>
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=13514">bug 13514</a>:
REGRESSION (r20997-21003): Crash in WebCore::Node::Document.</p>
<div id="elem"><p></p></div>

<script>
if (window.layoutTestController)
  layoutTestController.dumpAsText();

function gc()
{
    if (window.GCController)
        return GCController.collect();

    for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
        var s = new String("");
    }
}

elem = document.getElementById('elem');

elem.childNodes.length;
elem.childNodes[0].length;
gc();
elem.innerHTML = "";
gc();
elem.childNodes[0];
if (elem.childNodes.length == 0)
  document.write("SUCCESS");
else
  document.write("FAILURE: childNodes.length was cached inappropriately");

</script>
</body>
</html>