2308a58f132f6859c60e584d5b9e1571f094f863
[WebKit-https.git] / LayoutTests / accessibility / div-within-anchors-causes-crash.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 
2 <html> 
3 <head>
4 <script> 
5     var successfullyParsed = false;
6
7     function buildAccessibilityTree(accessibilityObject, indent) {
8         var str = "";
9         for (var i = 0; i < indent; i++)
10             str += "    ";
11         str += accessibilityObject.role;
12         str += " " + accessibilityObject.stringValue;
13         str += "\n";
14         document.getElementById("tree").innerText += str;
15
16         if (accessibilityObject.stringValue.indexOf('End of test') >= 0)
17             return false;
18
19         var count = accessibilityObject.childrenCount;
20         for (var i = 0; i < count; ++i) {
21             if (!buildAccessibilityTree(accessibilityObject.childAtIndex(i), indent + 1))
22                 return false;
23         }
24
25         return true;
26     }
27 </script> 
28 <script src="../fast/js/resources/js-test-pre.js"></script> 
29 </head> 
30 <body> 
31  
32 <a><div></div></a>
33
34 <a><div></div></a>
35
36 <a href="about:blank"><div></div></a> 
37
38 <div>End of test</div>
39
40 <pre id="tree"></pre>
41  
42 <p id="description"></p> 
43 <div id="console"></div> 
44  
45 <script> 
46     description("This can cause a crash.");
47  
48     if (window.accessibilityController) {
49         // First build up full accessibility tree.
50         document.getElementById("tree").innerText += "Before:\n";
51         document.body.focus();
52         buildAccessibilityTree(accessibilityController.focusedElement, 0);
53         
54         // Remove anchor that causes debug assert in AccessibilityRenderObject::addChildren
55         document.body.removeChild(document.body.children[2])
56         
57         // Build up full accessibility tree again.
58         document.getElementById("tree").innerText += "After:\n";
59         document.body.focus();
60         buildAccessibilityTree(accessibilityController.focusedElement, 0);
61     }
62  
63     successfullyParsed = true;
64 </script> 
65  
66 <script src="../fast/js/resources/js-test-post.js"></script> 
67 </body> 
68 </html>