Title: [264323] trunk
Revision
264323
Author
[email protected]
Date
2020-07-13 16:15:18 -0700 (Mon, 13 Jul 2020)

Log Message

REGRESSION: (r257915?) [ Mac ] accessibility/accessibility-node-memory-management.html is flaky failing.
https://bugs.webkit.org/show_bug.cgi?id=208930
Source/WebCore:

Reviewed by Chris Fleizach.

Test: accessibility/accessibility-node-memory-management.html

In some cases, such as the empty canvas in this test, the algorithm in
AXIsolatedTree::updateChildren to only update the children that are
added or removed does not work. In those cases, fallback to updating
the entire subtree.

* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateChildren):

LayoutTests:

<rdar://problem/60173203>

Reviewed by Chris Fleizach.

Using setTimeout and waitFor/Promises to make this test work in both
isolated tree mode on and off.

* accessibility/accessibility-node-memory-management-expected.txt:
* accessibility/accessibility-node-memory-management.html:
* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264322 => 264323)


--- trunk/LayoutTests/ChangeLog	2020-07-13 22:36:01 UTC (rev 264322)
+++ trunk/LayoutTests/ChangeLog	2020-07-13 23:15:18 UTC (rev 264323)
@@ -1,3 +1,18 @@
+2020-07-13  Andres Gonzalez  <[email protected]>
+
+        REGRESSION: (r257915?) [ Mac ] accessibility/accessibility-node-memory-management.html is flaky failing.
+        https://bugs.webkit.org/show_bug.cgi?id=208930
+        <rdar://problem/60173203>
+
+        Reviewed by Chris Fleizach.
+
+        Using setTimeout and waitFor/Promises to make this test work in both
+        isolated tree mode on and off.
+
+        * accessibility/accessibility-node-memory-management-expected.txt:
+        * accessibility/accessibility-node-memory-management.html:
+        * platform/mac/TestExpectations:
+
 2020-07-13  Lauro Moura  <[email protected]>
 
         Unreviewed. Update baseline after r264304 with new message.

Modified: trunk/LayoutTests/accessibility/accessibility-node-memory-management-expected.txt (264322 => 264323)


--- trunk/LayoutTests/accessibility/accessibility-node-memory-management-expected.txt	2020-07-13 22:36:01 UTC (rev 264322)
+++ trunk/LayoutTests/accessibility/accessibility-node-memory-management-expected.txt	2020-07-13 23:15:18 UTC (rev 264323)
@@ -3,9 +3,13 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS expectedButtonRole != expectedDetachedRole is true
-PASS canvasButtonRole is expectedButtonRole
-PASS detachedCanvasButtonRole is expectedDetachedRole
+Button role: AXRole: AXButton
+Button role after being detached: AXRole: 
+PASS buttonRole != detachedRole is true
+Canvas button role: AXRole: AXButton
+PASS canvasButtonRole is buttonRole
+Canvas button role after being detached: AXRole: 
+PASS detachedCanvasButtonRole is detachedRole
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/accessibility-node-memory-management.html (264322 => 264323)


--- trunk/LayoutTests/accessibility/accessibility-node-memory-management.html	2020-07-13 22:36:01 UTC (rev 264322)
+++ trunk/LayoutTests/accessibility/accessibility-node-memory-management.html	2020-07-13 23:15:18 UTC (rev 264323)
@@ -1,35 +1,42 @@
 <!DOCTYPE HTML>
 <html>
+<head>
+<script src=""
+<script src=""
+</head>
 <body>
-<script src=""
+
 <canvas id="canvas" tabindex="-1"></canvas>
+
+<p id="description"></p>
 <div id="console"></div>
+
 <script>
+    description("This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is deleted.");
 
-var jsTestIsAsync = true;
+    if (window.testRunner && window.accessibilityController) {
+        window.jsTestIsAsync = true;
+        testRunner.dumpAsText();
 
-description("This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is deleted.");
+        // Create an ordinary button on the page, focus it and get its accessibility role.
+        var button = document.createElement('button');
+        document.body.appendChild(button);
+        button.focus();
 
-if (window.testRunner && window.accessibilityController) {
-    testRunner.dumpAsText();
+        axButton = accessibilityController.focusedElement;
+        buttonRole = axButton.role;
+        debug("Button role: " + buttonRole);
 
-    // Create an ordinary button on the page, focus it and get its accessibility role.
-    var button = document.createElement('button');
-    document.body.appendChild(button);
-    button.focus();
-    axElement = accessibilityController.focusedElement;
-    expectedButtonRole = axElement.role;
+        // Now remove the button from the tree and get the role of the detached accessibility object.
+        document.body.removeChild(button);
+        detachedRole = axButton.role;
+        debug("Button role after being detached: " + detachedRole);
+        shouldBeTrue("buttonRole != detachedRole");
 
-    // Now remove the button from the tree and get the role of the detached accessibility object.
-    document.body.removeChild(button);
-    expectedDetachedRole = axElement.role;
-    shouldBeTrue("expectedButtonRole != expectedDetachedRole");
-
-    // This time create a button that's a child of a canvas element. It will be focusable but not rendered.
-    // In particular, this will create an AccessibilityNodeObject rather than an AccessibilityRenderObject.
-    var canvas = document.getElementById('canvas');
-    (function() {
-        var button = document.createElement('button');
+        // This time create a button that's a child of a canvas element. It will be focusable but not rendered.
+        // In particular, this will create an AccessibilityNodeObject rather than an AccessibilityRenderObject.
+        var canvas = document.getElementById('canvas');
+        button = document.createElement('button');
         canvas.appendChild(button);
 
         // Note: Focusing the button and using that to get its accessibility object creates an extra
@@ -36,31 +43,33 @@
         // reference to the button and it won't get deleted when we want it to. So instead we focus the
         // canvas and get its first child.
         canvas.focus();
-        axElement = accessibilityController.focusedElement.childAtIndex(0);
 
-        canvasButtonRole = axElement.role;
-        shouldBe("canvasButtonRole", "expectedButtonRole");
+        var axCanvas = null;
+        setTimeout(async function() {
+            await waitFor(() => {
+                axCanvas = accessibilityController.focusedElement;
+                return axCanvas.childrenCount > 0;
+            });
+            axButton = axCanvas.childAtIndex(0);
+            canvasButtonRole = axButton.role;
+            debug("Canvas button role: " + canvasButtonRole);
+            shouldBe("canvasButtonRole", "buttonRole");
 
-        // Now delete the last reference to the button.
-        canvas.removeChild(button);
-    })();
+            // Now delete the last reference to the button.
+            canvas.removeChild(button);
+            // Explicitly run garbage collection now. Since there are no more references to the button,
+            // it will be destroyed.
+            gc();
 
-    setTimeout("finishTest()", 0);
-}
+            // Ensure that the accessibility object is detached by checking its role.
+            detachedCanvasButtonRole = axButton.role;
+            debug("Canvas button role after being detached: " + detachedCanvasButtonRole);
+            shouldBe("detachedCanvasButtonRole", "detachedRole");
 
-function finishTest()
-{
-    // Explicitly run garbage collection now. Since there are no more references to the button,
-    // it will be destroyed.
-    gc();
+            finishJSTest();
+        }, 0);
+    }
 
-    // Ensure that the accessibility object is detached by checking its role.
-    detachedCanvasButtonRole = axElement.role;
-    shouldBe("detachedCanvasButtonRole", "expectedDetachedRole");
-
-    finishJSTest();
-}
-
 </script>
 
 <script src=""

Modified: trunk/LayoutTests/platform/mac/TestExpectations (264322 => 264323)


--- trunk/LayoutTests/platform/mac/TestExpectations	2020-07-13 22:36:01 UTC (rev 264322)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2020-07-13 23:15:18 UTC (rev 264323)
@@ -1836,8 +1836,6 @@
 
 webkit.org/b/209257 svg/as-object/object-box-sizing-no-width-height.html [ Pass Failure ]
 
-webkit.org/b/208930 accessibility/accessibility-node-memory-management.html [ Pass Failure ]
-
 webkit.org/b/209056 webgpu/whlsl/uint-bitwise.html [ Pass Crash ]
 
 webkit.org/b/209072 [ Debug ] http/tests/css/shared-stylesheet-mutation-preconstruct.html [ Pass Crash Failure ]

Modified: trunk/Source/WebCore/ChangeLog (264322 => 264323)


--- trunk/Source/WebCore/ChangeLog	2020-07-13 22:36:01 UTC (rev 264322)
+++ trunk/Source/WebCore/ChangeLog	2020-07-13 23:15:18 UTC (rev 264323)
@@ -1,3 +1,20 @@
+2020-07-13  Andres Gonzalez  <[email protected]>
+
+        REGRESSION: (r257915?) [ Mac ] accessibility/accessibility-node-memory-management.html is flaky failing.
+        https://bugs.webkit.org/show_bug.cgi?id=208930
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/accessibility-node-memory-management.html
+
+        In some cases, such as the empty canvas in this test, the algorithm in
+        AXIsolatedTree::updateChildren to only update the children that are
+        added or removed does not work. In those cases, fallback to updating
+        the entire subtree.
+
+        * accessibility/isolatedtree/AXIsolatedTree.cpp:
+        (WebCore::AXIsolatedTree::updateChildren):
+
 2020-07-13  Keith Miller  <[email protected]>
 
         ScriptController needs to SetForScope m_sourceURL after Refing its Frame

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (264322 => 264323)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2020-07-13 22:36:01 UTC (rev 264322)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2020-07-13 23:15:18 UTC (rev 264323)
@@ -290,6 +290,7 @@
     const auto& axChildren = axAncestor->children();
     auto axChildrenIDs = axAncestor->childrenIDs();
 
+    bool updatedChild = false; // Set to true if at least one child's subtree is updated.
     for (size_t i = 0; i < axChildren.size() && i < axChildrenIDs.size(); ++i) {
         size_t index = removals.find(axChildrenIDs[i]);
         if (index != notFound)
@@ -300,6 +301,7 @@
             AXLOG("Adding a new child for:");
             AXLOG(axChildren[i]);
             generateSubtree(*axChildren[i], axAncestor, true);
+            updatedChild = true;
         }
     }
 
@@ -308,9 +310,14 @@
     for (const AXID& childID : removals)
         removeSubtree(childID);
 
-    // Lastly, make the children IDs of the isolated object to be the same as the AXObject's.
-    LockHolder locker { m_changeLogLock };
-    updateChildrenIDs(axAncestor->objectID(), WTFMove(axChildrenIDs));
+    if (updatedChild || removals.size()) {
+        // Make the children IDs of the isolated object to be the same as the AXObject's.
+        LockHolder locker { m_changeLogLock };
+        updateChildrenIDs(axAncestor->objectID(), WTFMove(axChildrenIDs));
+    } else {
+        // Nothing was updated. As a last resort, update the subtree.
+        updateSubtree(*axAncestor);
+    }
 }
 
 RefPtr<AXIsolatedObject> AXIsolatedTree::focusedNode()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to