зеркало из https://github.com/mozilla/gecko-dev.git
bug 112494, "crash in nsAccessibilityService::CreateIFrameAccessible", r=jgaunt, sr=shaver
sanity check the parameter and return an error code if something isn't right, instead of crashing.
This commit is contained in:
Родитель
0745c50724
Коммит
7baa72c607
|
@ -666,19 +666,30 @@ nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* aDOMNode, nsISuppo
|
|||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateIFrameAccessible(nsIDOMNode* aDOMNode, nsIAccessible **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aDOMNode));
|
||||
NS_ASSERTION(content,"Error non nsIContent passed to accessible factory!!!");
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIWeakReference> outerWeakShell;
|
||||
GetShellFromNode(aDOMNode, getter_AddRefs(outerWeakShell));
|
||||
|
||||
nsCOMPtr<nsIPresShell> outerPresShell(do_QueryReferent(outerWeakShell));
|
||||
if (NS_WARN_IF_FALSE(outerPresShell,
|
||||
"No outer pres shell in CreateHTMLIFrameAccessible!")) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> outerPresContext;
|
||||
outerPresShell->GetPresContext(getter_AddRefs(outerPresContext));
|
||||
NS_ASSERTION(outerPresContext,"No outer pres context in CreateHTMLIFrameAccessible!");
|
||||
|
||||
if (NS_WARN_IF_FALSE(outerPresContext,
|
||||
"No outer pres context in CreateHTMLIFrameAccessible!")) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) {
|
||||
if (outerPresShell) {
|
||||
|
|
|
@ -666,19 +666,30 @@ nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* aDOMNode, nsISuppo
|
|||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateIFrameAccessible(nsIDOMNode* aDOMNode, nsIAccessible **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aDOMNode));
|
||||
NS_ASSERTION(content,"Error non nsIContent passed to accessible factory!!!");
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIWeakReference> outerWeakShell;
|
||||
GetShellFromNode(aDOMNode, getter_AddRefs(outerWeakShell));
|
||||
|
||||
nsCOMPtr<nsIPresShell> outerPresShell(do_QueryReferent(outerWeakShell));
|
||||
if (NS_WARN_IF_FALSE(outerPresShell,
|
||||
"No outer pres shell in CreateHTMLIFrameAccessible!")) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> outerPresContext;
|
||||
outerPresShell->GetPresContext(getter_AddRefs(outerPresContext));
|
||||
NS_ASSERTION(outerPresContext,"No outer pres context in CreateHTMLIFrameAccessible!");
|
||||
|
||||
if (NS_WARN_IF_FALSE(outerPresContext,
|
||||
"No outer pres context in CreateHTMLIFrameAccessible!")) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) {
|
||||
if (outerPresShell) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче