getAccessibleFor throws NS_ERROR_FAILURE for link nodes




Disability Access
14 years ago
13 years ago


(Reporter: shawn betts, Assigned: Aaron Leventhal)



1.0 Branch

Firefox Tracking Flags

(Not tracked)




14 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041103 Firefox/1.0RC2
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041103 Firefox/1.0RC2

Some text <a id="myid" href="">Motz</a>.
    var acc = Components.classes[";1"]
    var node = document.getElementById("myid");
    var box = acc.getAccessibleFor(node);
    var sx = {};
    var sy = {};
    var sh = {};
    var sw = {};
    document.write("x: " + sx.value + " y: " + sy.value);
} catch(e) {document.write(e);}

The above web page (load it as chrome) produces an NS_ERROR_FAILURE in firefox
1.0RC2 but not with Mozilla 1.7.3

After this error occurs in firefox focus problems start semi-randomly appearing
and some widgets disappear. I haven't been able to reproduce this part reliably.

Reproducible: Always
Steps to Reproduce:
1. save the html page I posted in details into the chrome (I installed it as
part of an XPI package, conkeror)
2. view the page: fire chrome://conkeror/content/bad.html

Actual Results:  
The NS_ERROR_FAILURE error is printed in the document instead of the x,y
location of the link.

Expected Results:  
The x,y location should be printed. This is what happens in Mozilla 1.7.3

Comment 1

14 years ago
After looking into it further, it seems the reason it's failing because of the
#ifndef MOZ_ACCESSIBILITY_ATK block in the nsAccessibilityService::GetAccessible
                                               function in

I commented #ifndef line and the function no longer fails for links. I'm not
sure what MOZ_ACCESSIBILITY_ATK is for or why links or #ifndef'd out so I don't
know if that's the Right solution.
Version: unspecified → 1.0 Branch


14 years ago
Priority: -- → P2

Comment 2

14 years ago
This is defined by ATK.

In ATK, hyperlink is not a standalone object type, it must inside a AtkHyperText
object. So if you call acc.getAccessibleFor(node) for a link, you supposed to
get a AtkHyperText object,
then you can usr getLink method to get the accessible object for the link.

Comment 3

14 years ago
Thanks for the comments Kyle.

In nsAccessibilityService::GetAccessibleFor(...) There are 6 blocks
that attempt to return the proper accessible object for the node:

1. Check the cache
2. Check if it's an AccessibleProvider
3. Check if it's an area node
4. Try using frame to get nsIAccessible
5. Check if it's an Option element
6. Check if it's an Option Group element

If we're trying to get an accessible for a link (which we are) then:

* 1 is out, since it's got to get in the cache via 2-6
* 2, 3, 5, and 6 are out.

That leaves 4.

In the source, the call is 


It ends up calling nsFrame::GetAccessible(...) in mozilla/layout/html/base/src/:

nsFrame::GetAccessible(nsIAccessible** aAccessible)

grepping the accessibility directory, I don't find any instantiation
of a nsAccessibleHyperText object. Is that bad?


Comment 4

14 years ago
nsFrame is not the place where we implemented GetAccessible, see
We implement them in the derived classes.

nsAccessibleHyperText is one of the parent classses of nsHTMLBlockAccessible.
Whenever you get a nsHTMLBlockAccessible, you will also get a nsAccessibleHyperText.


13 years ago
Keywords: access
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Last Resolved: 13 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.