AX: crash when accessing selectedTab in a tab list
[WebKit-https.git] / LayoutTests / platform / mac / accessibility / selected-tab-crash.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
5 <script>
6 var successfullyParsed = false;
7 </script>
8 <script src="../../../fast/js/resources/js-test-pre.js"></script>
9 </head>
10 <body id="body">
11
12 <div role="tablist" tabindex="0" id="tablist">
13 <div role="tab" aria-checked="true" id="selectedtab">tab 1</div>
14 <div role="tab">tab 2</div>
15 <div role="tab">tab 3</div>
16 </div>
17
18 <p id="description"></p>
19 <div id="console"></div>
20
21 <script>
22
23     description("This tests that if a tablists children are updated, we will not crash accessing an old object.");
24
25     if (window.accessibilityController) {
26
27         document.getElementById("tablist").focus();
28         var tablist = accessibilityController.focusedElement;
29
30         // Iterate all the children so we have a cache of them.
31         tablist.attributesOfChildren();
32
33         // Retrieve and verify we have the right selected child.
34         var selectedTab = tablist.uiElementAttributeValue("AXValue");
35
36         // Delete the selected child.
37         document.getElementById("tablist").removeChild(document.getElementById("selectedtab"));
38
39         // Retrieve the tab. We should not crash here!
40         var selectedTab = tablist.uiElementAttributeValue("AXValue");
41     }
42
43     successfullyParsed = true;
44 </script>
45
46 <script src="../../../fast/js/resources/js-test-post.js"></script>
47 </body>
48 </html>