⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 290673 in webkit


Ignore:
Timestamp:
Mar 1, 2022, 1:44:24 PM (5 years ago)
Author:
Andres Gonzalez
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.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r290670 r290673  
     12022-03-01  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Make accessibility/aria-hidden-false-works-in-subtrees.html async to pass in isolated tree mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=237051
     5        <rdar://problem/89312156>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        * accessibility/aria-hidden-false-works-in-subtrees.html:
     10        Made both the main script and the iframe onload function async to pass
     11        in isolated tree mode.
     12
    1132022-03-01  Matteo Flores  <matteo_flores@apple.com>
    214
  • trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html

    r289028 r290673  
    22<html>
    33<head>
    4 <script src="../resources/js-test-pre.js"></script>
     4<script src="../resources/js-test.js"></script>
    55<script src="../resources/accessibility-helper.js"></script>
    66</head>
    7 <body id="body">
     7<body>
    88
    9 <div id="content">
     9<div id="content" role="group">
    1010
    1111<div hidden aria-hidden="false" aria-label="group0">
    … …  
    6060</div>
    6161
    62 <p id="description"></p>
    63 <div id="console"></div>
    64 
    6562<script>
    6663    description("This tests that a sub-tree within a node marked with aria-hidden=false will be exposed in the AX tree.");
    6764
    68     var iframeChild;
    6965    function testiFrameContent() {
    70         // Test that aria-hidden=false does NOT expose iframe fallback text.
    71         var iframe = accessibilityController.accessibleElementById("iframe").childAtIndex(0).childAtIndex(0);
     66        setTimeout(async () => {
     67            // Test that aria-hidden=false does NOT expose iframe fallback text.
     68            let iframe = accessibilityController.accessibleElementById("iframe").childAtIndex(0).childAtIndex(0);
    7269
    73         debug("Non-rendered iframe content should not be visible when aria-hidden=true. The first child should be a group and NOT static text.");
    74         iframeChild = iframe.childAtIndex(0);
    75         debug("iFrame child role: " + iframeChild.role);
     70            debug("Non-rendered iframe content should not be visible when aria-hidden=true. The first child should be a group and NOT static text.");
     71            let iframeChild = null;
     72            await waitFor(() => {
     73                return iframeChild = iframe.childAtIndex(0);
     74            });
     75            debug("iFrame child role: " + iframeChild.role);
    7676
    77         document.getElementById("content").style.visibility = "hidden";
    78 
    79         finishJSTest();
     77            document.getElementById("content").style.visibility = "hidden";
     78            finishJSTest();
     79        }, 0);
    8080    }
    8181
    … …  
    9292        }
    9393    }
    94  
     94
    9595    if (window.accessibilityController) {
    9696        window.jsTestIsAsync = true;
    9797
    98         var root = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
    99         dumpAccessibilityChildren(root, 0);
     98        setTimeout(async () => {
     99            let root = accessibilityController.accessibleElementById("content").childAtIndex(0);
     100            dumpAccessibilityChildren(root, 0);
    100101
    101         // Text inside aria-hidden=false inherits from parent.
    102         var object;
    103         if (accessibilityController.platformName == "atspi") {
    104             object = accessibilityController.accessibleElementById("group3");
    105             shouldBe("object.role", "'AXRole: AXSection'");
    106         } else {
    107             object = accessibilityController.accessibleElementById("group3").childAtIndex(0);
    108             shouldBe("object.role", "'AXRole: AXStaticText'");
    109         }
    110         var stringValue = object.stringValue.replace(/\n/g, '');
    111         shouldBe("stringValue", "'AXValue: text3'");
     102            // Text inside aria-hidden=false inherits from parent.
     103            window.object = null;
     104            if (accessibilityController.platformName == "atspi") {
     105                object = accessibilityController.accessibleElementById("group3");
     106                shouldBe("object.role", "'AXRole: AXSection'");
     107            } else {
     108                object = accessibilityController.accessibleElementById("group3").childAtIndex(0);
     109                shouldBe("object.role", "'AXRole: AXStaticText'");
     110            }
     111            window.stringValue = object.stringValue.replace(/\n/g, '');
     112            shouldBe("stringValue", "'AXValue: text3'");
    112113
    113         // Text inside nested aria-hidden=false inherits from parent.
    114         if (accessibilityController.platformName == "atspi") {
    115             object = accessibilityController.accessibleElementById("group4").childAtIndex(0);
    116             shouldBe("object.role", "'AXRole: AXGroup'");
    117         } else {
    118             object = accessibilityController.accessibleElementById("group4").childAtIndex(0).childAtIndex(0);
    119             shouldBe("object.role", "'AXRole: AXStaticText'");
    120         }
    121         stringValue = object.stringValue.replace(/\n/g, '');
    122         if (accessibilityController.platformName == "atspi")
    123             shouldBe("stringValue", "'AXValue: text4'");
    124         else
    125             shouldBe("stringValue", "'AXValue:     text4  '");
     114            // Text inside nested aria-hidden=false inherits from parent.
     115            if (accessibilityController.platformName == "atspi") {
     116                object = accessibilityController.accessibleElementById("group4").childAtIndex(0);
     117                shouldBe("object.role", "'AXRole: AXGroup'");
     118            } else {
     119                object = accessibilityController.accessibleElementById("group4").childAtIndex(0).childAtIndex(0);
     120                shouldBe("object.role", "'AXRole: AXStaticText'");
     121            }
     122            stringValue = object.stringValue.replace(/\n/g, '');
     123            if (accessibilityController.platformName == "atspi")
     124                shouldBe("stringValue", "'AXValue: text4'");
     125            else
     126                shouldBe("stringValue", "'AXValue:     text4  '");
    126127
    127         // When not all the parents have aria-hidden=false, element should not be visible.
    128         object = accessibilityController.accessibleElementById("group5").childAtIndex(0);
    129         shouldBeTrue("!object || !object.isValid");
     128            // When not all the parents have aria-hidden=false, element should not be visible.
     129            object = accessibilityController.accessibleElementById("group5").childAtIndex(0);
     130            shouldBeTrue("!object || !object.isValid");
    130131
    131         // Objects that don't have aria-hidden=false are not visible when the parents have that attribute.
    132         object = accessibilityController.accessibleElementById("group6").childAtIndex(0);
    133         if (accessibilityController.platformName == "atspi")
    134             shouldBe("object.role", "'AXRole: AXSection'");
    135         else
    136             shouldBe("object.role", "'AXRole: AXGroup'");
    137         shouldBe("object.childrenCount", "0");
     132            // Objects that don't have aria-hidden=false are not visible when the parents have that attribute.
     133            object = accessibilityController.accessibleElementById("group6").childAtIndex(0);
     134            if (accessibilityController.platformName == "atspi")
     135                shouldBe("object.role", "'AXRole: AXSection'");
     136            else
     137                shouldBe("object.role", "'AXRole: AXGroup'");
     138            shouldBe("object.childrenCount", "0");
    138139
    139         // When all objects have aria-hidden=false, then the elements are visible.
    140         object = accessibilityController.accessibleElementById("group7").childAtIndex(0);
    141         if (accessibilityController.platformName == "atspi")
    142             shouldBe("object.role", "'AXRole: AXSection'");
    143         else
    144             shouldBe("object.role", "'AXRole: AXGroup'");
    145         shouldBe("object.childrenCount", "1");
    146         shouldBe("object.childAtIndex(0).role", "'AXRole: AXButton'");
     140            // When all objects have aria-hidden=false, then the elements are visible.
     141            object = accessibilityController.accessibleElementById("group7").childAtIndex(0);
     142            if (accessibilityController.platformName == "atspi")
     143                shouldBe("object.role", "'AXRole: AXSection'");
     144            else
     145                shouldBe("object.role", "'AXRole: AXGroup'");
     146            shouldBe("object.childrenCount", "1");
     147            shouldBe("object.childAtIndex(0).role", "'AXRole: AXButton'");
     148        }, 0);
    147149    }
    148 
    149150</script>
    150 
    151 <script src="../resources/js-test-post.js"></script>
    152151</body>
    153152</html>
  • trunk/Tools/ChangeLog

    r290661 r290673  
     12022-03-01  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Make accessibility/aria-hidden-false-works-in-subtrees.html async to pass in isolated tree mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=237051
     5        <rdar://problem/89312156>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        * WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
     10        (WTR::AccessibilityController::accessibleElementById):
     11        Convert the JSStringRef to NSString on the main thread and capture the
     12        NSString to be used on the AX secondary thread. This may be safer since
     13        JSStringRefs are supposed to be used on the main thread.
     14
    1152022-03-01  Jonathan Bedard  <jbedard@apple.com>
    216
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm

    r284395 r290673  
    115115    PlatformUIElement root = static_cast<PlatformUIElement>(WKAccessibilityRootObject(page));
    116116
     117    NSString *attributeName = [NSString stringWithJSStringRef:idAttribute];
    117118    RetainPtr<id> result;
    118     executeOnAXThreadAndWait([&root, &idAttribute, &result] {
    119         result = findAccessibleObjectById(root, [NSString stringWithJSStringRef:idAttribute]);
     119    executeOnAXThreadAndWait([&root, &attributeName, &result] {
     120        result = findAccessibleObjectById(root, attributeName);
    120121    });
    121122
Note: See TracChangeset for help on using the changeset viewer.