Bug 1594886 - Remove xpidl [array] use in nsIMsgKeyArray. r=jorgk
authorBen Campbell <benc@thunderbird.net>
Fri, 08 Nov 2019 14:25:59 +1300
changeset 36623 edda2bec8db7c2f754c0d83a42067263c27bb111
parent 36622 4cc36294505950bdefcb86afab1b7bc31d0cc535
child 36624 aeb3be1b205331433fb589efefd1aee830b84a6c
push id2534
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:52:51 +0000
treeherdercomm-beta@055c50840778 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1594886
Bug 1594886 - Remove xpidl [array] use in nsIMsgKeyArray. r=jorgk
mailnews/base/public/nsIMsgKeyArray.idl
mailnews/base/util/nsMsgKeyArray.cpp
--- a/mailnews/base/public/nsIMsgKeyArray.idl
+++ b/mailnews/base/public/nsIMsgKeyArray.idl
@@ -43,12 +43,11 @@ interface nsIMsgKeyArray : nsISupports {
   void sort();
 
   /**
    * Retrieves the entire array in such a way that xpconnect can easily
    * create a js array of the keys.
    *
    * @returns array of the keys
    */
-  void getArray(out unsigned long aCount,
-           [array, size_is(aCount)] out nsMsgKey aKeys);
+  Array<nsMsgKey> getArray();
 };
 
--- a/mailnews/base/util/nsMsgKeyArray.cpp
+++ b/mailnews/base/util/nsMsgKeyArray.cpp
@@ -51,16 +51,12 @@ NS_IMETHODIMP nsMsgKeyArray::AppendEleme
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgKeyArray::InsertElementSorted(nsMsgKey aKey) {
   // This function should be removed after interfaces are not frozen for TB38.
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP nsMsgKeyArray::GetArray(uint32_t *aCount, nsMsgKey **aKeys) {
-  NS_ENSURE_ARG_POINTER(aCount);
-  NS_ENSURE_ARG_POINTER(aKeys);
-  *aCount = m_keys.Length();
-  *aKeys = (nsMsgKey *)moz_xmemdup(m_keys.Elements(),
-                                   m_keys.Length() * sizeof(nsMsgKey));
-  return (*aKeys) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+NS_IMETHODIMP nsMsgKeyArray::GetArray(nsTArray<nsMsgKey> &aKeys) {
+  aKeys = m_keys;
+  return NS_OK;
 }