Bug 394117. Warnings when accessible relations queryied. r=surkov, a=dsicore
--- a/accessible/public/nsIAccessibleRelation.idl
+++ b/accessible/public/nsIAccessibleRelation.idl
@@ -52,16 +52,19 @@ interface nsIAccessibleRelation : nsISup
const unsigned long RELATION_NUL = 0x00;
/**
* Some attribute of this object is affected by a target object.
*/
const unsigned long RELATION_CONTROLLED_BY = 0x01;
+ // First relation
+ const unsigned long RELATION_FIRST = RELATION_CONTROLLED_BY;
+
/**
* This object is interactive and controls some attribute of a target object.
*/
const unsigned long RELATION_CONTROLLER_FOR = 0x02;
/**
* This object is label for a target object.
*/
@@ -130,16 +133,19 @@ interface nsIAccessibleRelation : nsISup
*/
const unsigned long RELATION_DESCRIBED_BY = 0x0e;
/**
* This object is describes the target object.
*/
const unsigned long RELATION_DESCRIPTION_FOR = 0x0f;
+ // Last relation that is standard to desktop accessibility APIs
+ const unsigned long RELATION_LAST = RELATION_DESCRIPTION_FOR;
+
/**
* Part of a form/dialog with a related default button. It is used for
* MSAA only, no for IA2 nor ATK.
*/
const unsigned long RELATION_DEFAULT_BUTTON = 0x4000;
/**
* Returns the type of the relation.
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -2781,21 +2781,21 @@ nsAccessible::GetRelation(PRUint32 aInde
NS_IMETHODIMP
nsAccessible::GetRelations(nsIArray **aRelations)
{
NS_ENSURE_ARG_POINTER(aRelations);
nsCOMPtr<nsIMutableArray> relations = do_CreateInstance(NS_ARRAY_CONTRACTID);
NS_ENSURE_TRUE(relations, NS_ERROR_OUT_OF_MEMORY);
- // Latest nsIAccessibleRelation is RELATION_DESCRIPTION_FOR (0xof)
- for (PRUint32 relType = 0; relType < 0x0f; ++relType) {
+ for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
+ relType < nsIAccessibleRelation::RELATION_LAST;
+ ++relType) {
nsCOMPtr<nsIAccessible> accessible;
- nsresult rv = GetAccessibleRelated(relType, getter_AddRefs(accessible));
- NS_ENSURE_SUCCESS(rv, rv);
+ GetAccessibleRelated(relType, getter_AddRefs(accessible));
if (accessible) {
nsCOMPtr<nsIAccessibleRelation> relation =
new nsAccessibleRelationWrap(relType, accessible);
NS_ENSURE_TRUE(relation, NS_ERROR_OUT_OF_MEMORY);
relations->AppendElement(relation, PR_FALSE);
}