childNodes-reset-cache.html revision eff69b907ef2cd3a9af0351287a929c66f58e3f6
1<html>
2<body>
3<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=13514">bug 13514</a>:
4REGRESSION (r20997-21003): Crash in WebCore::Node::Document.</p>
5<div id="elem"><p></p></div>
6
7<script>
8if (window.layoutTestController)
9  layoutTestController.dumpAsText();
10
11function gc()
12{
13    if (window.GCController)
14        return GCController.collect();
15
16    for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
17        var s = new String("");
18    }
19}
20
21elem = document.getElementById('elem');
22
23elem.childNodes.length;
24elem.childNodes[0].length;
25gc();
26elem.innerHTML = "";
27gc();
28elem.childNodes[0];
29if (elem.childNodes.length == 0)
30  document.write("SUCCESS");
31else
32  document.write("FAILURE: childNodes.length was cached inappropriately");
33
34</script>
35</body>
36</html>
37