bug 346936. crashes [@ nsAccessibilityService::CreateRootAccessible]. r=ginn.chen, sr=dbaron

This commit is contained in:
aaronleventhal%moonset.net 2006-08-03 19:42:47 +00:00
Родитель b9af73b4de
Коммит fbf42053c6
2 изменённых файлов: 7 добавлений и 29 удалений

Просмотреть файл

@ -345,6 +345,8 @@ nsAccessibilityService::CreateRootAccessible(nsIPresShell *aShell,
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
do_QueryInterface(container);
NS_ENSURE_TRUE(docShellTreeItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
docShellTreeItem->GetParent(getter_AddRefs(parentTreeItem));

Просмотреть файл

@ -268,11 +268,6 @@ const char* const docEvents[] = {
"DOMContentLoaded"
};
const char* const chromeEvents[] = {
"pagehide",
"pageshow"
};
nsresult nsRootAccessible::AddEventListeners()
{
// use AddEventListener from the nsIDOMEventTarget interface
@ -288,14 +283,8 @@ nsresult nsRootAccessible::AddEventListeners()
GetChromeEventHandler(getter_AddRefs(target));
NS_ASSERTION(target, "No chrome event handler for document");
if (target) {
for (const char* const* e = chromeEvents,
* const* e_end = chromeEvents + NS_ARRAY_LENGTH(chromeEvents);
e < e_end; ++e) {
nsresult rv = target->AddEventListener(NS_ConvertASCIItoUTF16(*e), this, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
}
}
nsresult rv = target->AddEventListener(NS_LITERAL_STRING("pagehide"), this, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
if (!mCaretAccessible) {
mCaretAccessible = new nsCaretAccessible(mDOMNode, mWeakShell, this);
@ -329,14 +318,8 @@ nsresult nsRootAccessible::RemoveEventListeners()
}
GetChromeEventHandler(getter_AddRefs(target));
if (target) {
for (const char* const* e = chromeEvents,
* const* e_end = chromeEvents + NS_ARRAY_LENGTH(chromeEvents);
e < e_end; ++e) {
nsresult rv = target->RemoveEventListener(NS_ConvertASCIItoUTF16(*e), this, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
}
}
nsresult rv = target->RemoveEventListener(NS_LITERAL_STRING("pagehide"), this, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
if (mCaretAccessible) {
mCaretAccessible->RemoveSelectionListener();
@ -787,14 +770,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
}
#else
AtkStateChange stateData;
if (eventType.EqualsIgnoreCase("pageshow")) {
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(targetNode));
if (htmlDoc) {
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_REORDER,
accessible, nsnull);
}
}
else if (eventType.LowerCaseEqualsLiteral("focus") ||
if (eventType.LowerCaseEqualsLiteral("focus") ||
eventType.LowerCaseEqualsLiteral("dommenuitemactive")) {
if (treeItemAccessible) { // use focused treeitem
privAcc = do_QueryInterface(treeItemAccessible);