2011-05-24 Jay Civelli <jcivelli@chromium.org>
[WebKit-https.git] / LayoutTests / accessibility / updating-attribute-in-table-causes-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 <table id="table">
13 <tr id="row"><td id="tablecell" tabindex=0>1</td><td>2</td></tr>
14 <tr id="row2"><td id="tablecell2" tabindex=0>1</td><td>2</td></tr>
15 </table>
16
17 <p id="description"></p>
18 <div id="console"></div>
19
20 <script>
21     description("This tests for a crash that can occur while altering an attribute on a table cell because it accesses the table when its in a bad state.");
22
23     if (window.accessibilityController) {
24         document.getElementById("body").focus();
25         var body = accessibilityController.focusedElement;
26         var tr = document.createElement("tr");
27         var td = document.createElement("td");
28         td.appendChild(document.createTextNode("asdf"));
29         tr.appendChild(td);
30
31         // To reproduce, we need to remove a row and replace with another row, then set an attribute in the meantime.
32         document.getElementById("table").getElementsByTagName("TBODY")[0].removeChild(document.getElementById("row2"));
33         document.getElementById("table").getElementsByTagName("TBODY")[0].appendChild(tr);
34         document.getElementById("tablecell").setAttribute("title", "test");
35     }
36
37     successfullyParsed = true;
38 </script>
39
40 <script src="../fast/js/resources/js-test-post.js"></script>
41 </body>
42 </html>