Bug 1683586 - Remove "mailBoxes" and "addressBooks" support in nsIImportGeneric setData()/getData(). r=mkmelin
authorBen Campbell <ben@thunderbird.net>
Mon, 21 Dec 2020 12:06:53 +0200
changeset 31319 d6dffa8724685246db7aa85247854de2e5a9ff5a
parent 31318 edfcfeb3910d4b3176d5e6e22df8464fefd54283
child 31320 49722c3c942bdba5b6fc7a55668d72709576ff72
push id18297
push usermkmelin@iki.fi
push dateMon, 21 Dec 2020 10:10:17 +0000
treeherdercomm-central@d6dffa872468 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1683586
Bug 1683586 - Remove "mailBoxes" and "addressBooks" support in nsIImportGeneric setData()/getData(). r=mkmelin
mailnews/import/public/nsIImportGeneric.idl
mailnews/import/src/nsImportAddressBooks.cpp
mailnews/import/src/nsImportMail.cpp
--- a/mailnews/import/public/nsIImportGeneric.idl
+++ b/mailnews/import/public/nsIImportGeneric.idl
@@ -14,21 +14,19 @@
 interface nsISupportsString;
 
 [scriptable, uuid(469d7d5f-144c-4f07-9661-e49e40156348)]
 interface nsIImportGeneric : nsISupports
 {
   /* Use these to prepare for the import */
     /*
       "mailInterface" - nsIImportMail interface
-      "mailBoxes" - nsIArray of nsIImportMailboxDescriptors
       "mailLocation" - nsIFile, source location for mail
 
       "addressInterface" - nsIImportAddressBooks interface
-      "addressBooks" - nsIArray of nsIImportABDescriptors
       "addressLocation" - src location of address books (if needed!)
       "addressDestination" - uri of destination address book or null if
                 new address books will be created.
     */
   nsISupports GetData(in string dataId);
 
   void SetData(in string dataId, in nsISupports pData);
 
--- a/mailnews/import/src/nsImportAddressBooks.cpp
+++ b/mailnews/import/src/nsImportAddressBooks.cpp
@@ -10,18 +10,16 @@
 #include "nsISupportsPrimitives.h"
 #include "nsIImportABDescriptor.h"
 #include "nsIAbManager.h"
 #include "nsAbBaseCID.h"
 #include "nsImportStringBundle.h"
 #include "nsTextFormatter.h"
 #include "msgCore.h"
 #include "ImportDebug.h"
-#include "nsIMutableArray.h"
-#include "nsArrayUtils.h"
 
 nsresult NS_NewGenericAddressBooks(nsIImportGeneric** aImportGeneric) {
   NS_ASSERTION(aImportGeneric != nullptr, "null ptr");
   if (!aImportGeneric) return NS_ERROR_NULL_POINTER;
 
   RefPtr<nsImportGenericAddressBooks> pGen = new nsImportGenericAddressBooks();
   return pGen->QueryInterface(NS_GET_IID(nsIImportGeneric),
                               (void**)aImportGeneric);
@@ -57,29 +55,16 @@ NS_IMETHODIMP nsImportGenericAddressBook
     NS_IF_ADDREF(*_retval = m_pInterface);
   }
 
   if (!PL_strcasecmp(dataId, "addressLocation")) {
     if (!m_pLocation) GetDefaultLocation();
     NS_IF_ADDREF(*_retval = m_pLocation);
   }
 
-  if (!PL_strcasecmp(dataId, "addressBooks")) {
-    if (!m_pLocation) GetDefaultLocation();
-    GetDefaultBooks();
-    // Stopgap during nsIArray-removal (Bug 1612240).
-    // TODO: GetData("addressBooks") doesn't seem to be used anywhere.
-    // Maybe this can just be dropped?
-    nsCOMPtr<nsIMutableArray> tmp(do_CreateInstance(NS_ARRAY_CONTRACTID));
-    for (nsIImportABDescriptor* book : m_Books) {
-      tmp->AppendElement(book);
-    }
-    *_retval = tmp;
-  }
-
   if (!PL_strcasecmp(dataId, "addressDestination")) {
     if (!m_pDestinationUri.IsEmpty()) {
       nsCOMPtr<nsISupportsCString> abString =
           do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
       abString->SetData(m_pDestinationUri);
       abString.forget(_retval);
     }
@@ -135,33 +120,16 @@ NS_IMETHODIMP nsImportGenericAddressBook
                                                    nsISupports* item) {
   NS_ASSERTION(dataId != nullptr, "null ptr");
   if (!dataId) return NS_ERROR_NULL_POINTER;
 
   if (!PL_strcasecmp(dataId, "addressInterface")) {
     m_pInterface = nullptr;
     if (item) m_pInterface = do_QueryInterface(item);
   }
-  if (!PL_strcasecmp(dataId, "addressBooks")) {
-    // Stopgap during nsIArray-removal (Bug 1612240).
-    // TODO: SetData("addressBooks") doesn't seem to be used anywhere.
-    // Maybe this can just be dropped?
-    m_Books.Clear();
-    if (item) {
-      nsCOMPtr<nsIMutableArray> tmp = do_QueryInterface(item);
-      if (tmp) {
-        uint32_t cnt;
-        tmp->GetLength(&cnt);
-        for (uint32_t i = 0; i < cnt; ++i) {
-          nsCOMPtr<nsIImportABDescriptor> book = do_QueryElementAt(tmp, i);
-          m_Books.AppendElement(book);
-        }
-      }
-    }
-  }
 
   if (!PL_strcasecmp(dataId, "addressLocation")) {
     m_pLocation = nullptr;
 
     if (item) {
       nsresult rv;
       m_pLocation = do_QueryInterface(item, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -1,17 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsImportMail.h"
 
-#include "nsIMutableArray.h"
-#include "nsArrayUtils.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIImportMailboxDescriptor.h"
 #include "nsIMsgAccountManager.h"
 #include "nsMsgBaseCID.h"
 #include "nsImportStringBundle.h"
 #include "nsTextFormatter.h"
 #include "ImportDebug.h"
@@ -77,28 +75,16 @@ NS_IMETHODIMP nsImportGenericMail::GetDa
   nsresult rv = NS_OK;
   NS_ENSURE_ARG_POINTER(_retval);
 
   *_retval = nullptr;
   if (!PL_strcasecmp(dataId, "mailInterface")) {
     NS_IF_ADDREF(*_retval = m_pInterface);
   }
 
-  if (!PL_strcasecmp(dataId, "mailBoxes")) {
-    GetDefaultMailboxes();
-    // Stopgap during nsIArray-removal (Bug 1612240).
-    // TODO: GetData("mailBoxes") doesn't seem to be used anywhere.
-    // Maybe this can just be dropped?
-    nsCOMPtr<nsIMutableArray> tmp(do_CreateInstance(NS_ARRAY_CONTRACTID));
-    for (nsIImportMailboxDescriptor* box : m_mailboxes) {
-      tmp->AppendElement(box);
-    }
-    *_retval = tmp;
-  }
-
   if (!PL_strcasecmp(dataId, "mailLocation")) {
     if (!m_pSrcLocation) GetDefaultLocation();
     NS_IF_ADDREF(*_retval = m_pSrcLocation);
   }
 
   if (!PL_strcasecmp(dataId, "mailDestination")) {
     if (!m_pDestFolder) GetDefaultDestination();
     NS_IF_ADDREF(*_retval = m_pDestFolder);
@@ -132,34 +118,16 @@ NS_IMETHODIMP nsImportGenericMail::SetDa
   nsresult rv = NS_OK;
   NS_ASSERTION(dataId != nullptr, "null ptr");
   if (!dataId) return NS_ERROR_NULL_POINTER;
 
   if (!PL_strcasecmp(dataId, "mailInterface")) {
     m_pInterface = nullptr;
     if (item) m_pInterface = do_QueryInterface(item);
   }
-  if (!PL_strcasecmp(dataId, "mailBoxes")) {
-    // Stopgap during nsIArray-removal (Bug 1612240).
-    // TODO: SetData("mailBoxes") doesn't seem to be used anywhere.
-    // Maybe this can just be dropped?
-    m_mailboxes.Clear();
-    if (item) {
-      nsCOMPtr<nsIMutableArray> tmp = do_QueryInterface(item);
-      if (tmp) {
-        uint32_t cnt;
-        tmp->GetLength(&cnt);
-        for (uint32_t i = 0; i < cnt; ++i) {
-          nsCOMPtr<nsIImportMailboxDescriptor> box = do_QueryElementAt(tmp, i);
-          m_mailboxes.AppendElement(box);
-        }
-      }
-    }
-    m_gotDefaultMailboxes = true;
-  }
 
   if (!PL_strcasecmp(dataId, "mailLocation")) {
     m_mailboxes.Clear();
     m_gotDefaultMailboxes = false;
     m_pSrcLocation = nullptr;
     if (item) {
       nsresult rv;
       nsCOMPtr<nsIFile> location = do_QueryInterface(item, &rv);