Bug 137867

Summary: AX: [ATK] Do not return ATK_ROLE_UNKNOWN for null or otherwise invalid accessible objects
Product: WebKit Reporter: Joanmarie Diggs <jdiggs>
Component: AccessibilityAssignee: Joanmarie Diggs <jdiggs>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, apinheiro, cfleizach, cgarcia, commit-queue, dmazzoni, jcraig, mario, samuel_white
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: Linux   
Attachments:
Description Flags
Patch
none
Patch none

Description Joanmarie Diggs 2014-10-19 15:11:18 PDT
Currently in webkitAccessibleGetRole() we have:

    g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), ATK_ROLE_UNKNOWN);
    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), ATK_ROLE_UNKNOWN);

and:

    if (!coreObject)
        return ATK_ROLE_UNKNOWN;

ATK_ROLE_UNKNOWN suggests that there is a valid accessible object but the platform role mapping for that object is unknown. It is an indication of a WebKit bug (there should be a valid mapping). But it is also an indication to assistive technologies that there might be some obtainable useful information associated with this mystery object. As such assitive technologies might choose to poke at the object further. In contrast, if the object is null or otherwise invalid, there is arguably no obtainable useful information and thus ATs should not bother trying. We can distinguish these two conditions by exposing the latter as ATK_ROLE_INVALID.
Comment 1 Joanmarie Diggs 2014-10-19 15:15:33 PDT
Created attachment 240090 [details]
Patch
Comment 2 Joanmarie Diggs 2014-10-19 15:17:55 PDT
(In reply to comment #1)
> Created attachment 240090 [details]
> Patch

This is a WIP (hence not asking for review yet). Fixing the bug is simple enough; coming up with a test case is harder because we shouldn't be exposing accessible objects that have ROLE_UNKNOWN or ROLE_INVALID to assistive technologies in the first place. But I haven't given up quite yet. :)
Comment 3 Radar WebKit Bug Importer 2014-10-27 11:03:21 PDT
<rdar://problem/18782947>
Comment 4 Joanmarie Diggs 2014-11-13 12:41:51 PST
Created attachment 241496 [details]
Patch
Comment 5 Joanmarie Diggs 2014-11-13 13:14:25 PST
Mario or Chris: The patch is trivial. And there is a test now. (I had forgotten about detached objects as a valid and easy means to test this.) So if either of you has time for a quick review, that would be awesome. Thanks!
Comment 6 Joanmarie Diggs 2014-11-13 13:30:21 PST
Comment on attachment 241496 [details]
Patch

Thanks Chris!
Comment 7 WebKit Commit Bot 2014-11-13 14:11:40 PST
Comment on attachment 241496 [details]
Patch

Clearing flags on attachment: 241496

Committed r176091: <http://trac.webkit.org/changeset/176091>
Comment 8 WebKit Commit Bot 2014-11-13 14:11:48 PST
All reviewed patches have been landed.  Closing bug.