Bug 1518823 - Port bug 1482389: Replace nsITreeBoxObject with XULTreeElement. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Tue, 15 Jan 2019 10:42:51 +0100
changeset 33348 85114397b4c8277f1f764e1b3826940345b500ec
parent 33347 8015b21deff6cc830908f042f1847e60780178ed
child 33349 96b12a150fe1d827b9be239705e6e94492d36c54
push id2368
push userclokep@gmail.com
push dateMon, 28 Jan 2019 21:12:50 +0000
treeherdercomm-beta@56d23c07d815 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage-fix
bugs1518823, 1482389
Bug 1518823 - Port bug 1482389: Replace nsITreeBoxObject with XULTreeElement. rs=bustage-fix
mailnews/addrbook/src/nsAbView.cpp
mailnews/addrbook/src/nsAbView.h
mailnews/base/src/nsMsgDBView.cpp
mailnews/base/src/nsMsgDBView.h
mailnews/base/src/nsSubscribableServer.cpp
mailnews/base/src/nsSubscribableServer.h
mailnews/news/src/nsNntpIncomingServer.cpp
mailnews/news/src/nsNntpIncomingServer.h
--- a/mailnews/addrbook/src/nsAbView.cpp
+++ b/mailnews/addrbook/src/nsAbView.cpp
@@ -55,18 +55,20 @@ nsAbView::~nsAbView()
     NS_ASSERTION(NS_SUCCEEDED(ClearView()), "failed to close view");
   }
 }
 
 NS_IMETHODIMP nsAbView::ClearView()
 {
   mDirectory = nullptr;
   mAbViewListener = nullptr;
-  if (mTree)
-    mTree->SetView(nullptr);
+  if (mTree) {
+    IgnoredErrorResult rv2;
+    mTree->SetView(nullptr, mozilla::dom::CallerType::System, rv2);
+  }
   mTree = nullptr;
   mTreeSelection = nullptr;
 
   if (mInitialized)
   {
     nsresult rv;
     mInitialized = false;
     nsCOMPtr<nsIPrefBranch> pbi(do_GetService(NS_PREFSERVICE_CONTRACTID,
@@ -100,18 +102,17 @@ nsresult nsAbView::RemoveCardAt(int32_t 
   mCards.RemoveElementAt(row);
   PR_FREEIF(abcard->primaryCollationKey);
   PR_FREEIF(abcard->secondaryCollationKey);
   PR_FREEIF(abcard);
 
 
   // This needs to happen after we remove the card, as RowCountChanged() will call GetRowCount()
   if (mTree) {
-    rv = mTree->RowCountChanged(row, -1);
-    NS_ENSURE_SUCCESS(rv,rv);
+    mTree->RowCountChanged(row, -1);
   }
 
   if (mAbViewListener && !mSuppressCountChange) {
     rv = mAbViewListener->OnCountChanged(mCards.Length());
     NS_ENSURE_SUCCESS(rv,rv);
   }
   return NS_OK;
 }
@@ -167,17 +168,18 @@ NS_IMETHODIMP nsAbView::SetView(nsIAbDir
   // Ensure we are initialized
   nsresult rv = Initialize();
 
   mAbViewListener = nullptr;
   if (mTree)
   {
     // Try and speed deletion of old cards by disconnecting the tree from us.
     mTreeSelection->ClearSelection();
-    mTree->SetView(nullptr);
+    IgnoredErrorResult rv2;
+    mTree->SetView(nullptr, mozilla::dom::CallerType::System, rv2);
   }
 
   // Clear out old cards
   int32_t i = mCards.Length();
   while(i-- > 0)
   {
     rv = RemoveCardAt(i);
     NS_ASSERTION(NS_SUCCEEDED(rv), "remove card failed\n");
@@ -518,17 +520,17 @@ NS_IMETHODIMP nsAbView::GetCellText(int3
 {
   NS_ENSURE_TRUE(row >= 0 && (size_t)row < mCards.Length(), NS_ERROR_UNEXPECTED);
 
   nsIAbCard *card = mCards.ElementAt(row)->card;
   const nsAString& colID = col->GetId();
   return GetCardValue(card, colID, _retval);
 }
 
-NS_IMETHODIMP nsAbView::SetTree(nsITreeBoxObject *tree)
+NS_IMETHODIMP nsAbView::SetTree(mozilla::dom::XULTreeElement *tree)
 {
   mTree = tree;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbView::ToggleOpenState(int32_t index)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
@@ -540,19 +542,20 @@ NS_IMETHODIMP nsAbView::CycleHeader(nsTr
 }
 
 nsresult nsAbView::InvalidateTree(int32_t row)
 {
   if (!mTree)
     return NS_OK;
 
   if (row == ALL_ROWS)
-    return mTree->Invalidate();
+    mTree->Invalidate();
   else
-    return mTree->InvalidateRow(row);
+    mTree->InvalidateRow(row);
+  return NS_OK;
 }
 
 NS_IMETHODIMP nsAbView::SelectionChangedXPCOM()
 {
   if (mAbViewListener && !mSuppressSelectionChange) {
     nsresult rv = mAbViewListener->OnSelectionChanged();
     NS_ENSURE_SUCCESS(rv,rv);
   }
@@ -902,17 +905,17 @@ nsresult nsAbView::AddCard(AbCard *abcar
   nsresult rv = NS_OK;
   NS_ENSURE_ARG_POINTER(abcard);
 
   *index = FindIndexForInsert(abcard);
   mCards.InsertElementAt(*index, abcard);
 
   // This needs to happen after we insert the card, as RowCountChanged() will call GetRowCount()
   if (mTree)
-    rv = mTree->RowCountChanged(*index, 1);
+    mTree->RowCountChanged(*index, 1);
 
   // Checking for mTree here works around core bug 399227
   if (selectCardAfterAdding && mTreeSelection && mTree) {
     mTreeSelection->SetCurrentIndex(*index);
     mTreeSelection->RangedSelect(*index, *index, false /* augment */);
   }
 
   if (mAbViewListener && !mSuppressCountChange) {
@@ -1157,18 +1160,17 @@ nsresult nsAbView::ReselectCards(nsIArra
 
   // Reset the index card, and ensure it is visible.
   if (aIndexCard) {
     int32_t currentIndex = FindIndexForCard(aIndexCard);
     rv = mTreeSelection->SetCurrentIndex(currentIndex);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (mTree) {
-      rv = mTree->EnsureRowIsVisible(currentIndex);
-      NS_ENSURE_SUCCESS(rv, rv);
+      mTree->EnsureRowIsVisible(currentIndex);
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbView::DeleteSelectedCards()
 {
--- a/mailnews/addrbook/src/nsAbView.h
+++ b/mailnews/addrbook/src/nsAbView.h
@@ -5,17 +5,17 @@
 
 #ifndef _nsAbView_H_
 #define _nsAbView_H_
 
 #include "nsISupports.h"
 #include "nsString.h"
 #include "nsIAbView.h"
 #include "nsITreeView.h"
-#include "nsITreeBoxObject.h"
+#include "mozilla/dom/XULTreeElement.h"
 #include "nsITreeSelection.h"
 #include "nsTArray.h"
 #include "nsIAbDirectory.h"
 #include "nsICollation.h"
 #include "nsIAbListener.h"
 #include "nsIObserver.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
@@ -57,17 +57,17 @@ private:
   nsresult RemoveCardAndSelectNextCard(nsISupports *item);
   nsresult EnumerateCards();
   nsresult SetGeneratedNameFormatFromPrefs();
   nsresult GetSelectedCards(nsCOMPtr<nsIMutableArray> &aSelectedCards);
   nsresult ReselectCards(nsIArray *aCards, nsIAbCard *aIndexCard);
   nsresult GetCardValue(nsIAbCard *card, const nsAString& colID, nsAString &_retval);
   nsresult RefreshTree();
 
-  nsCOMPtr<nsITreeBoxObject> mTree;
+  RefPtr<mozilla::dom::XULTreeElement> mTree;
   nsCOMPtr<nsITreeSelection> mTreeSelection;
   nsCOMPtr <nsIAbDirectory> mDirectory;
   nsTArray<AbCard*> mCards;
   nsString mSortColumn;
   nsString mSortDirection;
   nsCOMPtr<nsICollation> mCollationKeyGenerator;
   nsCOMPtr<nsIAbViewListener> mAbViewListener;
   nsCOMPtr<nsIStringBundle> mABBundle;
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -2329,17 +2329,17 @@ nsMsgDBView::CellTextForColumn(int32_t a
     default:
       break;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMsgDBView::SetTree(nsITreeBoxObject *tree)
+nsMsgDBView::SetTree(mozilla::dom::XULTreeElement *tree)
 {
   mTree = tree;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgDBView::ToggleOpenState(int32_t index)
 {
@@ -3141,17 +3141,17 @@ nsMsgDBView::ListCollapsedChildren(nsMsg
   return rv;
 }
 
 bool
 nsMsgDBView::OperateOnMsgsInCollapsedThreads()
 {
   if (mTreeSelection)
   {
-    nsCOMPtr<nsITreeBoxObject> selTree;
+    RefPtr<mozilla::dom::XULTreeElement> selTree;
     mTreeSelection->GetTree(getter_AddRefs(selTree));
     // No tree means stand-alone message window.
     if (!selTree)
       return false;
   }
 
   nsresult rv = NS_OK;
   nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
--- a/mailnews/base/src/nsMsgDBView.h
+++ b/mailnews/base/src/nsMsgDBView.h
@@ -9,17 +9,17 @@
 #include "nsIMsgDBView.h"
 #include "nsIMsgWindow.h"
 #include "nsIMessenger.h"
 #include "nsIMsgDatabase.h"
 #include "nsIMsgHdr.h"
 #include "MailNewsTypes.h"
 #include "nsIDBChangeListener.h"
 #include "nsITreeView.h"
-#include "nsITreeBoxObject.h"
+#include "mozilla/dom/XULTreeElement.h"
 #include "nsITreeSelection.h"
 #include "nsIMsgFolder.h"
 #include "nsIMsgThread.h"
 #include "DateTimeFormat.h"
 #include "nsIImapIncomingServer.h"
 #include "nsIMsgFilterPlugin.h"
 #include "nsIStringBundle.h"
 #include "nsMsgTagService.h"
@@ -129,17 +129,17 @@ protected:
   static char16_t* kLowPriorityString;
   static char16_t* kNormalPriorityString;
 
   static char16_t* kReadString;
   static char16_t* kRepliedString;
   static char16_t* kForwardedString;
   static char16_t* kNewString;
 
-  nsCOMPtr<nsITreeBoxObject> mTree;
+  RefPtr<mozilla::dom::XULTreeElement> mTree;
   nsCOMPtr<nsITreeSelection> mTreeSelection;
   // We cache this to determine when to push command status notifications.
   uint32_t mNumSelectedRows;
   // Set when the message pane is collapsed.
   bool mSuppressMsgDisplay;
   bool mSuppressCommandUpdating;
   // Set when we're telling the outline a row is being removed. Used to
   // suppress msg loading during delete/move operations.
--- a/mailnews/base/src/nsSubscribableServer.cpp
+++ b/mailnews/base/src/nsSubscribableServer.cpp
@@ -711,17 +711,17 @@ nsSubscribableServer::SetSelection(nsITr
 NS_IMETHODIMP
 nsSubscribableServer::GetRowCount(int32_t *rowCount)
 {
   *rowCount = mRowMap.Length();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSubscribableServer::SetTree(nsITreeBoxObject *aTree)
+nsSubscribableServer::SetTree(mozilla::dom::XULTreeElement *aTree)
 {
   mTree = aTree;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSubscribableServer::IsContainer(int32_t aIndex, bool *retval)
 {
--- a/mailnews/base/src/nsSubscribableServer.h
+++ b/mailnews/base/src/nsSubscribableServer.h
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsSubscribableServer_h__
 #define nsSubscribableServer_h__
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsIMsgIncomingServer.h"
-#include "nsITreeBoxObject.h"
+#include "mozilla/dom/XULTreeElement.h"
 #include "nsITreeSelection.h"
 #include "nsITreeView.h"
 #include "nsISubscribableServer.h"
 #include "nsTArray.h"
 
 /**
  * The basic structure for the tree of the implementation.
  *
@@ -62,17 +62,17 @@ private:
   char mDelimiter;
   bool mShowFullName;
   bool mStopped;
   nsCString mServerType;
 
   SubscribeTreeNode *mTreeRoot;          // root of the folder tree while items are discovered on the server
   nsTArray<SubscribeTreeNode*> mRowMap;  // array of nodes representing the rows for the tree element
   nsCOMPtr<nsITreeSelection> mSelection;
-  nsCOMPtr<nsITreeBoxObject> mTree;
+  RefPtr<mozilla::dom::XULTreeElement> mTree;
   nsresult FreeSubtree(SubscribeTreeNode *node);
   nsresult FreeRows();
   nsresult CreateNode(SubscribeTreeNode *parent, const char *name, const nsACString &aPath, SubscribeTreeNode **result);
   nsresult AddChildNode(SubscribeTreeNode *parent, const char *name, const nsACString &aPath, SubscribeTreeNode **child);
   nsresult FindAndCreateNode(const nsACString &aPath, SubscribeTreeNode **aResult);
 
   int32_t GetRow(SubscribeTreeNode *node, bool *open);
   int32_t AddSubtree(SubscribeTreeNode *node, int32_t index);
--- a/mailnews/news/src/nsNntpIncomingServer.cpp
+++ b/mailnews/news/src/nsNntpIncomingServer.cpp
@@ -26,17 +26,17 @@
 #include "nsUnicharUtils.h"
 #include "nsILineInputStream.h"
 #include "nsNetUtil.h"
 #include "nsISimpleEnumerator.h"
 #include "nsMsgUtils.h"
 #include "mozilla/Services.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/ErrorResult.h"
-#include "nsITreeBoxObject.h"
+#include "mozilla/dom/XULTreeElement.h"
 #include "mozilla/dom/DataTransfer.h"
 
 #define INVALID_VERSION         0
 #define VALID_VERSION           2
 #define NEW_NEWS_DIR_NAME       "News"
 #define PREF_MAIL_NEWSRC_ROOT   "mail.newsrc_root"
 #define PREF_MAIL_NEWSRC_ROOT_REL "mail.newsrc_root-rel"
 #define PREF_MAILNEWS_VIEW_DEFAULT_CHARSET "mailnews.view_default_charset"
@@ -1864,24 +1864,23 @@ nsNntpIncomingServer::GetCellText(int32_
     // some servers have newsgroup names that are non ASCII.  we store
     // those as escaped. unescape here so the UI is consistent
     rv = NS_MsgDecodeUnescapeURLPath(mSubscribeSearchResult.ElementAt(row), _retval);
   }
   return rv;
 }
 
 NS_IMETHODIMP
-nsNntpIncomingServer::SetTree(nsITreeBoxObject *tree)
+nsNntpIncomingServer::SetTree(mozilla::dom::XULTreeElement *tree)
 {
   mTree = tree;
   if (!tree)
     return NS_OK;
 
-  RefPtr<nsTreeColumns> cols;
-  tree->GetColumns(getter_AddRefs(cols));
+  RefPtr<nsTreeColumns> cols = tree->GetColumns();
   if (!cols)
     return NS_OK;
 
   RefPtr<nsTreeColumn> col = cols->GetKeyColumn();
   if (!col)
     return NS_OK;
 
   RefPtr<mozilla::dom::Element> element = col->Element();
--- a/mailnews/news/src/nsNntpIncomingServer.h
+++ b/mailnews/news/src/nsNntpIncomingServer.h
@@ -99,17 +99,17 @@ private:
     nsTArray<nsCString> mSubscribeSearchResult;
     bool mSearchResultSortDescending;
     // the list of of subscribed newsgroups within a given
     // subscribed dialog session.
     // we need to keep track of them so we know what to show as "checked"
     // in the search view
     nsTArray<nsCString> mTempSubscribed;
 
-    nsCOMPtr<nsITreeBoxObject> mTree;
+    RefPtr<mozilla::dom::XULTreeElement> mTree;
     nsCOMPtr<nsITreeSelection> mTreeSelection;
 
     bool     mHasSeenBeginGroups;
     bool     mGetOnlyNew;
     nsresult WriteHostInfoFile();
     nsresult LoadHostInfoFile();
     nsresult AddGroupOnServer(const nsACString &name);