зеркало из https://github.com/mozilla/pjs.git
Bug 421650 - dont allocate [out] BSTR*, r=aaronlev, a=dsicore
This commit is contained in:
Родитель
4813a215eb
Коммит
e095f9de94
|
@ -116,12 +116,14 @@ __try {
|
|||
if (NS_FAILED(acc->GetActionDescription(index, description)))
|
||||
return E_FAIL;
|
||||
|
||||
if (!description.IsVoid()) {
|
||||
INT result = ::SysReAllocStringLen(aDescription, description.get(),
|
||||
description.Length());
|
||||
if (!result)
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
if (description.IsVoid())
|
||||
return S_FALSE;
|
||||
|
||||
*aDescription = ::SysAllocStringLen(description.get(),
|
||||
description.Length());
|
||||
if (!*aDescription)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -156,17 +158,31 @@ __try {
|
|||
PRUint32 numBinding = length > maxBinding ? maxBinding : length;
|
||||
*aNumBinding = numBinding;
|
||||
|
||||
*aKeyBinding = new BSTR[numBinding];
|
||||
*aKeyBinding = static_cast<BSTR*>(nsMemory::Alloc((numBinding) * sizeof(BSTR*)));
|
||||
if (!*aKeyBinding)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
for (PRUint32 i = 0; i < numBinding; i++) {
|
||||
PRBool outOfMemory = PR_FALSE;
|
||||
PRUint32 i = 0;
|
||||
for (; i < numBinding; i++) {
|
||||
nsAutoString key;
|
||||
keys->Item(i, key);
|
||||
INT result = ::SysReAllocStringLen(aKeyBinding[i], key.get(),
|
||||
key.Length());
|
||||
if (!result)
|
||||
return E_OUTOFMEMORY;
|
||||
*(aKeyBinding[i]) = ::SysAllocStringLen(key.get(), key.Length());
|
||||
|
||||
if (!*(aKeyBinding[i])) {
|
||||
outOfMemory = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (outOfMemory) {
|
||||
for (PRUint32 j = 0; j < i; j++)
|
||||
::SysFreeString(*(aKeyBinding[j]));
|
||||
|
||||
nsMemory::Free(*aKeyBinding);
|
||||
*aKeyBinding = NULL;
|
||||
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
|
@ -177,6 +193,8 @@ STDMETHODIMP
|
|||
CAccessibleAction::get_name(long aActionIndex, BSTR *aName)
|
||||
{
|
||||
__try {
|
||||
*aName = NULL;
|
||||
|
||||
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
|
||||
if (!acc)
|
||||
return E_FAIL;
|
||||
|
@ -186,8 +204,11 @@ __try {
|
|||
if (NS_FAILED(acc->GetActionName(index, name)))
|
||||
return E_FAIL;
|
||||
|
||||
INT result = ::SysReAllocStringLen(aName, name.get(), name.Length());
|
||||
if (!result)
|
||||
if (name.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aName = ::SysAllocStringLen(name.get(), name.Length());
|
||||
if (!*aName)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
@ -198,7 +219,10 @@ __try {
|
|||
STDMETHODIMP
|
||||
CAccessibleAction::get_localizedName(long aActionIndex, BSTR *aLocalizedName)
|
||||
{
|
||||
::SysFreeString(*aLocalizedName);
|
||||
__try {
|
||||
*aLocalizedName = NULL;
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,8 +139,11 @@ __try {
|
|||
AppendUTF8toUTF16(path, stringURI);
|
||||
|
||||
aAnchorTarget->vt = VT_BSTR;
|
||||
if (!::SysReAllocStringLen(&aAnchorTarget->bstrVal, stringURI.get(), stringURI.Length()))
|
||||
aAnchorTarget->bstrVal = ::SysAllocStringLen(stringURI.get(),
|
||||
stringURI.Length());
|
||||
if (!aAnchorTarget->bstrVal)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -76,6 +76,8 @@ STDMETHODIMP
|
|||
CAccessibleImage::get_description(BSTR *aDescription)
|
||||
{
|
||||
__try {
|
||||
*aDescription = NULL;
|
||||
|
||||
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
|
||||
if (!acc)
|
||||
return E_FAIL;
|
||||
|
@ -85,8 +87,13 @@ __try {
|
|||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (!::SysReAllocStringLen(aDescription, description.get(), description.Length()))
|
||||
if (description.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aDescription = ::SysAllocStringLen(description.get(), description.Length());
|
||||
if (!*aDescription)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -160,6 +160,8 @@ STDMETHODIMP
|
|||
CAccessibleTable::get_columnDescription(long aColumn, BSTR *aDescription)
|
||||
{
|
||||
__try {
|
||||
*aDescription = NULL;
|
||||
|
||||
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
|
||||
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
|
||||
if (!tableAcc)
|
||||
|
@ -170,7 +172,11 @@ __try {
|
|||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (!::SysReAllocStringLen(aDescription, descr.get(), descr.Length()))
|
||||
if (descr.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aDescription = ::SysAllocStringLen(descr.get(), descr.Length());
|
||||
if (!*aDescription)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
@ -370,6 +376,8 @@ STDMETHODIMP
|
|||
CAccessibleTable::get_rowDescription(long aRow, BSTR *aDescription)
|
||||
{
|
||||
__try {
|
||||
*aDescription = NULL;
|
||||
|
||||
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
|
||||
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
|
||||
if (!tableAcc)
|
||||
|
@ -380,7 +388,11 @@ __try {
|
|||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (!::SysReAllocStringLen(aDescription, descr.get(), descr.Length()))
|
||||
if (descr.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aDescription = ::SysAllocStringLen(descr.get(), descr.Length());
|
||||
if (!*aDescription)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
|
|
@ -100,6 +100,8 @@ CAccessibleText::get_attributes(long aOffset, long *aStartOffset,
|
|||
long *aEndOffset, BSTR *aTextAttributes)
|
||||
{
|
||||
__try {
|
||||
*aTextAttributes = NULL;
|
||||
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
@ -237,6 +239,8 @@ STDMETHODIMP
|
|||
CAccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
|
||||
{
|
||||
__try {
|
||||
*aText = NULL;
|
||||
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsAutoString text;
|
||||
|
@ -244,8 +248,13 @@ __try {
|
|||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (!::SysReAllocStringLen(aText, text.get(), text.Length()))
|
||||
if (text.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aText = ::SysAllocStringLen(text.get(), text.Length());
|
||||
if (!*aText)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -258,6 +267,8 @@ CAccessibleText::get_textBeforeOffset(long aOffset,
|
|||
BSTR *aText)
|
||||
{
|
||||
__try {
|
||||
*aText = NULL;
|
||||
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -282,8 +293,13 @@ __try {
|
|||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
if (!::SysReAllocStringLen(aText, text.get(), text.Length()))
|
||||
if (text.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aText = ::SysAllocStringLen(text.get(), text.Length());
|
||||
if (!*aText)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -296,6 +312,8 @@ CAccessibleText::get_textAfterOffset(long aOffset,
|
|||
BSTR *aText)
|
||||
{
|
||||
__try {
|
||||
*aText = NULL;
|
||||
|
||||
GET_NSIACCESSIBLETEXT
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -320,8 +338,13 @@ __try {
|
|||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
if (!::SysReAllocStringLen(aText, text.get(), text.Length()))
|
||||
if (text.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aText = ::SysAllocStringLen(text.get(), text.Length());
|
||||
if (!*aText)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -358,8 +381,13 @@ __try {
|
|||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
if (!::SysReAllocStringLen(aText, text.get(), text.Length()))
|
||||
if (text.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aText = ::SysAllocStringLen(text.get(), text.Length());
|
||||
if (!*aText)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -497,8 +525,8 @@ CAccessibleText::GetModifiedText(PRBool aGetInsertedText,
|
|||
aText->start = startOffset;
|
||||
aText->end = endOffset;
|
||||
|
||||
INT result = ::SysReAllocStringLen(&(aText->text), text.get(), text.Length());
|
||||
return result ? NS_OK : E_OUTOFMEMORY;
|
||||
aText->text = ::SysAllocStringLen(text.get(), text.Length());
|
||||
return aText->text ? NS_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
nsAccessibleTextBoundary
|
||||
|
|
|
@ -531,7 +531,13 @@ __try {
|
|||
|
||||
nsAutoString innerHTML;
|
||||
domNSElement->GetInnerHTML(innerHTML);
|
||||
*aInnerHTML = ::SysAllocString(innerHTML.get());
|
||||
if (innerHTML.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aInnerHTML = ::SysAllocStringLen(innerHTML.get(), innerHTML.Length());
|
||||
if (!*aInnerHTML)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -541,13 +547,20 @@ STDMETHODIMP
|
|||
nsAccessNodeWrap::get_language(BSTR __RPC_FAR *aLanguage)
|
||||
{
|
||||
__try {
|
||||
*aLanguage = nsnull;
|
||||
*aLanguage = NULL;
|
||||
|
||||
nsAutoString language;
|
||||
if (NS_FAILED(GetLanguage(language))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
*aLanguage = ::SysAllocString(language.get());
|
||||
|
||||
if (language.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aLanguage = ::SysAllocStringLen(language.get(), language.Length());
|
||||
if (!*aLanguage)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -86,6 +86,8 @@ STDMETHODIMP
|
|||
nsAccessibleRelationWrap::get_relationType(BSTR *aRelationType)
|
||||
{
|
||||
__try {
|
||||
*aRelationType = NULL;
|
||||
|
||||
PRUint32 type = 0;
|
||||
nsresult rv = GetRelationType(&type);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -94,49 +96,49 @@ __try {
|
|||
INT res;
|
||||
switch (type) {
|
||||
case RELATION_CONTROLLED_BY:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_CONTROLLED_BY);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLED_BY);
|
||||
break;
|
||||
case RELATION_CONTROLLER_FOR:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_CONTROLLER_FOR);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLER_FOR);
|
||||
break;
|
||||
case RELATION_DESCRIBED_BY:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_DESCRIBED_BY);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_DESCRIBED_BY);
|
||||
break;
|
||||
case RELATION_DESCRIPTION_FOR:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_DESCRIPTION_FOR);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_DESCRIPTION_FOR);
|
||||
break;
|
||||
case RELATION_EMBEDDED_BY:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_EMBEDDED_BY);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_EMBEDDED_BY);
|
||||
break;
|
||||
case RELATION_EMBEDS:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_EMBEDS);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_EMBEDS);
|
||||
break;
|
||||
case RELATION_FLOWS_FROM:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_FLOWS_FROM);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_FROM);
|
||||
break;
|
||||
case RELATION_FLOWS_TO:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_FLOWS_TO);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_TO);
|
||||
break;
|
||||
case RELATION_LABEL_FOR:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_LABEL_FOR);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_LABEL_FOR);
|
||||
break;
|
||||
case RELATION_LABELLED_BY:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_LABELED_BY);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_LABELED_BY);
|
||||
break;
|
||||
case RELATION_MEMBER_OF:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_MEMBER_OF);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_MEMBER_OF);
|
||||
break;
|
||||
case RELATION_NODE_CHILD_OF:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_NODE_CHILD_OF);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_NODE_CHILD_OF);
|
||||
break;
|
||||
case RELATION_PARENT_WINDOW_OF:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_PARENT_WINDOW_OF);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_PARENT_WINDOW_OF);
|
||||
break;
|
||||
case RELATION_POPUP_FOR:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_POPUP_FOR);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_POPUP_FOR);
|
||||
break;
|
||||
case RELATION_SUBWINDOW_OF:
|
||||
res = ::SysReAllocString(aRelationType, IA2_RELATION_SUBWINDOW_OF);
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_SUBWINDOW_OF);
|
||||
break;
|
||||
default:
|
||||
return E_FAIL;
|
||||
|
|
|
@ -294,10 +294,15 @@ __try {
|
|||
if (xpAccessible) {
|
||||
nsAutoString name;
|
||||
if (NS_FAILED(xpAccessible->GetName(name)))
|
||||
return E_FAIL;
|
||||
|
||||
if (name.IsEmpty())
|
||||
return S_FALSE;
|
||||
if (!name.IsVoid()) {
|
||||
*pszName = ::SysAllocString(name.get());
|
||||
}
|
||||
|
||||
*pszName = ::SysAllocStringLen(name.get(), name.Length());
|
||||
if (!*pszName)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
#ifdef DEBUG_A11Y
|
||||
NS_ASSERTION(mIsInitialized, "Access node was not initialized");
|
||||
#endif
|
||||
|
@ -318,10 +323,15 @@ __try {
|
|||
GetXPAccessibleFor(varChild, getter_AddRefs(xpAccessible));
|
||||
if (xpAccessible) {
|
||||
nsAutoString value;
|
||||
if (NS_FAILED(xpAccessible->GetValue(value)) || value.IsEmpty())
|
||||
if (NS_FAILED(xpAccessible->GetValue(value)))
|
||||
return E_FAIL;
|
||||
|
||||
if (value.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*pszValue = ::SysAllocString(value.get());
|
||||
*pszValue = ::SysAllocStringLen(value.get(), value.Length());
|
||||
if (!*pszValue)
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_OK;
|
||||
|
@ -415,8 +425,9 @@ __try {
|
|||
}
|
||||
|
||||
if (!description.IsEmpty()) {
|
||||
*pszDescription = ::SysAllocString(description.get());
|
||||
return S_OK;
|
||||
*pszDescription = ::SysAllocStringLen(description.get(),
|
||||
description.Length());
|
||||
return *pszDescription ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
xpAccessible->GetDescription(description);
|
||||
|
@ -428,9 +439,15 @@ __try {
|
|||
description = NS_LITERAL_STRING("Description: ") + description;
|
||||
}
|
||||
|
||||
*pszDescription = ::SysAllocString(description.get());
|
||||
if (description.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*pszDescription = ::SysAllocStringLen(description.get(),
|
||||
description.Length());
|
||||
return *pszDescription ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_OK;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsAccessibleWrap::get_accRole(
|
||||
|
@ -565,13 +582,17 @@ __try {
|
|||
nsAutoString shortcut;
|
||||
nsresult rv = xpAccessible->GetKeyboardShortcut(shortcut);
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (shortcut.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*pszKeyboardShortcut = ::SysAllocString(shortcut.get());
|
||||
return S_OK;
|
||||
*pszKeyboardShortcut = ::SysAllocStringLen(shortcut.get(),
|
||||
shortcut.Length());
|
||||
return *pszKeyboardShortcut ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_FALSE;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsAccessibleWrap::get_accFocus(
|
||||
|
@ -795,13 +816,18 @@ __try {
|
|||
if (xpAccessible) {
|
||||
nsAutoString defaultAction;
|
||||
if (NS_FAILED(xpAccessible->GetActionName(0, defaultAction)))
|
||||
return E_FAIL;
|
||||
|
||||
if (defaultAction.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*pszDefaultAction = ::SysAllocString(defaultAction.get());
|
||||
*pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
|
||||
defaultAction.Length());
|
||||
return *pszDefaultAction ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_OK;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsAccessibleWrap::accSelect(
|
||||
|
@ -1341,39 +1367,58 @@ __try {
|
|||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::get_extendedRole(BSTR *extendedRole)
|
||||
nsAccessibleWrap::get_extendedRole(BSTR *aExtendedRole)
|
||||
{
|
||||
__try {
|
||||
*aExtendedRole = NULL;
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::get_localizedExtendedRole(BSTR *localizedExtendedRole)
|
||||
nsAccessibleWrap::get_localizedExtendedRole(BSTR *aLocalizedExtendedRole)
|
||||
{
|
||||
__try {
|
||||
*aLocalizedExtendedRole = NULL;
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::get_nExtendedStates(long *nExtendedStates)
|
||||
nsAccessibleWrap::get_nExtendedStates(long *aNExtendedStates)
|
||||
{
|
||||
*nExtendedStates = 0;
|
||||
__try {
|
||||
*aNExtendedStates = 0;
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::get_extendedStates(long maxExtendedStates,
|
||||
BSTR **extendedStates,
|
||||
long *nExtendedStates)
|
||||
nsAccessibleWrap::get_extendedStates(long aMaxExtendedStates,
|
||||
BSTR **aExtendedStates,
|
||||
long *aNExtendedStates)
|
||||
{
|
||||
*nExtendedStates = 0;
|
||||
__try {
|
||||
*aExtendedStates = NULL;
|
||||
*aNExtendedStates = 0;
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::get_localizedExtendedStates(long maxLocalizedExtendedStates,
|
||||
BSTR **localizedExtendedStates,
|
||||
long *nLocalizedExtendedStates)
|
||||
nsAccessibleWrap::get_localizedExtendedStates(long aMaxLocalizedExtendedStates,
|
||||
BSTR **aLocalizedExtendedStates,
|
||||
long *aNLocalizedExtendedStates)
|
||||
{
|
||||
*nLocalizedExtendedStates = 0;
|
||||
__try {
|
||||
*aLocalizedExtendedStates = NULL;
|
||||
*aNLocalizedExtendedStates = 0;
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1523,7 +1568,7 @@ __try {
|
|||
strAttrs.Append(';');
|
||||
}
|
||||
|
||||
*aAttributes = ::SysAllocString(strAttrs.get());
|
||||
*aAttributes = ::SysAllocStringLen(strAttrs.get(), strAttrs.Length());
|
||||
if (!*aAttributes)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
|
|
@ -72,18 +72,24 @@ STDMETHODIMP
|
|||
nsApplicationAccessibleWrap::get_appName(BSTR *aName)
|
||||
{
|
||||
__try {
|
||||
*aName = NULL;
|
||||
|
||||
if (!sAppInfo)
|
||||
return E_FAIL;
|
||||
|
||||
nsCAutoString cname;
|
||||
nsresult rv = sAppInfo->GetName(cname);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (cname.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
NS_ConvertUTF8toUTF16 name(cname);
|
||||
if (!::SysReAllocStringLen(aName, name.get(), name.Length()))
|
||||
*aName = ::SysAllocStringLen(name.get(), name.Length());
|
||||
if (!*aName)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -93,18 +99,24 @@ STDMETHODIMP
|
|||
nsApplicationAccessibleWrap::get_appVersion(BSTR *aVersion)
|
||||
{
|
||||
__try {
|
||||
*aVersion = NULL;
|
||||
|
||||
if (!sAppInfo)
|
||||
return E_FAIL;
|
||||
|
||||
nsCAutoString cversion;
|
||||
nsresult rv = sAppInfo->GetVersion(cversion);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (cversion.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
NS_ConvertUTF8toUTF16 version(cversion);
|
||||
if (!::SysReAllocStringLen(aVersion, version.get(), version.Length()))
|
||||
*aVersion = ::SysAllocStringLen(version.get(), version.Length());
|
||||
if (!*aVersion)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -112,27 +124,37 @@ __try {
|
|||
STDMETHODIMP
|
||||
nsApplicationAccessibleWrap::get_toolkitName(BSTR *aName)
|
||||
{
|
||||
return ::SysReAllocString(aName, L"Gecko");
|
||||
__try {
|
||||
*aName = ::SysAllocString(L"Gecko");
|
||||
return *aName ? S_OK : E_OUTOFMEMORY;
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsApplicationAccessibleWrap::get_toolkitVersion(BSTR *aVersion)
|
||||
{
|
||||
__try {
|
||||
*aVersion = NULL;
|
||||
|
||||
if (!sAppInfo)
|
||||
return E_FAIL;
|
||||
|
||||
nsCAutoString cversion;
|
||||
nsresult rv = sAppInfo->GetPlatformVersion(cversion);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (cversion.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
NS_ConvertUTF8toUTF16 version(cversion);
|
||||
if (!::SysReAllocStringLen(aVersion, version.get(), version.Length()))
|
||||
return E_OUTOFMEMORY;
|
||||
*aVersion = ::SysAllocStringLen(version.get(), version.Length());
|
||||
return *aVersion ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_OK;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// nsApplicationAccessibleWrap
|
||||
|
|
|
@ -202,11 +202,18 @@ STDMETHODIMP nsDocAccessibleWrap::get_URL(/* [out] */ BSTR __RPC_FAR *aURL)
|
|||
{
|
||||
__try {
|
||||
*aURL = NULL;
|
||||
|
||||
nsAutoString URL;
|
||||
if (NS_SUCCEEDED(GetURL(URL))) {
|
||||
*aURL= ::SysAllocString(URL.get());
|
||||
return S_OK;
|
||||
}
|
||||
nsresult rv = GetURL(URL));
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (URL.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aURL = ::SysAllocStringLen(URL.get(), URL.Length());
|
||||
return *aURL ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -215,11 +222,18 @@ STDMETHODIMP nsDocAccessibleWrap::get_title( /* [out] */ BSTR __RPC_FAR *aTitle)
|
|||
{
|
||||
__try {
|
||||
*aTitle = NULL;
|
||||
|
||||
nsAutoString title;
|
||||
if (NS_SUCCEEDED(GetTitle(title))) { // getter_Copies(pszTitle)))) {
|
||||
*aTitle= ::SysAllocString(title.get());
|
||||
return S_OK;
|
||||
}
|
||||
nsresult rv = GetTitle(title));
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (title.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aTitle = ::SysAllocStringLen(title.get(), title.Length());
|
||||
return *aTitle ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -228,11 +242,18 @@ STDMETHODIMP nsDocAccessibleWrap::get_mimeType(/* [out] */ BSTR __RPC_FAR *aMime
|
|||
{
|
||||
__try {
|
||||
*aMimeType = NULL;
|
||||
|
||||
nsAutoString mimeType;
|
||||
if (NS_SUCCEEDED(GetMimeType(mimeType))) {
|
||||
*aMimeType= ::SysAllocString(mimeType.get());
|
||||
return S_OK;
|
||||
}
|
||||
nsresult rv = GetMimeType(mimeType));
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (mimeType.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aMimeType = ::SysAllocStringLen(mimeType.get(), mimeType.Length());
|
||||
return *aMimeType ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -241,11 +262,18 @@ STDMETHODIMP nsDocAccessibleWrap::get_docType(/* [out] */ BSTR __RPC_FAR *aDocTy
|
|||
{
|
||||
__try {
|
||||
*aDocType = NULL;
|
||||
|
||||
nsAutoString docType;
|
||||
if (NS_SUCCEEDED(GetDocType(docType))) {
|
||||
*aDocType= ::SysAllocString(docType.get());
|
||||
return S_OK;
|
||||
}
|
||||
nsresult rv = GetDocType(docType));
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (docType.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aDocType = ::SysAllocStringLen(docType.get(), docType.Length());
|
||||
return *aDocType ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -254,21 +282,35 @@ STDMETHODIMP nsDocAccessibleWrap::get_nameSpaceURIForID(/* [in] */ short aNameS
|
|||
/* [out] */ BSTR __RPC_FAR *aNameSpaceURI)
|
||||
{
|
||||
__try {
|
||||
if (aNameSpaceID < 0) {
|
||||
return E_FAIL; // -1 is kNameSpaceID_Unknown
|
||||
}
|
||||
*aNameSpaceURI = NULL;
|
||||
|
||||
if (aNameSpaceID < 0)
|
||||
return E_INVALIDARG; // -1 is kNameSpaceID_Unknown
|
||||
|
||||
nsAutoString nameSpaceURI;
|
||||
if (NS_SUCCEEDED(GetNameSpaceURIForID(aNameSpaceID, nameSpaceURI))) {
|
||||
*aNameSpaceURI = ::SysAllocString(nameSpaceURI.get());
|
||||
return S_OK;
|
||||
}
|
||||
nsresult rv = GetNameSpaceURIForID(aNameSpaceID, nameSpaceURI));
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
if (nameSpaceURI.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aNameSpaceURI = ::SysAllocStringLen(nameSpaceURI.get(),
|
||||
nameSpaceURI.Length());
|
||||
|
||||
return *aNameSpaceURI ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsDocAccessibleWrap::put_alternateViewMediaTypes( /* [in] */ BSTR __RPC_FAR *commaSeparatedMediaTypes)
|
||||
STDMETHODIMP
|
||||
nsDocAccessibleWrap::put_alternateViewMediaTypes( /* [in] */ BSTR __RPC_FAR *aCommaSeparatedMediaTypes)
|
||||
{
|
||||
__try {
|
||||
*aCommaSeparatedMediaTypes = NULL;
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ STDMETHODIMP nsTextAccessibleWrap::get_domText(
|
|||
/* [retval][out] */ BSTR __RPC_FAR *aDomText)
|
||||
{
|
||||
__try {
|
||||
*aDomText = nsnull;
|
||||
*aDomText = NULL;
|
||||
|
||||
if (!mDOMNode) {
|
||||
return E_FAIL; // Node already shut down
|
||||
|
@ -93,7 +93,13 @@ __try {
|
|||
nsAutoString nodeValue;
|
||||
|
||||
mDOMNode->GetNodeValue(nodeValue);
|
||||
*aDomText = ::SysAllocString(nodeValue.get());
|
||||
if (nodeValue.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aDomText = ::SysAllocStringLen(nodeValue.get(), nodeValue.Length());
|
||||
if (!*aDomText)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
@ -240,7 +246,7 @@ STDMETHODIMP nsTextAccessibleWrap::get_fontFamily(
|
|||
/* [retval][out] */ BSTR __RPC_FAR *aFontFamily)
|
||||
{
|
||||
__try {
|
||||
*aFontFamily = nsnull;
|
||||
*aFontFamily = NULL;
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
|
@ -276,8 +282,13 @@ __try {
|
|||
|
||||
nsAutoString fontFamily;
|
||||
deviceContext->FirstExistingFont(fm->Font(), fontFamily);
|
||||
|
||||
*aFontFamily = ::SysAllocString(fontFamily.get());
|
||||
if (fontFamily.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aFontFamily = ::SysAllocStringLen(fontFamily.get(), fontFamily.Length());
|
||||
if (!*aFontFamily)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return S_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче