Closed Bug 124234 Opened 23 years ago Closed 22 years ago

Active Accessibility: nsHTMLButtonAccessible::accDoAction does not work

Categories

(SeaMonkey :: General, defect, P2)

x86
Windows NT
defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla1.0

People

(Reporter: dsirnapalli, Assigned: aaronlev)

References

Details

(Keywords: access, topembed+)

Attachments

(1 file, 1 obsolete file)

Below is the simple test case.
------------------------------------
<html>
<head>

<script type="text/javascript">

function getAccessibleNode(startNode)
{
  var accessibleService = null;
  var accessibleNode = null;
  try{
   netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

   accessibleService = Components.classes
["@mozilla.org/accessibilityService;1"].createInstance();
   accessibleService = accessibleService.QueryInterface
(Components.interfaces.nsIAccessibilityService);
  }
  catch(e){
   alert("Error getting accessibility service");
  }

  try{
   netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

   accessibleNode = accessibleService.getAccessibleFor(startNode);

   return accessibleNode;
  }
  catch(e){
   return "Exception";
  }
}

function executeTestCase()
{
 try{
  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

  var node = document.getElementsByTagName("button").item(0);
  accNode = getAccessibleNode(node);

  alert("accNumActions: " + accNode.accNumActions);
  alert("getAccActionName: " + accNode.getAccActionName(0));
  action = doAction();
  alert("accDoAction:" + action);
 }
 catch(e){
  alert("Exception: " + e);
 }
}

function doAction()
{
  try{
   accNode.accDoAction(0);
  }
  catch(e){
   return e;
  }
}

function clicked()
{
 alert("Submit button pressed");
}

</script>
</head>
<body>
<script type="text/javascript">
<!-- Test Button -->
document.write('<br>');
document.write('<b>Testing Button for Accessibility..</b><br><br>');
document.write('<button value="submit" onClick="clicked();"> Submit </button>');
setTimeout("executeTestCase();", 2000);
</script>
</body>
</html>
------------------------------------------
-- When you run the above test case. the first alert you get will show how many 
numactions are there. here it is 1. next alert will show the actionname for 
numaction zero. The next alert will show the exception returned when 
accDoAction is called. if the function was successful alert "Submit button 
pressed" would have been displayed.

The error displayed is.
accDoAction:[Exception... "Component returned failure code: 0x80004005 (NS_ERROR
_FAILURE) [nsIAccessible.accDoAction]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)
"  location: "JS frame :: file:///C:/Netscape/Accessibility/testcase.html :: doA
ction :: line 56"  data: no]
Status: NEW → ASSIGNED
Keywords: access, fcc508, nsbeta1
Priority: -- → P2
Target Milestone: --- → mozilla1.0
-> John
Assignee: aaronl → jgaunt
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
changing summary so it fits better in the list ( we should come up with
somehting shorter than Active Accessibility for the lead on the summary )
Summary: Active Accessibility: nsIAccessible's accDoAction does not work for Html Button Node → Active Accessibility: nsHTMLButtonAccessible::accDoAction does not work
Keywords: topembed
Blocks: 75785
Keywords: topembedtopembed+
nsbeta1+ per ADT triage team, adding dep on XBL Form Controls bug 57209
Depends on: 57209
Keywords: nsbeta1nsbeta1+
Severity: major → blocker
QA Contact: doronr → dsirnapalli
Blocks: 135206
Fix in hand.

We were trying to QI an HTML 4 <button> to nsIDOMHTMLInputElement, and we got null.

The fix adds a Click() method to nsIDOMNSHTMLButtonElement(), and uses that
interface instead.
ready to attach patch
Assignee: jgaunt → aaronl
Status: ASSIGNED → NEW
Comment on attachment 77510 [details] [diff] [review]
Uses nsIDOMNSHTMLButtonElement::Click() now

You'll need to add re-entrancy protection to nsHTMLButtonElement::Click(), see
nsHTMLInputElement::Click().
Attachment #77510 - Flags: needs-work+
Attachment #77510 - Attachment is obsolete: true
Comment on attachment 77531 [details] [diff] [review]
Protects against reentrency using PRBool mHandlingClick

- In nsHTMLButtonElement::Click():

+  GetDocument(*getter_AddRefs(doc));
+
+  if (doc) {
...
+  }
+  return NS_ERROR_FAILURE;

Make this return NS_OK, calling click() on a button that's not in the tree
should not throw an exception.

sr=jst with that change.
Attachment #77531 - Flags: superreview+
Change made to return NS_OK.
Won't attach new patch unless requested.
Comment on attachment 77531 [details] [diff] [review]
Protects against reentrency using PRBool mHandlingClick

r=jkeiser, but could you indulge my thread paranoia and put the mHandlingClick
= PR_TRUE; mHandlingClick = PR_FALSE; pair at the beginning and end of the
function?
Attachment #77531 - Flags: review+
Keywords: adt1.0.0
What bug does the user see?  There's a dependency on XBL form controls but we
won't be turning them on for Mach V, so is this bug fix still needed?
Comment on attachment 77531 [details] [diff] [review]
Protects against reentrency using PRBool mHandlingClick

a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #77531 - Flags: approval+
The dependancy was bogus. This fix is necessary so that screen readers can work
with our software.
No longer depends on: 57209
adt1.0.0+ (on ADT's behalf) approval for checkin into 1.0.
Keywords: adt1.0.0adt1.0.0+
fixed in trunk.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
-- Verified in current mozilla nightly build. The fix works fine. Marking the
bug as verified.
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: