Title: [292708] trunk/LayoutTests
Revision
292708
Author
andresg...@apple.com
Date
2022-04-11 08:32:20 -0700 (Mon, 11 Apr 2022)

Log Message

Rewrite accessibility/table-modification-crash.html to test that the AX tree reflects the changes made to the table rows.
https://bugs.webkit.org/show_bug.cgi?id=239013
<rdar://problem/91498453>

Reviewed by Darin Adler.

Renamed and rewrote this test to actually test more than just that it
doesn't crash. Now we check that the AX tree reflects the changes of
adding and removing table rows.

* accessibility/table-add-remove-row-expected.txt: Added.
* accessibility/table-add-remove-row.html: Added.
* accessibility/table-modification-crash-expected.txt: Removed.
* accessibility/table-modification-crash.html: Removed.
* platform/glib/accessibility/table-add-remove-row-expected.txt:
* platform/win/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (292707 => 292708)


--- trunk/LayoutTests/ChangeLog	2022-04-11 13:43:57 UTC (rev 292707)
+++ trunk/LayoutTests/ChangeLog	2022-04-11 15:32:20 UTC (rev 292708)
@@ -1,3 +1,22 @@
+2022-04-11  Andres Gonzalez  <andresg...@apple.com>
+
+        Rewrite accessibility/table-modification-crash.html to test that the AX tree reflects the changes made to the table rows.
+        https://bugs.webkit.org/show_bug.cgi?id=239013
+        <rdar://problem/91498453>
+
+        Reviewed by Darin Adler.
+
+        Renamed and rewrote this test to actually test more than just that it
+        doesn't crash. Now we check that the AX tree reflects the changes of
+        adding and removing table rows.
+
+        * accessibility/table-add-remove-row-expected.txt: Added.
+        * accessibility/table-add-remove-row.html: Added.
+        * accessibility/table-modification-crash-expected.txt: Removed.
+        * accessibility/table-modification-crash.html: Removed.
+        * platform/glib/accessibility/table-add-remove-row-expected.txt:
+        * platform/win/TestExpectations:
+
 2022-04-10  Tyler Wilcock  <tyle...@apple.com>
 
         Fix accessibility/aria-invalid.html in isolated tree mode

Added: trunk/LayoutTests/accessibility/table-add-remove-row-expected.txt (0 => 292708)


--- trunk/LayoutTests/accessibility/table-add-remove-row-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/table-add-remove-row-expected.txt	2022-04-11 15:32:20 UTC (rev 292708)
@@ -0,0 +1,12 @@
+Original number of rows: 1
+firstRow
+Number of rows after appending 1 row: 2
+firstRow
+secondRow
+Number of rows after removing first row: 1
+secondRow
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+d	e	f

Added: trunk/LayoutTests/accessibility/table-add-remove-row.html (0 => 292708)


--- trunk/LayoutTests/accessibility/table-add-remove-row.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/table-add-remove-row.html	2022-04-11 15:32:20 UTC (rev 292708)
@@ -0,0 +1,61 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<table id="table1" role="table">
+    <tr id="firstRow"><td>a</td><td>b</td><td>c</td></tr>
+</table>
+
+<script>
+    function outputTableRows(axTable) {
+        let output = "";
+        for (let i = 0; i < axTable.rowCount; ++i)
+            output += axTable.rowAtIndex(i).domIdentifier + "\n";
+        return output;
+    }
+
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+        let output = "";
+
+        let axTable = accessibilityController.accessibleElementById("table1");
+        output += `Original number of rows: ${axTable.rowCount}\n`;
+        output += outputTableRows(axTable);
+
+        // Create and apend a new row to table.
+        let table = document.getElementById("table1");
+        let row = document.createElement("tr");
+        row.id = "secondRow";
+        let td1 = document.createElement("td");
+        td1.appendChild(document.createTextNode("d"));
+        row.appendChild(td1);
+        let td2 = document.createElement("td");
+        td2.appendChild(document.createTextNode("e"));
+        row.appendChild(td2);
+        let td3 = document.createElement("td");
+        td3.appendChild(document.createTextNode("f"));
+        row.appendChild(td3);
+        table.appendChild(row);
+
+        setTimeout(async () => {
+            await waitFor(() => { return axTable.rowCount == 2; });
+            output += `Number of rows after appending 1 row: ${axTable.rowCount}\n`;
+            output += outputTableRows(axTable);
+
+            // Remove first row.
+            table.removeChild(table.childNodes[1]);
+
+            await waitFor(() => { return axTable.rowCount == 1; });
+            output += `Number of rows after removing first row: ${axTable.rowCount}\n`;
+            output += outputTableRows(axTable);
+
+            debug(output);
+            finishJSTest();
+        }, 0);
+    }
+</script>
+</body>
+</html>

Deleted: trunk/LayoutTests/accessibility/table-modification-crash-expected.txt (292707 => 292708)


--- trunk/LayoutTests/accessibility/table-modification-crash-expected.txt	2022-04-11 13:43:57 UTC (rev 292707)
+++ trunk/LayoutTests/accessibility/table-modification-crash-expected.txt	2022-04-11 15:32:20 UTC (rev 292708)
@@ -1,3 +0,0 @@
-column 1	column 2	column 3
-Test passed
-

Deleted: trunk/LayoutTests/accessibility/table-modification-crash.html (292707 => 292708)


--- trunk/LayoutTests/accessibility/table-modification-crash.html	2022-04-11 13:43:57 UTC (rev 292707)
+++ trunk/LayoutTests/accessibility/table-modification-crash.html	2022-04-11 15:32:20 UTC (rev 292708)
@@ -1,50 +0,0 @@
-<html>
-<script>
-    if (window.testRunner)
-        testRunner.dumpAsText();
-</script>
-
-<body id="body">
-
-    <!-- This test makes sure we do not crash if _javascript_ changes a table element -->
- 
-    <table border=1 id='table1'><tr><td>a</td><td>b</td><td>c</td></tr></table>
-
-    <div id="result"></div>
-     
-    <script>
-        if (window.accessibilityController) {
-            var result = document.getElementById("result");
-
-            var table = document.getElementById("table1");
-            table.focus();
-            tableAX = accessibilityController.focusedElement;
-
-            var string = tableAX.attributesOfChildren();
-
-             var row = document.createElement("tr")
-             var td1 = document.createElement("td")
-             td1.appendChild(document.createTextNode("column 1"))
-             row.appendChild(td1);
-
-             var td2 = document.createElement("td")
-             td2.appendChild(document.createTextNode("column 2"))
-             row.appendChild(td2);
-
-             var td3 = document.createElement("td")
-             td3.appendChild(document.createTextNode("column 3"))
-             row.appendChild(td3);
-
-             table.childNodes[0].appendChild(row);
-
-             string = tableAX.attributesOfChildren();
- 
-             table.childNodes[0].removeChild(table.childNodes[0].childNodes[0]);
-
-             string = tableAX.attributesOfChildren();
-         
-             result.innerText += "Test passed\n";
-        }
-    </script>
-</body>
-</html>

Added: trunk/LayoutTests/platform/glib/accessibility/table-add-remove-row-expected.txt (0 => 292708)


--- trunk/LayoutTests/platform/glib/accessibility/table-add-remove-row-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/glib/accessibility/table-add-remove-row-expected.txt	2022-04-11 15:32:20 UTC (rev 292708)
@@ -0,0 +1,12 @@
+Original number of rows: 1
+null
+Number of rows after appending 1 row: 2
+null
+null
+Number of rows after removing first row: 1
+null
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+d	e	f

Modified: trunk/LayoutTests/platform/win/TestExpectations (292707 => 292708)


--- trunk/LayoutTests/platform/win/TestExpectations	2022-04-11 13:43:57 UTC (rev 292707)
+++ trunk/LayoutTests/platform/win/TestExpectations	2022-04-11 15:32:20 UTC (rev 292708)
@@ -1927,7 +1927,7 @@
 [ Debug ] accessibility/selection-states.html [ Skip ] # Debug assertion
 [ Debug ] accessibility/svg-image.html [ Skip ] # Debug assertion
 [ Debug ] accessibility/table-destroyed-crash.html [ Skip ] # Debug assertion
-[ Debug ] accessibility/table-modification-crash.html [ Skip ] # Debug assertion
+accessibility/table-add-remove-row.html [ Skip ]
 [ Debug ] accessibility/table-notbody.html [ Skip ] # Debug assertion
 [ Debug ] accessibility/table-nofirstbody.html [ Skip ] # Debug assertion
 [ Debug ] accessibility/table-remove-cell-crash.html [ Skip ] # Debug assertion
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to