Bug 109028

Summary: mac-wk2 test runner returns null for accessibilityController.accessibleElementById
Product: WebKit Reporter: James Craig <jcraig>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: CLOSED WORKSFORME    
Severity: Normal CC: cfleizach, jcraig
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description James Craig 2013-02-06 01:31:18 PST
mac-wk2 test runner returns null for accessibilityController.accessibleElementById

* REPRO
role-subrole-decription.html layout test runs as expected when run as webkit1.
  run-webkit-tests LayoutTests/platform/mac/accessibility/role-subrole-roledescription.html

  The test ran as expected. 

But when run as wk2 (run-layout-tests -2), it throws the following error:
$ run-webkit-tests -2 LayoutTests/platform/mac/accessibility/role-subrole-roledescription.html

  CONSOLE MESSAGE: line 299: TypeError: 'null' is not an object (evaluating 'axElement.role')
  FAIL successfullyParsed should be true (of type boolean). Was undefined (of type undefined).

It appears to me that accessibilityController.accessibleElementById is not returning the right value.

Note: the referenced layout test is in a patch for: http://webkit.org/b/109027
Comment 1 chris fleizach 2013-02-06 08:23:17 PST
I think your problem is that

PASS: div[role=rowgroup]
 923      AXRole: 
 924 

has no role, and in WK2, it returns a null object instead of an empty string
Comment 2 James Craig 2013-02-07 11:47:52 PST
Not quite. The axElement actually returns null, not just the properties on the object. Nevertheless, I can work around it like this to normalize the behavior between wk1 and wk2. 

        if (axElement) {
            role = axElement.role;
            subrole = axElement.subrole;
            roleDescription = axElement.roleDescription;
        } else {
            role = 'AXRole: ';
            subrole = 'AXSubrole: ';
            roleDescription = 'AXRoleDescription: ';
        }

If you think that's expected behavior, it's okay to close this bug.
Comment 3 chris fleizach 2013-02-07 11:50:31 PST
(In reply to comment #2)
> Not quite. The axElement actually returns null, not just the properties on the object. Nevertheless, I can work around it like this to normalize the behavior between wk1 and wk2. 
> 
>         if (axElement) {
>             role = axElement.role;
>             subrole = axElement.subrole;
>             roleDescription = axElement.roleDescription;
>         } else {
>             role = 'AXRole: ';
>             subrole = 'AXSubrole: ';
>             roleDescription = 'AXRoleDescription: ';
>         }
> 
> If you think that's expected behavior, it's okay to close this bug.

Ah yes, because this is not an AX element in the hierarchy. In WK1, you'll get an empty ax element, on WK2 you'll get a null element.

We could leave this out of the test

or do a check like
if (axElement && axElement.role)
Comment 4 James Craig 2013-02-07 11:55:58 PST
Closing