Title: [290673] trunk
Revision
290673
Author
[email protected]
Date
2022-03-01 13:44:24 -0800 (Tue, 01 Mar 2022)

Log Message

Make accessibility/aria-hidden-false-works-in-subtrees.html async to pass in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=237051
<rdar://problem/89312156>

Reviewed by Chris Fleizach.

Tools:

* WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
(WTR::AccessibilityController::accessibleElementById):
Convert the JSStringRef to NSString on the main thread and capture the
NSString to be used on the AX secondary thread. This may be safer since
JSStringRefs are supposed to be used on the main thread.

LayoutTests:

* accessibility/aria-hidden-false-works-in-subtrees.html:
Made both the main script and the iframe onload function async to pass
in isolated tree mode.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290672 => 290673)


--- trunk/LayoutTests/ChangeLog	2022-03-01 21:28:07 UTC (rev 290672)
+++ trunk/LayoutTests/ChangeLog	2022-03-01 21:44:24 UTC (rev 290673)
@@ -1,3 +1,15 @@
+2022-03-01  Andres Gonzalez  <[email protected]>
+
+        Make accessibility/aria-hidden-false-works-in-subtrees.html async to pass in isolated tree mode.
+        https://bugs.webkit.org/show_bug.cgi?id=237051
+        <rdar://problem/89312156>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-hidden-false-works-in-subtrees.html:
+        Made both the main script and the iframe onload function async to pass
+        in isolated tree mode.
+
 2022-03-01  Matteo Flores  <[email protected]>
 
         [ Monterey wk2 ] http/tests/media/video-webm-stall.html is a constant text failure

Modified: trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html (290672 => 290673)


--- trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html	2022-03-01 21:28:07 UTC (rev 290672)
+++ trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html	2022-03-01 21:44:24 UTC (rev 290673)
@@ -1,12 +1,12 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
+<script src=""
 <script src=""
 </head>
-<body id="body">
+<body>
 
-<div id="content">
+<div id="content" role="group">
 
 <div hidden aria-hidden="false" aria-label="group0">
    <div aria-hidden="true" aria-label="group1">
@@ -59,24 +59,24 @@
 
 </div>
 
-<p id="description"></p>
-<div id="console"></div>
-
 <script>
     description("This tests that a sub-tree within a node marked with aria-hidden=false will be exposed in the AX tree.");
 
-    var iframeChild;
     function testiFrameContent() {
-        // Test that aria-hidden=false does NOT expose iframe fallback text.
-        var iframe = accessibilityController.accessibleElementById("iframe").childAtIndex(0).childAtIndex(0);
+        setTimeout(async () => {
+            // Test that aria-hidden=false does NOT expose iframe fallback text.
+            let iframe = accessibilityController.accessibleElementById("iframe").childAtIndex(0).childAtIndex(0);
 
-        debug("Non-rendered iframe content should not be visible when aria-hidden=true. The first child should be a group and NOT static text.");
-        iframeChild = iframe.childAtIndex(0);
-        debug("iFrame child role: " + iframeChild.role);
+            debug("Non-rendered iframe content should not be visible when aria-hidden=true. The first child should be a group and NOT static text.");
+            let iframeChild = null;
+            await waitFor(() => {
+                return iframeChild = iframe.childAtIndex(0);
+            });
+            debug("iFrame child role: " + iframeChild.role);
 
-        document.getElementById("content").style.visibility = "hidden";
-
-        finishJSTest();
+            document.getElementById("content").style.visibility = "hidden";
+            finishJSTest();
+        }, 0);
     }
 
     function dumpAccessibilityChildren(element, level) {
@@ -91,63 +91,62 @@
             dumpAccessibilityChildren(element.childAtIndex(k), level+1);
         }
     }
- 
+
     if (window.accessibilityController) {
         window.jsTestIsAsync = true;
 
-        var root = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0); 
-        dumpAccessibilityChildren(root, 0);
+        setTimeout(async () => {
+            let root = accessibilityController.accessibleElementById("content").childAtIndex(0);
+            dumpAccessibilityChildren(root, 0);
 
-        // Text inside aria-hidden=false inherits from parent.
-        var object;
-        if (accessibilityController.platformName == "atspi") {
-            object = accessibilityController.accessibleElementById("group3");
-            shouldBe("object.role", "'AXRole: AXSection'");
-        } else {
-            object = accessibilityController.accessibleElementById("group3").childAtIndex(0);
-            shouldBe("object.role", "'AXRole: AXStaticText'");
-        }
-        var stringValue = object.stringValue.replace(/\n/g, '');
-        shouldBe("stringValue", "'AXValue: text3'");
+            // Text inside aria-hidden=false inherits from parent.
+            window.object = null;
+            if (accessibilityController.platformName == "atspi") {
+                object = accessibilityController.accessibleElementById("group3");
+                shouldBe("object.role", "'AXRole: AXSection'");
+            } else {
+                object = accessibilityController.accessibleElementById("group3").childAtIndex(0);
+                shouldBe("object.role", "'AXRole: AXStaticText'");
+            }
+            window.stringValue = object.stringValue.replace(/\n/g, '');
+            shouldBe("stringValue", "'AXValue: text3'");
 
-        // Text inside nested aria-hidden=false inherits from parent.
-        if (accessibilityController.platformName == "atspi") {
-            object = accessibilityController.accessibleElementById("group4").childAtIndex(0);
-            shouldBe("object.role", "'AXRole: AXGroup'");
-        } else {
-            object = accessibilityController.accessibleElementById("group4").childAtIndex(0).childAtIndex(0);
-            shouldBe("object.role", "'AXRole: AXStaticText'");
-        }
-        stringValue = object.stringValue.replace(/\n/g, '');
-        if (accessibilityController.platformName == "atspi")
-            shouldBe("stringValue", "'AXValue: text4'");
-        else
-            shouldBe("stringValue", "'AXValue:     text4  '");
+            // Text inside nested aria-hidden=false inherits from parent.
+            if (accessibilityController.platformName == "atspi") {
+                object = accessibilityController.accessibleElementById("group4").childAtIndex(0);
+                shouldBe("object.role", "'AXRole: AXGroup'");
+            } else {
+                object = accessibilityController.accessibleElementById("group4").childAtIndex(0).childAtIndex(0);
+                shouldBe("object.role", "'AXRole: AXStaticText'");
+            }
+            stringValue = object.stringValue.replace(/\n/g, '');
+            if (accessibilityController.platformName == "atspi")
+                shouldBe("stringValue", "'AXValue: text4'");
+            else
+                shouldBe("stringValue", "'AXValue:     text4  '");
 
-        // When not all the parents have aria-hidden=false, element should not be visible.
-        object = accessibilityController.accessibleElementById("group5").childAtIndex(0);
-        shouldBeTrue("!object || !object.isValid");
+            // When not all the parents have aria-hidden=false, element should not be visible.
+            object = accessibilityController.accessibleElementById("group5").childAtIndex(0);
+            shouldBeTrue("!object || !object.isValid");
 
-        // Objects that don't have aria-hidden=false are not visible when the parents have that attribute.
-        object = accessibilityController.accessibleElementById("group6").childAtIndex(0);
-        if (accessibilityController.platformName == "atspi")
-            shouldBe("object.role", "'AXRole: AXSection'");
-        else
-            shouldBe("object.role", "'AXRole: AXGroup'");
-        shouldBe("object.childrenCount", "0");
+            // Objects that don't have aria-hidden=false are not visible when the parents have that attribute.
+            object = accessibilityController.accessibleElementById("group6").childAtIndex(0);
+            if (accessibilityController.platformName == "atspi")
+                shouldBe("object.role", "'AXRole: AXSection'");
+            else
+                shouldBe("object.role", "'AXRole: AXGroup'");
+            shouldBe("object.childrenCount", "0");
 
-        // When all objects have aria-hidden=false, then the elements are visible.
-        object = accessibilityController.accessibleElementById("group7").childAtIndex(0);
-        if (accessibilityController.platformName == "atspi")
-            shouldBe("object.role", "'AXRole: AXSection'");
-        else
-            shouldBe("object.role", "'AXRole: AXGroup'");
-        shouldBe("object.childrenCount", "1");
-        shouldBe("object.childAtIndex(0).role", "'AXRole: AXButton'");
+            // When all objects have aria-hidden=false, then the elements are visible.
+            object = accessibilityController.accessibleElementById("group7").childAtIndex(0);
+            if (accessibilityController.platformName == "atspi")
+                shouldBe("object.role", "'AXRole: AXSection'");
+            else
+                shouldBe("object.role", "'AXRole: AXGroup'");
+            shouldBe("object.childrenCount", "1");
+            shouldBe("object.childAtIndex(0).role", "'AXRole: AXButton'");
+        }, 0);
     }
-
 </script>
-
-<script src=""
 </body>
 </html>

Modified: trunk/Tools/ChangeLog (290672 => 290673)


--- trunk/Tools/ChangeLog	2022-03-01 21:28:07 UTC (rev 290672)
+++ trunk/Tools/ChangeLog	2022-03-01 21:44:24 UTC (rev 290673)
@@ -1,3 +1,17 @@
+2022-03-01  Andres Gonzalez  <[email protected]>
+
+        Make accessibility/aria-hidden-false-works-in-subtrees.html async to pass in isolated tree mode.
+        https://bugs.webkit.org/show_bug.cgi?id=237051
+        <rdar://problem/89312156>
+
+        Reviewed by Chris Fleizach.
+
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
+        (WTR::AccessibilityController::accessibleElementById):
+        Convert the JSStringRef to NSString on the main thread and capture the
+        NSString to be used on the AX secondary thread. This may be safer since
+        JSStringRefs are supposed to be used on the main thread.
+
 2022-03-01  Jonathan Bedard  <[email protected]>
 
         [git-webkit] Gate information URL on initial setup

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm (290672 => 290673)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm	2022-03-01 21:28:07 UTC (rev 290672)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm	2022-03-01 21:44:24 UTC (rev 290673)
@@ -114,9 +114,10 @@
     auto page = InjectedBundle::singleton().page()->page();
     PlatformUIElement root = static_cast<PlatformUIElement>(WKAccessibilityRootObject(page));
 
+    NSString *attributeName = [NSString stringWithJSStringRef:idAttribute];
     RetainPtr<id> result;
-    executeOnAXThreadAndWait([&root, &idAttribute, &result] {
-        result = findAccessibleObjectById(root, [NSString stringWithJSStringRef:idAttribute]);
+    executeOnAXThreadAndWait([&root, &attributeName, &result] {
+        result = findAccessibleObjectById(root, attributeName);
     });
 
     if (result)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to