Bug 405951. Missing content in Thunderbird window. r=surkov, a=blocking1.9
authoraaronleventhal@moonset.net
Fri, 25 Jan 2008 12:43:12 -0800
changeset 10678 38f8f57be2a09d0bad65c7d137859f48e64a724d
parent 10677 5c359b103562508b142f19ce85d5fbe831978767
child 10679 864173b3197842a8a2dfe2d7cd88dd1d23d6195d
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssurkov, blocking1.9
bugs405951
milestone1.9b3pre
Bug 405951. Missing content in Thunderbird window. r=surkov, a=blocking1.9
accessible/src/base/nsCaretAccessible.cpp
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -85,16 +85,18 @@ nsresult nsCaretAccessible::ClearControl
   mCurrentControl = nsnull;
   return selPrivate->RemoveSelectionListener(this);
 }
 
 nsresult nsCaretAccessible::SetControlSelectionListener(nsIDOMNode *aCurrentNode)
 {
   NS_ENSURE_TRUE(mRootAccessible, NS_ERROR_FAILURE);
 
+  ClearControlSelectionListener();
+
   mCurrentControl = aCurrentNode;
   mLastTextAccessible = nsnull;
 
   // When focus moves such that the caret is part of a new frame selection
   // this removes the old selection listener and attaches a new one for the current focus
   nsCOMPtr<nsIPresShell> presShell = 
     mRootAccessible->GetPresShellFor(aCurrentNode);
   if (!presShell)
@@ -118,26 +120,27 @@ nsresult nsCaretAccessible::SetControlSe
 
   nsCOMPtr<nsISelectionController> selCon;
   frame->GetSelectionController(presContext, getter_AddRefs(selCon));
   NS_ENSURE_TRUE(selCon, NS_ERROR_FAILURE);
   
   nsCOMPtr<nsISelection> domSel;
   selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
 
-  ClearControlSelectionListener();
   nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(domSel));
   NS_ENSURE_TRUE(selPrivate, NS_ERROR_FAILURE);
 
   mCurrentControlSelection = do_GetWeakReference(domSel);
   return selPrivate->AddSelectionListener(this);
 }
 
 nsresult nsCaretAccessible::AddDocSelectionListener(nsIDOMDocument *aDoc)
 {
+  NS_ENSURE_TRUE(mRootAccessible, NS_ERROR_FAILURE);
+
   nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
   NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
   nsCOMPtr<nsISelectionController> selCon = do_QueryInterface(doc->GetPrimaryShell());
   NS_ENSURE_TRUE(selCon, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsISelection> domSel;
   selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
   nsCOMPtr<nsISelectionPrivate> selPrivate = do_QueryInterface(domSel);