Closed Bug 268054 Opened 20 years ago Closed 19 years ago

getAccessibleFor throws NS_ERROR_FAILURE for link nodes

Categories

(Firefox :: Disability Access, defect, P2)

1.0 Branch
x86
Linux
defect

Tracking

()

RESOLVED EXPIRED

People

(Reporter: sabetts, Assigned: aaronlev)

Details

(Keywords: access)

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

<html>
<body>
Some text <a id="myid" href="http://mozilla.org">Motz</a>.
<script>
try{
    var acc = Components.classes["@mozilla.org/accessibilityService;1"]
	.createInstance(Components.interfaces.nsIAccessibleRetrieval);
    var node = document.getElementById("myid");
    var box = acc.getAccessibleFor(node);
    var sx = {};
    var sy = {};
    var sh = {};
    var sw = {};
    box.getBounds(sx,sy,sw,sh);
    document.write("x: " + sx.value + " y: " + sy.value);
} catch(e) {document.write(e);}
</script>
</body>
</html>


The above web page (load it as chrome) produces an NS_ERROR_FAILURE in firefox
1.0RC2 but not with Mozilla 1.7.3
(http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.3/mozilla-i686-pc-linux-gnu-1.7.3-full-installer.tar.gz).

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
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
mozilla/accessible/src/base/nsAccessibilityService.cpp.

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
Priority: -- → P2
This is defined by ATK. http://developer.gnome.org/doc/API/2.0/atk/index.html

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,
(http://lxr.mozilla.org/seamonkey/source/accessible/public/atk/nsIAccessibleHyperText.idl),
then you can usr getLink method to get the accessible object for the link.
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 

frame->GetAccessible(getter_AddRefs(newAcc));

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

NS_IMETHODIMP
nsFrame::GetAccessible(nsIAccessible** aAccessible)
{
  return NS_ERROR_NOT_IMPLEMENTED;
}

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

-Shawn
nsFrame is not the place where we implemented GetAccessible, see
http://lxr.mozilla.org/seamonkey/ident?i=GetAccessible
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.
http://lxr.mozilla.org/seamonkey/source/accessible/src/atk/nsHTMLBlockAccessible.h#45
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:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
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.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.