зеркало из https://github.com/mozilla/pjs.git
Bug 306750. Fix crashes in accessibility core based on talkback reports. r=parente, sr=bryner
This commit is contained in:
Родитель
cba3b38bf8
Коммит
b871ac8357
|
@ -399,6 +399,9 @@ void nsRootAccessible::TryFireEarlyLoadEvent(nsIAccessible *aAccessible, nsIDOMN
|
||||||
GetDocAccessibleFor(rootContentTreeItem);
|
GetDocAccessibleFor(rootContentTreeItem);
|
||||||
nsCOMPtr<nsIAccessible> rootContentAccessible =
|
nsCOMPtr<nsIAccessible> rootContentAccessible =
|
||||||
do_QueryInterface(rootContentDocAccessible);
|
do_QueryInterface(rootContentDocAccessible);
|
||||||
|
if (!rootContentAccessible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
PRUint32 state;
|
PRUint32 state;
|
||||||
rootContentAccessible->GetFinalState(&state);
|
rootContentAccessible->GetFinalState(&state);
|
||||||
if (state & STATE_BUSY) {
|
if (state & STATE_BUSY) {
|
||||||
|
|
|
@ -170,10 +170,11 @@ NS_IMETHODIMP nsHTMLButtonAccessible::DoAction(PRUint8 index)
|
||||||
|
|
||||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetState(PRUint32 *_retval)
|
NS_IMETHODIMP nsHTMLButtonAccessible::GetState(PRUint32 *_retval)
|
||||||
{
|
{
|
||||||
nsFormControlAccessible::GetState(_retval);
|
|
||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||||
NS_ASSERTION(element, "No nsIDOMElement for button node!");
|
if (!element) {
|
||||||
|
return NS_ERROR_FAILURE; // Button accessible shut down
|
||||||
|
}
|
||||||
|
nsFormControlAccessible::GetState(_retval);
|
||||||
nsAutoString buttonType;
|
nsAutoString buttonType;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
||||||
if (buttonType.LowerCaseEqualsLiteral("submit"))
|
if (buttonType.LowerCaseEqualsLiteral("submit"))
|
||||||
|
@ -274,12 +275,13 @@ NS_IMETHODIMP nsHTML4ButtonAccessible::GetRole(PRUint32 *_retval)
|
||||||
|
|
||||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetState(PRUint32 *_retval)
|
NS_IMETHODIMP nsHTML4ButtonAccessible::GetState(PRUint32 *_retval)
|
||||||
{
|
{
|
||||||
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||||
|
if (!element) {
|
||||||
|
return NS_ERROR_FAILURE; // Button accessible shut down
|
||||||
|
}
|
||||||
nsAccessible::GetState(_retval);
|
nsAccessible::GetState(_retval);
|
||||||
*_retval |= STATE_FOCUSABLE;
|
*_retval |= STATE_FOCUSABLE;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
|
||||||
NS_ASSERTION(element, "No nsIDOMElement for button node!");
|
|
||||||
|
|
||||||
nsAutoString buttonType;
|
nsAutoString buttonType;
|
||||||
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
||||||
if (buttonType.LowerCaseEqualsLiteral("submit"))
|
if (buttonType.LowerCaseEqualsLiteral("submit"))
|
||||||
|
|
|
@ -460,13 +460,6 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetRole(PRUint32 *aRole)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return our cached parent */
|
|
||||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetParent(nsIAccessible **aParent)
|
|
||||||
{
|
|
||||||
NS_IF_ADDREF(*aParent = mParent);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get our Name from our Content's subtree
|
* Get our Name from our Content's subtree
|
||||||
*/
|
*/
|
||||||
|
@ -602,7 +595,9 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
// Clear old selection
|
// Clear old selection
|
||||||
nsCOMPtr<nsIDOMNode> oldHTMLOptionNode, selectNode;
|
nsCOMPtr<nsIDOMNode> oldHTMLOptionNode, selectNode;
|
||||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(mParent));
|
nsCOMPtr<nsIAccessible> parent;
|
||||||
|
GetParent(getter_AddRefs(parent));
|
||||||
|
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(parent));
|
||||||
NS_ASSERTION(accessNode, "Unable to QI to nsIAccessNode");
|
NS_ASSERTION(accessNode, "Unable to QI to nsIAccessNode");
|
||||||
accessNode->GetDOMNode(getter_AddRefs(selectNode));
|
accessNode->GetDOMNode(getter_AddRefs(selectNode));
|
||||||
GetFocusedOptionNode(selectNode, getter_AddRefs(oldHTMLOptionNode));
|
GetFocusedOptionNode(selectNode, getter_AddRefs(oldHTMLOptionNode));
|
||||||
|
|
|
@ -157,7 +157,6 @@ public:
|
||||||
NS_IMETHOD GetNumActions(PRUint8 *_retval);
|
NS_IMETHOD GetNumActions(PRUint8 *_retval);
|
||||||
NS_IMETHOD GetState(PRUint32 *_retval);
|
NS_IMETHOD GetState(PRUint32 *_retval);
|
||||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
|
||||||
NS_IMETHOD GetName(nsAString& aName);
|
NS_IMETHOD GetName(nsAString& aName);
|
||||||
nsIFrame* GetBoundsFrame();
|
nsIFrame* GetBoundsFrame();
|
||||||
static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsIDOMNode **aFocusedOptionNode);
|
static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsIDOMNode **aFocusedOptionNode);
|
||||||
|
|
|
@ -909,6 +909,8 @@ nsAccessibleWrap::Next(ULONG aNumElementsRequested, VARIANT FAR* pvar, ULONG FAR
|
||||||
PRBool wasAccessibleFetched = PR_FALSE;
|
PRBool wasAccessibleFetched = PR_FALSE;
|
||||||
nsAccessibleWrap *msaaAccessible =
|
nsAccessibleWrap *msaaAccessible =
|
||||||
NS_STATIC_CAST(nsAccessibleWrap*, pvar[*aNumElementsFetched].pdispVal);
|
NS_STATIC_CAST(nsAccessibleWrap*, pvar[*aNumElementsFetched].pdispVal);
|
||||||
|
if (!msaaAccessible)
|
||||||
|
break;
|
||||||
if (childIndex >= mEnumVARIANTPosition) {
|
if (childIndex >= mEnumVARIANTPosition) {
|
||||||
if (++*aNumElementsFetched >= aNumElementsRequested)
|
if (++*aNumElementsFetched >= aNumElementsRequested)
|
||||||
break;
|
break;
|
||||||
|
@ -1003,7 +1005,7 @@ STDMETHODIMP nsAccessibleWrap::Invoke(DISPID dispIdMember, REFIID riid,
|
||||||
NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
|
NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
|
||||||
{
|
{
|
||||||
*aOutAccessible = NS_STATIC_CAST(IAccessible*, this);
|
*aOutAccessible = NS_STATIC_CAST(IAccessible*, this);
|
||||||
NS_STATIC_CAST(IAccessible*, this)->AddRef();
|
NS_ADDREF_THIS();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -239,6 +239,9 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent, nsIAccessib
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
childID = GetChildIDFor(aAccessible); // get the id for the accessible
|
childID = GetChildIDFor(aAccessible); // get the id for the accessible
|
||||||
|
if (!childID) {
|
||||||
|
return NS_OK; // Can't fire an event without a child ID
|
||||||
|
}
|
||||||
if (aAccessible != this) {
|
if (aAccessible != this) {
|
||||||
// See if we're in a scrollable area with its own window
|
// See if we're in a scrollable area with its own window
|
||||||
nsCOMPtr<nsIAccessible> accessible;
|
nsCOMPtr<nsIAccessible> accessible;
|
||||||
|
@ -278,6 +281,9 @@ PRInt32 nsDocAccessibleWrap::GetChildIDFor(nsIAccessible* aAccessible)
|
||||||
|
|
||||||
void *uniqueID;
|
void *uniqueID;
|
||||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible));
|
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible));
|
||||||
|
if (!accessNode) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
accessNode->GetUniqueID(&uniqueID);
|
accessNode->GetUniqueID(&uniqueID);
|
||||||
|
|
||||||
// Yes, this means we're only compatibible with 32 bit
|
// Yes, this means we're only compatibible with 32 bit
|
||||||
|
|
|
@ -98,9 +98,11 @@ NS_IMETHODIMP nsXULMenuitemAccessible::GetState(PRUint32 *_retval)
|
||||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||||
if (parentAccessible) {
|
if (parentAccessible) {
|
||||||
GetParent(getter_AddRefs(parentAccessible));
|
GetParent(getter_AddRefs(parentAccessible));
|
||||||
parentAccessible->GetFinalState(&parentState);
|
if (parentAccessible) {
|
||||||
*_retval &= ~STATE_OFFSCREEN; // clear the old OFFSCREEN bit
|
parentAccessible->GetFinalState(&parentState);
|
||||||
*_retval |= (parentState & STATE_OFFSCREEN); // or it with the parent's offscreen bit
|
*_retval &= ~STATE_OFFSCREEN; // clear the old OFFSCREEN bit
|
||||||
|
*_retval |= (parentState & STATE_OFFSCREEN); // or it with the parent's offscreen bit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче