Bug 1112746 - some internal object checks are missed in xpcom wrapper, r=yzen

This commit is contained in:
Alexander Surkov 2014-12-22 13:54:28 -05:00
parent bdbf7ac91f
commit aff0bd2bcb

View File

@ -23,6 +23,7 @@ NS_IMETHODIMP
xpcAccessible::GetParent(nsIAccessible** aParent)
{
NS_ENSURE_ARG_POINTER(aParent);
*aParent = nullptr;
if (!Intl())
return NS_ERROR_FAILURE;
@ -146,6 +147,10 @@ NS_IMETHODIMP
xpcAccessible::GetIndexInParent(int32_t* aIndexInParent)
{
NS_ENSURE_ARG_POINTER(aIndexInParent);
*aIndexInParent = -1;
if (!Intl())
return NS_ERROR_FAILURE;
*aIndexInParent = Intl()->IndexInParent();
return *aIndexInParent != -1 ? NS_OK : NS_ERROR_FAILURE;
@ -157,6 +162,9 @@ xpcAccessible::GetDOMNode(nsIDOMNode** aDOMNode)
NS_ENSURE_ARG_POINTER(aDOMNode);
*aDOMNode = nullptr;
if (!Intl())
return NS_ERROR_FAILURE;
nsINode* node = Intl()->GetNode();
if (node)
CallQueryInterface(node, aDOMNode);
@ -168,6 +176,10 @@ NS_IMETHODIMP
xpcAccessible::GetDocument(nsIAccessibleDocument** aDocument)
{
NS_ENSURE_ARG_POINTER(aDocument);
*aDocument = nullptr;
if (!Intl())
return NS_ERROR_FAILURE;
NS_IF_ADDREF(*aDocument = ToXPCDocument(Intl()->Document()));
return NS_OK;
@ -177,6 +189,10 @@ NS_IMETHODIMP
xpcAccessible::GetRootDocument(nsIAccessibleDocument** aRootDocument)
{
NS_ENSURE_ARG_POINTER(aRootDocument);
*aRootDocument = nullptr;
if (!Intl())
return NS_ERROR_FAILURE;
NS_IF_ADDREF(*aRootDocument = ToXPCDocument(Intl()->RootAccessible()));
return NS_OK;
@ -199,7 +215,7 @@ NS_IMETHODIMP
xpcAccessible::GetState(uint32_t* aState, uint32_t* aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
if (!Intl())
nsAccUtils::To32States(states::DEFUNCT, aState, aExtraState);
else