Bug 1557829 - Port bug 1557793 - Adapt to array changes in nsIStringBundle.formatStringFromName. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Tue, 11 Jun 2019 17:54:08 +0200
changeset 35831 323c1caa59c5d6e13a9dfb9cd318fe9a6c459774
parent 35830 b27953c5a381358c0480d73971a5c91adabecb1e
child 35832 be5c06a3f4d225c6147368b89f3baa05ccc3dfc7
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersbustage-fix
bugs1557829, 1557793
Bug 1557829 - Port bug 1557793 - Adapt to array changes in nsIStringBundle.formatStringFromName. rs=bustage-fix
mailnews/addrbook/src/nsAbCardProperty.cpp
mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
mailnews/addrbook/src/nsAbManager.cpp
mailnews/addrbook/src/nsAbView.cpp
mailnews/addrbook/src/nsAddrDatabase.cpp
mailnews/addrbook/src/nsAddrDatabase.h
mailnews/base/search/src/nsMsgFilter.cpp
mailnews/base/search/src/nsMsgFilterList.cpp
mailnews/base/search/src/nsMsgFilterService.cpp
mailnews/base/src/nsMessenger.cpp
mailnews/base/src/nsMessengerUnixIntegration.cpp
mailnews/base/src/nsMessengerWinIntegration.cpp
mailnews/base/src/nsMsgFolderCompactor.cpp
mailnews/base/src/nsMsgStatusFeedback.cpp
mailnews/base/src/nsSpamSettings.cpp
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgProtocol.cpp
mailnews/base/util/nsMsgUtils.cpp
mailnews/compose/src/nsMsgAttachmentHandler.cpp
mailnews/compose/src/nsMsgPrompts.cpp
mailnews/compose/src/nsMsgSend.cpp
mailnews/compose/src/nsSmtpProtocol.cpp
mailnews/compose/src/nsSmtpProtocol.h
mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp
mailnews/extensions/mdn/src/nsMsgMdnGenerator.h
mailnews/extensions/smime/src/nsMsgComposeSecure.cpp
mailnews/extensions/smime/src/nsMsgComposeSecure.h
mailnews/imap/src/nsImapIncomingServer.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsImapService.cpp
mailnews/import/applemail/src/nsAppleMailImport.cpp
mailnews/import/becky/src/nsBeckyMail.cpp
mailnews/import/becky/src/nsBeckyStringBundle.cpp
mailnews/import/becky/src/nsBeckyStringBundle.h
mailnews/import/src/nsImportMail.cpp
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/local/src/nsMovemailService.cpp
mailnews/local/src/nsMovemailService.h
mailnews/local/src/nsParseMailbox.cpp
mailnews/local/src/nsPop3Protocol.cpp
mailnews/local/src/nsPop3Protocol.h
mailnews/local/src/nsPop3Service.cpp
mailnews/local/src/nsPop3Sink.cpp
mailnews/mapi/mapihook/src/msgMapiHook.cpp
mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
mailnews/news/src/nsNNTPNewsgroupList.cpp
mailnews/news/src/nsNNTPNewsgroupList.h
mailnews/news/src/nsNNTPProtocol.cpp
mailnews/news/src/nsNewsDownloader.cpp
mailnews/news/src/nsNewsFolder.cpp
mailnews/news/src/nsNntpIncomingServer.cpp
--- a/mailnews/addrbook/src/nsAbCardProperty.cpp
+++ b/mailnews/addrbook/src/nsAbCardProperty.cpp
@@ -1042,38 +1042,34 @@ nsresult nsAbCardProperty::AppendCitySta
   item.mColumn = zipPropName;
 
   rv = AppendLine(item, aConv, zipResult);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString formattedString;
 
   if (!cityResult.IsEmpty() && !stateResult.IsEmpty() && !zipResult.IsEmpty()) {
-    const char16_t *formatStrings[] = {cityResult.get(), stateResult.get(),
-                                       zipResult.get()};
+    AutoTArray<nsString, 3> formatStrings = {cityResult, stateResult,
+                                             zipResult};
     rv = aBundle->FormatStringFromName("cityAndStateAndZip", formatStrings,
-                                       ArrayLength(formatStrings),
                                        formattedString);
     NS_ENSURE_SUCCESS(rv, rv);
   } else if (!cityResult.IsEmpty() && !stateResult.IsEmpty() &&
              zipResult.IsEmpty()) {
-    const char16_t *formatStrings[] = {cityResult.get(), stateResult.get()};
+    AutoTArray<nsString, 2> formatStrings = {cityResult, stateResult};
     rv = aBundle->FormatStringFromName("cityAndStateNoZip", formatStrings,
-                                       ArrayLength(formatStrings),
                                        formattedString);
     NS_ENSURE_SUCCESS(rv, rv);
   } else if ((!cityResult.IsEmpty() && stateResult.IsEmpty() &&
               !zipResult.IsEmpty()) ||
              (cityResult.IsEmpty() && !stateResult.IsEmpty() &&
               !zipResult.IsEmpty())) {
-    const char16_t *formatStrings[] = {
-        cityResult.IsEmpty() ? stateResult.get() : cityResult.get(),
-        zipResult.get()};
+    AutoTArray<nsString, 2> formatStrings = {
+        cityResult.IsEmpty() ? stateResult : cityResult, zipResult};
     rv = aBundle->FormatStringFromName("cityOrStateAndZip", formatStrings,
-                                       ArrayLength(formatStrings),
                                        formattedString);
     NS_ENSURE_SUCCESS(rv, rv);
   } else {
     if (!cityResult.IsEmpty())
       formattedString = cityResult;
     else if (!stateResult.IsEmpty())
       formattedString = stateResult;
     else
@@ -1114,25 +1110,25 @@ NS_IMETHODIMP nsAbCardProperty::Generate
       rv = stringBundleService->CreateBundle(sAddrbookProperties,
                                              getter_AddRefs(bundle));
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     nsString result;
 
     if (aGenerateFormat == GENERATE_LAST_FIRST_ORDER) {
-      const char16_t *stringParams[2] = {lastName.get(), firstName.get()};
+      AutoTArray<nsString, 2> stringParams = {lastName, firstName};
 
-      rv = bundle->FormatStringFromName("lastFirstFormat", stringParams, 2,
-                                        result);
+      rv =
+          bundle->FormatStringFromName("lastFirstFormat", stringParams, result);
     } else {
-      const char16_t *stringParams[2] = {firstName.get(), lastName.get()};
+      AutoTArray<nsString, 2> stringParams = {firstName, lastName};
 
-      rv = bundle->FormatStringFromName("firstLastFormat", stringParams, 2,
-                                        result);
+      rv =
+          bundle->FormatStringFromName("firstLastFormat", stringParams, result);
     }
     NS_ENSURE_SUCCESS(rv, rv);
 
     aResult.Assign(result);
   }
 
   if (aResult.IsEmpty()) {
     // The normal names have failed, does this card have a company name? If so,
--- a/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
@@ -118,25 +118,24 @@ NS_IMETHODIMP nsAbLDAPListenerBase::OnLD
       InitFailed();
       return rv;
     }
 
     // hostTemp is only necessary to work around a code-generation
     // bug in egcs 1.1.2 (the version of gcc that comes with Red Hat 6.2),
     // which is the default compiler for Mozilla on linux at the moment.
     //
-    NS_ConvertASCIItoUTF16 hostTemp(host);
-    const char16_t *hostArray[1] = {hostTemp.get()};
+    AutoTArray<nsString, 1> hostArray;
+    CopyASCIItoUTF16(host, *hostArray.AppendElement());
 
     // format the hostname into the authprompt text string
     //
     nsString authPromptText;
-    rv = ldapBundle->FormatStringFromName(
-        "authPromptText", hostArray,
-        sizeof(hostArray) / sizeof(const char16_t *), authPromptText);
+    rv = ldapBundle->FormatStringFromName("authPromptText", hostArray,
+                                          authPromptText);
     if (NS_FAILED(rv)) {
       NS_ERROR(
           "nsAbLDAPListenerBase::OnLDAPInit():"
           "error getting 'authPromptText' string from bundle "
           "chrome://mozldap/locale/ldap.properties");
       InitFailed();
       return rv;
     }
--- a/mailnews/addrbook/src/nsAbManager.cpp
+++ b/mailnews/addrbook/src/nsAbManager.cpp
@@ -499,21 +499,21 @@ NS_IMETHODIMP nsAbManager::ExportAddress
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(
       "chrome://messenger/locale/addressbook/addressBook.properties",
       getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString dirName;
   aDirectory->GetDirName(dirName);
-  const char16_t *formatStrings[] = {dirName.get()};
+  AutoTArray<nsString, 1> formatStrings = {dirName};
 
   nsString title;
   rv = bundle->FormatStringFromName("ExportAddressBookNameTitle", formatStrings,
-                                    ArrayLength(formatStrings), title);
+                                    title);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = filePicker->Init(aParentWin, title, nsIFilePicker::modeSave);
   NS_ENSURE_SUCCESS(rv, rv);
 
   filePicker->SetDefaultString(dirName);
 
   nsString filterString;
--- a/mailnews/addrbook/src/nsAbView.cpp
+++ b/mailnews/addrbook/src/nsAbView.cpp
@@ -1235,35 +1235,33 @@ NS_IMETHODIMP nsAbView::SwapFirstNameLas
         if (!fn.IsEmpty() || !ln.IsEmpty()) {
           abCard->SetFirstName(ln);
           abCard->SetLastName(fn);
 
           // Generate display name using the new order
           if (displayNameAutoGeneration && !fn.IsEmpty() && !ln.IsEmpty()) {
             nsString dnLnFn;
             nsString dnFnLn;
-            const char16_t *nameString[2];
+            AutoTArray<nsString, 2> nameString;
             const char *formatString;
 
             // The format should stays the same before/after we swap the names
             formatString = displayNameLastnamefirst ? "lastFirstFormat"
                                                     : "firstLastFormat";
 
             // Generate both ln/fn and fn/ln combination since we need both
             // later to check to see if the current display name was edited note
             // that fn/ln still hold the values before the swap
-            nameString[0] = ln.get();
-            nameString[1] = fn.get();
-            rv = bundle->FormatStringFromName(formatString, nameString, 2,
-                                              dnLnFn);
+            nameString[0] = ln;
+            nameString[1] = fn;
+            rv = bundle->FormatStringFromName(formatString, nameString, dnLnFn);
             NS_ENSURE_SUCCESS(rv, rv);
             nameString[0] = fn.get();
             nameString[1] = ln.get();
-            rv = bundle->FormatStringFromName(formatString, nameString, 2,
-                                              dnFnLn);
+            rv = bundle->FormatStringFromName(formatString, nameString, dnFnLn);
             NS_ENSURE_SUCCESS(rv, rv);
 
             // Get the current display name
             nsAutoString dn;
             rv = abCard->GetDisplayName(dn);
             NS_ENSURE_SUCCESS(rv, rv);
 
             // Swap the display name if not edited
--- a/mailnews/addrbook/src/nsAddrDatabase.cpp
+++ b/mailnews/addrbook/src/nsAddrDatabase.cpp
@@ -298,17 +298,17 @@ NS_IMETHODIMP nsAddrDatabase::Open(nsIFi
   if (rv == NS_ERROR_FILE_ACCESS_DENIED) {
     static bool gAlreadyAlerted;
     // only do this once per session to avoid annoying the user
     if (!gAlreadyAlerted) {
       gAlreadyAlerted = true;
       nsAutoString mabFileName;
       rv = aMabFile->GetLeafName(mabFileName);
       NS_ENSURE_SUCCESS(rv, rv);
-      AlertAboutLockedMabFile(mabFileName.get());
+      AlertAboutLockedMabFile(mabFileName);
 
       // We just overwrote rv, so return the proper value here.
       return NS_ERROR_FILE_ACCESS_DENIED;
     }
   }
   // try one more time
   // but first rename corrupt mab file
   // and prompt the user
@@ -367,69 +367,68 @@ NS_IMETHODIMP nsAddrDatabase::Open(nsIFi
 
       if (NS_SUCCEEDED(rv)) {
         nsAutoString originalMabFileName;
         rv = aMabFile->GetLeafName(originalMabFileName);
         NS_ENSURE_SUCCESS(rv, rv);
 
         // if this fails, we don't care
         (void)AlertAboutCorruptMabFile(
-            originalMabFileName.get(),
-            NS_ConvertASCIItoUTF16(backupMabFileName).get());
+            originalMabFileName, NS_ConvertASCIItoUTF16(backupMabFileName));
       }
     }
   }
   return rv;
 }
 
 nsresult nsAddrDatabase::DisplayAlert(const char16_t *titleName,
                                       const char16_t *alertStringName,
-                                      const char16_t **formatStrings,
-                                      int32_t numFormatStrings) {
+                                      nsTArray<nsString> &formatStrings) {
   nsresult rv;
   nsCOMPtr<nsIStringBundleService> bundleService =
       mozilla::services::GetStringBundleService();
   NS_ENSURE_TRUE(bundleService, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(
       "chrome://messenger/locale/addressbook/addressBook.properties",
       getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString alertMessage;
-  rv = bundle->FormatStringFromName(
-      NS_ConvertUTF16toUTF8(alertStringName).get(), formatStrings,
-      numFormatStrings, alertMessage);
+  rv =
+      bundle->FormatStringFromName(NS_ConvertUTF16toUTF8(alertStringName).get(),
+                                   formatStrings, alertMessage);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString alertTitle;
   rv = bundle->GetStringFromName(NS_ConvertUTF16toUTF8(titleName).get(),
                                  alertTitle);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIPromptService> prompter =
       do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return prompter->Alert(nullptr /* we don't know the parent window */,
                          alertTitle.get(), alertMessage.get());
 }
 
 nsresult nsAddrDatabase::AlertAboutCorruptMabFile(
-    const char16_t *aOldFileName, const char16_t *aNewFileName) {
-  const char16_t *formatStrings[] = {aOldFileName, aOldFileName, aNewFileName};
+    const nsString &aOldFileName, const nsString &aNewFileName) {
+  AutoTArray<nsString, 3> formatStrings = {aOldFileName, aOldFileName,
+                                           aNewFileName};
   return DisplayAlert(u"corruptMabFileTitle", u"corruptMabFileAlert",
-                      formatStrings, 3);
+                      formatStrings);
 }
 
-nsresult nsAddrDatabase::AlertAboutLockedMabFile(const char16_t *aFileName) {
-  const char16_t *formatStrings[] = {aFileName};
+nsresult nsAddrDatabase::AlertAboutLockedMabFile(const nsString &aFileName) {
+  AutoTArray<nsString, 1> formatStrings = {aFileName};
   return DisplayAlert(u"lockedMabFileTitle", u"lockedMabFileAlert",
-                      formatStrings, 1);
+                      formatStrings);
 }
 
 nsresult nsAddrDatabase::OpenInternal(nsIFile *aMabFile, bool aCreate,
                                       nsIAddrDatabase **pAddrDB) {
   RefPtr<nsAddrDatabase> pAddressBookDB = new nsAddrDatabase();
 
   nsresult rv = pAddressBookDB->OpenMDB(aMabFile, aCreate);
   if (NS_SUCCEEDED(rv)) {
--- a/mailnews/addrbook/src/nsAddrDatabase.h
+++ b/mailnews/addrbook/src/nsAddrDatabase.h
@@ -517,18 +517,17 @@ class nsAddrDatabase : public nsIAddrDat
   nsresult GetRowForCharColumn(const char16_t *unicodeStr,
                                mdb_column findColumn, bool bIsCard,
                                bool aCaseInsensitive, nsIMdbRow **findRow,
                                mdb_pos *aRowPos);
   bool HasRowForCharColumn(const char16_t *unicodeStr, mdb_column findColumn,
                            bool aIsCard, nsIMdbRow **aFindRow);
   nsresult OpenInternal(nsIFile *aMabFile, bool aCreate,
                         nsIAddrDatabase **pCardDB);
-  nsresult AlertAboutCorruptMabFile(const char16_t *aOldFileName,
-                                    const char16_t *aNewFileName);
-  nsresult AlertAboutLockedMabFile(const char16_t *aFileName);
+  nsresult AlertAboutCorruptMabFile(const nsString &aOldFileName,
+                                    const nsString &aNewFileName);
+  nsresult AlertAboutLockedMabFile(const nsString &aFileName);
   nsresult DisplayAlert(const char16_t *titleName,
                         const char16_t *alertStringName,
-                        const char16_t **formatStrings,
-                        int32_t numFormatStrings);
+                        nsTArray<nsString> &formatStrings);
 };
 
 #endif
--- a/mailnews/base/search/src/nsMsgFilter.cpp
+++ b/mailnews/base/search/src/nsMsgFilter.cpp
@@ -507,55 +507,53 @@ nsresult nsMsgFilter::LogRuleHitGeneric(
       rv =
           bundle->GetStringFromName(PromiseFlatCString(aErrmsg).get(), tErrmsg);
       if (NS_FAILED(rv)) tErrmsg.Assign(NS_ConvertUTF8toUTF16(aErrmsg));
     } else {
       // The addon creating the custom action should have passed a localized
       // string.
       tErrmsg.Assign(NS_ConvertUTF8toUTF16(aErrmsg));
     }
-    const char16_t *logErrorFormatStrings[2] = {tErrmsg.get(), tcode16.get()};
+    AutoTArray<nsString, 2> logErrorFormatStrings = {tErrmsg, tcode16};
 
     nsString filterFailureWarningPrefix;
     rv = bundle->FormatStringFromName("filterFailureWarningPrefix",
-                                      logErrorFormatStrings, 2,
+                                      logErrorFormatStrings,
                                       filterFailureWarningPrefix);
     NS_ENSURE_SUCCESS(rv, rv);
     buffer += filterFailureWarningPrefix;
     buffer.AppendLiteral("\n");
   }
 
-  const char16_t *filterLogDetectFormatStrings[4] = {
-      filterName.get(), authorValue.get(), subjectValue.get(), dateValue.get()};
+  AutoTArray<nsString, 4> filterLogDetectFormatStrings = {
+      filterName, authorValue, subjectValue, dateValue};
   nsString filterLogDetectStr;
-  rv = bundle->FormatStringFromName("filterLogDetectStr",
-                                    filterLogDetectFormatStrings, 4,
-                                    filterLogDetectStr);
+  rv = bundle->FormatStringFromName(
+      "filterLogDetectStr", filterLogDetectFormatStrings, filterLogDetectStr);
   NS_ENSURE_SUCCESS(rv, rv);
 
   buffer += filterLogDetectStr;
   buffer.AppendLiteral("\n");
 
   if (actionType == nsMsgFilterAction::MoveToFolder ||
       actionType == nsMsgFilterAction::CopyToFolder) {
     nsCString actionFolderUri;
     aFilterAction->GetTargetFolderUri(actionFolderUri);
-    NS_ConvertASCIItoUTF16 actionFolderUriValue(actionFolderUri);
 
     nsCString msgId;
     aMsgHdr->GetMessageId(getter_Copies(msgId));
-    NS_ConvertASCIItoUTF16 msgIdValue(msgId);
 
-    const char16_t *logMoveFormatStrings[2] = {msgIdValue.get(),
-                                               actionFolderUriValue.get()};
+    AutoTArray<nsString, 2> logMoveFormatStrings;
+    CopyUTF8toUTF16(msgId, *logMoveFormatStrings.AppendElement());
+    CopyUTF8toUTF16(actionFolderUri, *logMoveFormatStrings.AppendElement());
     nsString logMoveStr;
     rv = bundle->FormatStringFromName(
         (actionType == nsMsgFilterAction::MoveToFolder) ? "logMoveStr"
                                                         : "logCopyStr",
-        logMoveFormatStrings, 2, logMoveStr);
+        logMoveFormatStrings, logMoveStr);
     NS_ENSURE_SUCCESS(rv, rv);
 
     buffer += logMoveStr;
   } else if (actionType == nsMsgFilterAction::Custom) {
     nsCOMPtr<nsIMsgFilterCustomAction> customAction;
     nsAutoString filterActionName;
     rv = aFilterAction->GetCustomAction(getter_AddRefs(customAction));
     if (NS_SUCCEEDED(rv) && customAction)
--- a/mailnews/base/search/src/nsMsgFilterList.cpp
+++ b/mailnews/base/search/src/nsMsgFilterList.cpp
@@ -1161,19 +1161,19 @@ NS_IMETHODIMP nsMsgFilterList::LogFilter
 
   nsString tempMessage(message);
 
   if (filter) {
     // If a filter was passed, prepend its name in the log message.
     nsString filterName;
     filter->GetFilterName(filterName);
 
-    const char16_t *logFormatStrings[2] = {filterName.get(), tempMessage.get()};
+    AutoTArray<nsString, 2> logFormatStrings = {filterName, tempMessage};
     nsString statusLogMessage;
-    rv = bundle->FormatStringFromName("filterMessage", logFormatStrings, 2,
+    rv = bundle->FormatStringFromName("filterMessage", logFormatStrings,
                                       statusLogMessage);
     if (NS_SUCCEEDED(rv)) tempMessage.Assign(statusLogMessage);
   }
 
   // Prepare timestamp
   PRExplodedTime exploded;
   nsString dateValue;
   PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &exploded);
@@ -1181,22 +1181,22 @@ NS_IMETHODIMP nsMsgFilterList::LogFilter
                                                 mozilla::kTimeFormatSeconds,
                                                 &exploded, dateValue);
 
   // HTML-escape the log for security reasons.
   // We don't want someone to send us a message with a subject with
   // HTML tags, especially <script>.
   nsCString escapedBuffer;
   nsAppendEscapedHTML(NS_ConvertUTF16toUTF8(tempMessage), escapedBuffer);
-  NS_ConvertUTF8toUTF16 finalMessage(escapedBuffer);
 
   // Print timestamp and the message.
-  const char16_t *logFormatStrings[2] = {dateValue.get(), finalMessage.get()};
+  AutoTArray<nsString, 2> logFormatStrings = {dateValue};
+  CopyUTF8toUTF16(escapedBuffer, *logFormatStrings.AppendElement());
   nsString filterLogMessage;
-  rv = bundle->FormatStringFromName("filterLogLine", logFormatStrings, 2,
+  rv = bundle->FormatStringFromName("filterLogLine", logFormatStrings,
                                     filterLogMessage);
 
   // Write message into log stream.
   uint32_t writeCount;
 
   rv = logStream->Write(LOG_ENTRY_START_TAG, LOG_ENTRY_START_TAG_LEN,
                         &writeCount);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/base/search/src/nsMsgFilterService.cpp
+++ b/mailnews/base/search/src/nsMsgFilterService.cpp
@@ -1341,19 +1341,19 @@ bool nsMsgFilterAfterTheFact::ContinueEx
   if (!bundleService) return false;
   bundleService->CreateBundle("chrome://messenger/locale/filter.properties",
                               getter_AddRefs(bundle));
   if (!bundle) return false;
   nsString filterName;
   m_curFilter->GetFilterName(filterName);
   nsString formatString;
   nsString confirmText;
-  const char16_t *formatStrings[] = {filterName.get()};
+  AutoTArray<nsString, 1> formatStrings = {filterName};
   nsresult rv = bundle->FormatStringFromName("continueFilterExecution",
-                                             formatStrings, 1, confirmText);
+                                             formatStrings, confirmText);
   if (NS_FAILED(rv)) return false;
   bool returnVal = false;
   (void)DisplayConfirmationPrompt(m_msgWindow, confirmText.get(), &returnVal);
   return returnVal;
 }
 
 nsresult nsMsgFilterAfterTheFact::DisplayConfirmationPrompt(
     nsIMsgWindow *msgWindow, const char16_t *confirmString, bool *confirmed) {
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -329,23 +329,23 @@ nsresult nsMessenger::PromptIfFileExists
 
   nsCOMPtr<nsIPrompt> dialog(do_GetInterface(mDocShell));
   if (!dialog) return rv;
   nsAutoString path;
   bool dialogResult = false;
   nsString errorMessage;
 
   file->GetPath(path);
-  const char16_t *pathFormatStrings[] = {path.get()};
+  AutoTArray<nsString, 1> pathFormatStrings = {path};
 
   if (!mStringBundle) {
     rv = InitStringBundle();
     NS_ENSURE_SUCCESS(rv, rv);
   }
-  rv = mStringBundle->FormatStringFromName("fileExists", pathFormatStrings, 1,
+  rv = mStringBundle->FormatStringFromName("fileExists", pathFormatStrings,
                                            errorMessage);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = dialog->Confirm(nullptr, errorMessage.get(), &dialogResult);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (dialogResult) return NS_OK;  // user says okay to replace
 
   // if we don't re-init the path for redisplay the picker will
@@ -789,18 +789,18 @@ nsresult nsMessenger::SaveOneAttachment(
     extension = Substring(defaultDisplayString, extensionIndex + 1);
     filePicker->SetDefaultExtension(extension);
     if (!mStringBundle) {
       rv = InitStringBundle();
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     nsString filterName;
-    const char16_t *extensionParam[] = {extension.get()};
-    rv = mStringBundle->FormatStringFromName("saveAsType", extensionParam, 1,
+    AutoTArray<nsString, 1> extensionParam = {extension};
+    rv = mStringBundle->FormatStringFromName("saveAsType", extensionParam,
                                              filterName);
     NS_ENSURE_SUCCESS(rv, rv);
 
     extension.InsertLiteral(u"*.", 0);
     filePicker->AppendFilter(filterName, extension);
   }
 
   filePicker->AppendFilters(nsIFilePicker::filterAll);
@@ -2762,23 +2762,23 @@ nsresult nsMessenger::PromptIfDeleteAtta
   // create the list of attachments we are removing
   nsString displayString;
   nsString attachmentList;
   for (uint32_t u = 0; u < aCount; ++u) {
     ConvertAndSanitizeFileName(aDisplayNameArray[u], displayString);
     attachmentList.Append(displayString);
     attachmentList.Append(char16_t('\n'));
   }
-  const char16_t *formatStrings[] = {attachmentList.get()};
+  AutoTArray<nsString, 1> formatStrings = {attachmentList};
 
   // format the message and display
   nsString promptMessage;
   const char *propertyName =
       aSaveFirst ? "detachAttachments" : "deleteAttachments";
-  rv = mStringBundle->FormatStringFromName(propertyName, formatStrings, 1,
+  rv = mStringBundle->FormatStringFromName(propertyName, formatStrings,
                                            promptMessage);
   NS_ENSURE_SUCCESS(rv, rv);
 
   bool dialogResult = false;
   rv = dialog->Confirm(nullptr, promptMessage.get(), &dialogResult);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return dialogResult ? NS_OK : NS_ERROR_FAILURE;
--- a/mailnews/base/src/nsMessengerUnixIntegration.cpp
+++ b/mailnews/base/src/nsMessengerUnixIntegration.cpp
@@ -157,22 +157,22 @@ bool nsMessengerUnixIntegration::BuildNo
   int32_t numNewMessages = 0;
   aFolder->GetNumNewMessages(true, &numNewMessages);
 
   if (!numNewMessages) return false;
 
   nsAutoString numNewMsgsText;
   numNewMsgsText.AppendInt(numNewMessages);
 
-  const char16_t *formatStrings[] = {accountName.get(), numNewMsgsText.get()};
+  AutoTArray<nsString, 2> formatStrings = {accountName, numNewMsgsText};
 
   aBundle->FormatStringFromName(numNewMessages == 1
                                     ? "newMailNotification_message"
                                     : "newMailNotification_messages",
-                                formatStrings, 2, aTitle);
+                                formatStrings, aTitle);
   return true;
 }
 
 /* This comparator lets us sort an nsCOMArray of nsIMsgDBHdr's by
  * their dateInSeconds attributes in ascending order.
  */
 static int nsMsgDbHdrTimestampComparator(nsIMsgDBHdr *aElement1,
                                          nsIMsgDBHdr *aElement2, void *aData) {
@@ -257,19 +257,19 @@ bool nsMessengerUnixIntegration::BuildNo
     nsString fullHeader;
     if (NS_FAILED(aHdr->GetMime2DecodedAuthor(fullHeader))) return false;
 
     ExtractName(DecodedHeader(fullHeader), author);
   }
 
   if (showSubject && showSender) {
     nsString msgTitle;
-    const char16_t *formatStrings[] = {subject.get(), author.get()};
+    AutoTArray<nsString, 2> formatStrings = {subject, author};
     aBundle->FormatStringFromName("newMailNotification_messagetitle",
-                                  formatStrings, 2, msgTitle);
+                                  formatStrings, msgTitle);
     alertBody.Append(msgTitle);
   } else if (showSubject)
     alertBody.Append(subject);
   else if (showSender)
     alertBody.Append(author);
 
   if (showPreview && (showSubject || showSender)) {
     alertBody.AppendLiteral("\n");
--- a/mailnews/base/src/nsMessengerWinIntegration.cpp
+++ b/mailnews/base/src/nsMessengerWinIntegration.cpp
@@ -636,27 +636,25 @@ void nsMessengerWinIntegration::FillTool
       numNewMessages = 0;
       folder->GetNumNewMessages(true, &numNewMessages);
       nsCOMPtr<nsIStringBundle> bundle;
       GetStringBundle(getter_AddRefs(bundle));
       if (bundle) {
         nsAutoString numNewMsgsText;
         numNewMsgsText.AppendInt(numNewMessages);
 
-        const char16_t *formatStrings[] = {
-            numNewMsgsText.get(),
-        };
+        AutoTArray<nsString, 1> formatStrings = {numNewMsgsText};
 
         nsString finalText;
         if (numNewMessages == 1)
           bundle->FormatStringFromName("biffNotification_message",
-                                       formatStrings, 1, finalText);
+                                       formatStrings, finalText);
         else
           bundle->FormatStringFromName("biffNotification_messages",
-                                       formatStrings, 1, finalText);
+                                       formatStrings, finalText);
 
         // the alert message is special...we actually only want to show the
         // first account with new mail in the alert.
         if (animatedAlertText.IsEmpty())  // if we haven't filled in the
                                           // animated alert text yet
           animatedAlertText = finalText;
 
         toolTipLine.Append(accountName);
--- a/mailnews/base/src/nsMsgFolderCompactor.cpp
+++ b/mailnews/base/src/nsMsgFolderCompactor.cpp
@@ -303,19 +303,18 @@ nsresult nsFolderCompactState::ShowStatu
     rv = m_folder->GetServer(getter_AddRefs(server));
     if (NS_FAILED(rv)) break;
     nsAutoString accountName;
     rv = server->GetPrettyName(accountName);
     if (NS_FAILED(rv)) break;
     nsCOMPtr<nsIStringBundle> bundle;
     rv = GetBaseStringBundle(getter_AddRefs(bundle));
     if (NS_FAILED(rv)) break;
-    const char16_t *params[] = {accountName.get(), aMsg.get()};
-    rv =
-        bundle->FormatStringFromName("statusMessage", params, 2, statusMessage);
+    AutoTArray<nsString, 2> params = {accountName, aMsg};
+    rv = bundle->FormatStringFromName("statusMessage", params, statusMessage);
   } while (false);
 
   // If fetching any of the needed info failed, just show the original message.
   if (NS_FAILED(rv)) statusMessage.Assign(aMsg);
   return statusFeedback->SetStatusString(statusMessage);
 }
 
 nsresult nsFolderCompactState::Init(nsIMsgFolder *folder,
@@ -624,19 +623,18 @@ nsresult nsFolderCompactState::ReleaseFo
 void nsFolderCompactState::ShowDoneStatus() {
   if (m_folder) {
     nsString statusString;
     nsCOMPtr<nsIStringBundle> bundle;
     nsresult rv = GetBaseStringBundle(getter_AddRefs(bundle));
     NS_ENSURE_SUCCESS_VOID(rv);
     nsAutoString expungedAmount;
     FormatFileSize(m_totalExpungedBytes, true, expungedAmount);
-    const char16_t *params[] = {expungedAmount.get()};
-    rv =
-        bundle->FormatStringFromName("compactingDone", params, 1, statusString);
+    AutoTArray<nsString, 1> params = {expungedAmount};
+    rv = bundle->FormatStringFromName("compactingDone", params, statusString);
 
     if (!statusString.IsEmpty() && NS_SUCCEEDED(rv))
       ShowStatusMsg(statusString);
   }
 }
 
 nsresult nsFolderCompactState::CompactNextFolder() {
   m_folderIndex++;
--- a/mailnews/base/src/nsMsgStatusFeedback.cpp
+++ b/mailnews/base/src/nsMsgStatusFeedback.cpp
@@ -256,17 +256,16 @@ NS_IMETHODIMP nsMsgStatusFeedback::OnSta
   NS_ENSURE_SUCCESS(rv, rv);
 
   // prefixing the account name to the status message if status message isn't
   // blank and doesn't already contain the account name.
   nsString statusMessage;
   if (!str.IsEmpty() && str.Find(accountName) == kNotFound) {
     nsCOMPtr<nsIStringBundle> bundle;
     rv = sbs->CreateBundle(MSGS_URL, getter_AddRefs(bundle));
-    const char16_t* params[] = {accountName.get(), str.get()};
-    rv =
-        bundle->FormatStringFromName("statusMessage", params, 2, statusMessage);
+    AutoTArray<nsString, 2> params = {accountName, str};
+    rv = bundle->FormatStringFromName("statusMessage", params, statusMessage);
     NS_ENSURE_SUCCESS(rv, rv);
   } else {
     statusMessage.Assign(str);
   }
   return ShowStatusString(statusMessage);
 }
--- a/mailnews/base/src/nsSpamSettings.cpp
+++ b/mailnews/base/src/nsSpamSettings.cpp
@@ -631,41 +631,39 @@ NS_IMETHODIMP nsSpamSettings::LogJunkHit
       mozilla::services::GetStringBundleService();
   NS_ENSURE_TRUE(bundleService, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(
       "chrome://messenger/locale/filter.properties", getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  const char16_t *junkLogDetectFormatStrings[3] = {
-      authorValue.get(), subjectValue.get(), dateValue.get()};
+  AutoTArray<nsString, 3> junkLogDetectFormatStrings = {
+      authorValue, subjectValue, dateValue};
   nsString junkLogDetectStr;
   rv = bundle->FormatStringFromName(
-      "junkLogDetectStr", junkLogDetectFormatStrings, 3, junkLogDetectStr);
+      "junkLogDetectStr", junkLogDetectFormatStrings, junkLogDetectStr);
   NS_ENSURE_SUCCESS(rv, rv);
 
   buffer += NS_ConvertUTF16toUTF8(junkLogDetectStr);
   buffer += "\n";
 
   if (aMoveMessage) {
     nsCString msgId;
     aMsgHdr->GetMessageId(getter_Copies(msgId));
 
     nsCString junkFolderURI;
     rv = GetSpamFolderURI(getter_Copies(junkFolderURI));
     NS_ENSURE_SUCCESS(rv, rv);
 
-    NS_ConvertASCIItoUTF16 msgIdValue(msgId);
-    NS_ConvertASCIItoUTF16 junkFolderURIValue(junkFolderURI);
-
-    const char16_t *logMoveFormatStrings[2] = {msgIdValue.get(),
-                                               junkFolderURIValue.get()};
+    AutoTArray<nsString, 2> logMoveFormatStrings;
+    CopyASCIItoUTF16(msgId, *logMoveFormatStrings.AppendElement());
+    CopyASCIItoUTF16(junkFolderURI, *logMoveFormatStrings.AppendElement());
     nsString logMoveStr;
-    rv = bundle->FormatStringFromName("logMoveStr", logMoveFormatStrings, 2,
+    rv = bundle->FormatStringFromName("logMoveStr", logMoveFormatStrings,
                                       logMoveStr);
     NS_ENSURE_SUCCESS(rv, rv);
 
     buffer += NS_ConvertUTF16toUTF8(logMoveStr);
     buffer += "\n";
   }
 
   return LogJunkString(buffer.get());
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -1759,22 +1759,22 @@ nsresult nsMsgDBFolder::HandleAutoCompac
           rv = GetBaseStringBundle(getter_AddRefs(bundle));
           NS_ENSURE_SUCCESS(rv, rv);
           nsString dialogTitle;
           nsString confirmString;
           nsString checkboxText;
           nsString buttonCompactNowText;
           nsAutoString compactSize;
           FormatFileSize(totalExpungedBytes, true, compactSize);
-          const char16_t *params[] = {compactSize.get()};
+          AutoTArray<nsString, 1> params = {compactSize};
           rv = bundle->GetStringFromName("autoCompactAllFoldersTitle",
                                          dialogTitle);
           NS_ENSURE_SUCCESS(rv, rv);
           rv = bundle->FormatStringFromName("autoCompactAllFoldersText", params,
-                                            1, confirmString);
+                                            confirmString);
           NS_ENSURE_SUCCESS(rv, rv);
           rv = bundle->GetStringFromName("autoCompactAlwaysAskCheckbox",
                                          checkboxText);
           NS_ENSURE_SUCCESS(rv, rv);
           rv = bundle->GetStringFromName("compactNowButton",
                                          buttonCompactNowText);
           NS_ENSURE_SUCCESS(rv, rv);
           bool alwaysAsk = true;  // "Always ask..." - checked by default.
@@ -3576,22 +3576,21 @@ bool nsMsgDBFolder::ConfirmAutoFolderRen
   nsCOMPtr<nsIStringBundle> bundle;
   nsresult rv = GetBaseStringBundle(getter_AddRefs(bundle));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
   }
 
   nsString folderName;
   GetName(folderName);
-  const char16_t *formatStrings[] = {aOldName.get(), folderName.get(),
-                                     aNewName.get()};
+  AutoTArray<nsString, 3> formatStrings = {aOldName, folderName, aNewName};
 
   nsString confirmString;
   rv = bundle->FormatStringFromName("confirmDuplicateFolderRename",
-                                    formatStrings, 3, confirmString);
+                                    formatStrings, confirmString);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
   }
 
   bool confirmed = false;
   rv = ThrowConfirmationPrompt(msgWindow, confirmString, &confirmed);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
@@ -4810,21 +4809,20 @@ nsresult nsMsgDBFolder::ThrowConfirmatio
 NS_IMETHODIMP
 nsMsgDBFolder::GetStringWithFolderNameFromBundle(const char *msgName,
                                                  nsAString &aResult) {
   nsCOMPtr<nsIStringBundle> bundle;
   nsresult rv = GetBaseStringBundle(getter_AddRefs(bundle));
   if (NS_SUCCEEDED(rv) && bundle) {
     nsString folderName;
     GetName(folderName);
-    const char16_t *formatStrings[] = {folderName.get(),
-                                       kLocalizedBrandShortName.get()};
-
+    AutoTArray<nsString, 2> formatStrings = {folderName,
+                                             kLocalizedBrandShortName};
     nsString resultStr;
-    rv = bundle->FormatStringFromName(msgName, formatStrings, 2, resultStr);
+    rv = bundle->FormatStringFromName(msgName, formatStrings, resultStr);
     if (NS_SUCCEEDED(rv)) aResult.Assign(resultStr);
   }
   return rv;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::ConfirmFolderDeletionForFilter(
     nsIMsgWindow *msgWindow, bool *confirmed) {
   nsString confirmString;
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -1454,19 +1454,19 @@ char16_t *FormatStringWithHostNameByName
   nsCOMPtr<nsIMsgIncomingServer> server;
   rv = msgUri->GetServer(getter_AddRefs(server));
   NS_ENSURE_SUCCESS(rv, nullptr);
 
   nsCString hostName;
   rv = server->GetRealHostName(hostName);
   NS_ENSURE_SUCCESS(rv, nullptr);
 
-  NS_ConvertASCIItoUTF16 hostStr(hostName);
-  const char16_t *params[] = {hostStr.get()};
+  AutoTArray<nsString, 1> params;
+  CopyASCIItoUTF16(hostName, *params.AppendElement());
   nsAutoString str;
   rv = sBundle->FormatStringFromName(NS_ConvertUTF16toUTF8(stringName).get(),
-                                     params, 1, str);
+                                     params, str);
   NS_ENSURE_SUCCESS(rv, nullptr);
 
   return ToNewUnicode(str);
 }
 
 // vim: ts=2 sw=2
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -1594,32 +1594,32 @@ NS_MSG_BASE nsresult MsgPromptLoginFaile
   NS_ENSURE_TRUE(bundleSvc, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleSvc->CreateBundle("chrome://messenger/locale/messenger.properties",
                                getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString message;
-  NS_ConvertUTF8toUTF16 hostNameUTF16(aHostname);
-  NS_ConvertUTF8toUTF16 userNameUTF16(aUsername);
-  const char16_t *formatStrings[] = {hostNameUTF16.get(), userNameUTF16.get()};
+  AutoTArray<nsString, 2> formatStrings;
+  CopyUTF8toUTF16(aHostname, *formatStrings.AppendElement());
+  CopyUTF8toUTF16(aUsername, *formatStrings.AppendElement());
 
-  rv = bundle->FormatStringFromName("mailServerLoginFailed2", formatStrings, 2,
+  rv = bundle->FormatStringFromName("mailServerLoginFailed2", formatStrings,
                                     message);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString title;
   if (aAccountname.IsEmpty()) {
     // Account name may be empty e.g. on a SMTP server.
     rv = bundle->GetStringFromName("mailServerLoginFailedTitle", title);
   } else {
-    const char16_t *formatStrings[] = {aAccountname.BeginReading()};
+    AutoTArray<nsString, 1> formatStrings = {nsString(aAccountname)};
     rv = bundle->FormatStringFromName("mailServerLoginFailedTitleWithAccount",
-                                      formatStrings, 1, title);
+                                      formatStrings, title);
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString button0;
   rv = bundle->GetStringFromName("mailServerLoginFailedRetryButton", button0);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString button2;
--- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp
@@ -1022,25 +1022,25 @@ nsresult nsMsgAttachmentHandler::UrlExit
       MsgUnescapeString(turl, 0, unescapedUrl);
       if (unescapedUrl.IsEmpty())
         params = turl;
       else
         params = unescapedUrl;
     } else
       params.Assign('?');
 
-    NS_ConvertUTF8toUTF16 UTF16params(params);
-    const char16_t *formatParams[] = {UTF16params.get()};
+    AutoTArray<nsString, 1> formatParams;
+    CopyUTF8toUTF16(params, *formatParams.AppendElement());
     if (mode == nsIMsgSend::nsMsgSaveAsDraft ||
         mode == nsIMsgSend::nsMsgSaveAsTemplate)
       bundle->FormatStringFromName("failureOnObjectEmbeddingWhileSaving",
-                                   formatParams, 1, msg);
+                                   formatParams, msg);
     else
       bundle->FormatStringFromName("failureOnObjectEmbeddingWhileSending",
-                                   formatParams, 1, msg);
+                                   formatParams, msg);
 
     nsCOMPtr<nsIPrompt> aPrompt;
     if (m_mime_delivery_state)
       m_mime_delivery_state->GetDefaultPrompt(getter_AddRefs(aPrompt));
     nsMsgAskBooleanQuestionByString(aPrompt, msg.get(), &keepOnGoing);
 
     if (keepOnGoing) {
       status = NS_OK;
--- a/mailnews/compose/src/nsMsgPrompts.cpp
+++ b/mailnews/compose/src/nsMsgPrompts.cpp
@@ -41,18 +41,18 @@ static nsresult nsMsgBuildMessageByName(
   rv = bundleService->CreateBundle(
       "chrome://messenger/locale/messengercompose/composeMsgs.properties",
       getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString path;
   aFile->GetPath(path);
 
-  const char16_t *params[1] = {path.get()};
-  return bundle->FormatStringFromName(aName, params, 1, aResult);
+  AutoTArray<nsString, 1> params = {path};
+  return bundle->FormatStringFromName(aName, params, aResult);
 }
 
 nsresult nsMsgBuildMessageWithFile(nsIFile *aFile, nsString &aResult) {
   return nsMsgBuildMessageByName("unableToOpenFile", aFile, aResult);
 }
 
 nsresult nsMsgBuildMessageWithTmpFile(nsIFile *aFile, nsString &aResult) {
   return nsMsgBuildMessageByName("unableToOpenTmpFile", aFile, aResult);
--- a/mailnews/compose/src/nsMsgSend.cpp
+++ b/mailnews/compose/src/nsMsgSend.cpp
@@ -2216,46 +2216,46 @@ nsresult nsMsgComposeAndSend::HackAttach
       //
       // This only returns a failure code if NET_GetURL was not called
       // (and thus no exit routine was or will be called.)
       //
 
       // Display some feedback to user...
       nsString msg;
       nsAutoString attachmentFileName;
-      NS_ConvertUTF8toUTF16 params(m_attachments[i]->m_realName);
-      const char16_t *formatParams[1];
-      if (!params.IsEmpty()) {
-        formatParams[0] = params.get();
+      AutoTArray<nsString, 1> formatParams;
+      if (!(m_attachments[i]->m_realName).IsEmpty()) {
+        CopyUTF8toUTF16(m_attachments[i]->m_realName,
+                        *formatParams.AppendElement());
       } else if (m_attachments[i]->mURL) {
         nsCString asciiSpec;
         m_attachments[i]->mURL->GetAsciiSpec(asciiSpec);
         attachmentFileName.AssignASCII(asciiSpec.get());
-        formatParams[0] = attachmentFileName.get();
+        formatParams[0] = attachmentFileName;
       }
       mComposeBundle->FormatStringFromName("gatheringAttachment", formatParams,
-                                           1, msg);
+                                           msg);
 
       if (!msg.IsEmpty()) {
         SetStatusMessage(msg);
       }
 
       /* As SnarfAttachment will call GatherMimeAttachments when it will be done
          (this is an async process), we need to avoid to call it ourself.
       */
       needToCallGatherMimeAttachments = false;
 
       nsresult status = m_attachments[i]->SnarfAttachment(mCompFields);
       if (NS_FAILED(status)) {
         nsString errorMsg;
         NS_CopyNativeToUnicode(m_attachments[i]->m_realName,
                                attachmentFileName);
         nsCOMPtr<nsIStringBundle> bundle;
-        const char16_t *params[] = {attachmentFileName.get()};
-        mComposeBundle->FormatStringFromName("errorAttachingFile", params, 1,
+        AutoTArray<nsString, 1> params = {attachmentFileName};
+        mComposeBundle->FormatStringFromName("errorAttachingFile", params,
                                              errorMsg);
         mSendReport->SetMessage(nsIMsgSendReport::process_Current,
                                 errorMsg.get(), false);
         mSendReport->SetError(nsIMsgSendReport::process_Current,
                               NS_MSG_ERROR_ATTACHING_FILE, false);
         return NS_MSG_ERROR_ATTACHING_FILE;
       }
       if (m_be_synchronous_p) break;
@@ -2873,18 +2873,18 @@ nsresult nsMsgComposeAndSend::DeliverMes
   if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
 
   if ((mMessageWarningSize > 0) && (fileSize > mMessageWarningSize) &&
       (mGUINotificationEnabled)) {
     bool abortTheSend = false;
     nsString msg;
     nsAutoString formattedFileSize;
     FormatFileSize(fileSize, true, formattedFileSize);
-    const char16_t *params[] = {formattedFileSize.get()};
-    mComposeBundle->FormatStringFromName("largeMessageSendWarning", params, 1,
+    AutoTArray<nsString, 1> params = {formattedFileSize};
+    mComposeBundle->FormatStringFromName("largeMessageSendWarning", params,
                                          msg);
 
     if (!msg.IsEmpty()) {
       nsCOMPtr<nsIPrompt> prompt;
       rv = GetDefaultPrompt(getter_AddRefs(prompt));
       NS_ENSURE_SUCCESS(rv, rv);
       nsMsgAskBooleanQuestionByString(prompt, msg.get(), &abortTheSend);
       if (!abortTheSend) {
@@ -3139,21 +3139,20 @@ nsresult nsMsgComposeAndSend::FormatStri
 
   // Get the smtp hostname and format the string.
   nsCString smtpHostName;
   nsCOMPtr<nsISmtpServer> smtpServer;
   rv = smtpService->GetServerByIdentity(mUserIdentity,
                                         getter_AddRefs(smtpServer));
   if (NS_SUCCEEDED(rv)) smtpServer->GetHostname(smtpHostName);
 
-  nsAutoString hostStr;
-  CopyASCIItoUTF16(smtpHostName, hostStr);
-  const char16_t *params[] = {hostStr.get()};
+  AutoTArray<nsString, 1> params;
+  CopyASCIItoUTF16(smtpHostName, *params.AppendElement());
   if (NS_SUCCEEDED(rv))
-    mComposeBundle->FormatStringFromName(aMsgName, params, 1, aString);
+    mComposeBundle->FormatStringFromName(aMsgName, params, aString);
   return rv;
 }
 
 void nsMsgComposeAndSend::DoDeliveryExitProcessing(nsIURI *aUri,
                                                    nsresult aExitCode,
                                                    bool aCheckForMail) {
   // If we fail on the news delivery, no sense in going on so just notify
   // the user and exit.
@@ -3468,34 +3467,33 @@ nsMsgComposeAndSend::NotifyListenerOnSto
     } else
       rv = NS_ERROR_FAILURE;
     if (NS_FAILED(rv) || accountName.IsEmpty()) {
       // Unable to obtain accountName.
       Fail(NS_OK, nullptr, &aStatus);
       return NS_ERROR_FAILURE;
     }
 
-    const char16_t *formatStrings[] = {mSavedToFolderName.get(),
-                                       accountName.get(),
-                                       localFoldersAccountName.get()};
+    AutoTArray<nsString, 3> formatStrings = {mSavedToFolderName, accountName,
+                                             localFoldersAccountName};
 
     nsString msg;
     switch (m_deliver_mode) {
       case nsMsgDeliverNow:
       case nsMsgSendUnsent:
         rv = bundle->FormatStringFromName("promptToSaveSentLocally2",
-                                          formatStrings, 3, msg);
+                                          formatStrings, msg);
         break;
       case nsMsgSaveAsDraft:
         rv = bundle->FormatStringFromName("promptToSaveDraftLocally2",
-                                          formatStrings, 3, msg);
+                                          formatStrings, msg);
         break;
       case nsMsgSaveAsTemplate:
         rv = bundle->FormatStringFromName("promptToSaveTemplateLocally2",
-                                          formatStrings, 3, msg);
+                                          formatStrings, msg);
         break;
       default:
         rv = NS_ERROR_UNEXPECTED;
     }
     NS_ENSURE_SUCCESS(rv, rv);
     int32_t buttonPressed = 0;
     bool showCheckBox = false;
     uint32_t buttonFlags =
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -2144,58 +2144,55 @@ nsresult nsSmtpProtocol::GetPassword(nsS
   nsCOMPtr<nsIPrefBranch> prefBranch;
   rv = prefs->GetBranch(nullptr, getter_AddRefs(prefBranch));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCString username;
   rv = smtpServer->GetUsername(username);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NS_ConvertASCIItoUTF16 usernameUTF16(username);
-
   nsCString hostname;
   rv = smtpServer->GetHostname(hostname);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsAutoString hostnameUTF16;
-  CopyASCIItoUTF16(hostname, hostnameUTF16);
-
-  const char16_t *formatStrings[] = {hostnameUTF16.get(), usernameUTF16.get()};
+  AutoTArray<nsString, 2> formatStrings;
+  CopyASCIItoUTF16(hostname, *formatStrings.AppendElement());
+  CopyASCIItoUTF16(username, *formatStrings.AppendElement());
 
   rv = PromptForPassword(smtpServer, smtpUrl, formatStrings, aPassword);
   NS_ENSURE_SUCCESS(rv, rv);
   return rv;
 }
 
 /**
  * formatStrings is an array for the prompts, item 0 is the hostname, item 1
  * is the username.
  */
 nsresult nsSmtpProtocol::PromptForPassword(nsISmtpServer *aSmtpServer,
                                            nsISmtpUrl *aSmtpUrl,
-                                           const char16_t **formatStrings,
+                                           nsTArray<nsString> &formatStrings,
                                            nsAString &aPassword) {
   nsCOMPtr<nsIStringBundleService> stringService =
       mozilla::services::GetStringBundleService();
   NS_ENSURE_TRUE(stringService, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIStringBundle> composeStringBundle;
   nsresult rv = stringService->CreateBundle(
       "chrome://messenger/locale/messengercompose/composeMsgs.properties",
       getter_AddRefs(composeStringBundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString passwordPromptString;
-  if (formatStrings[1])
+  if (formatStrings.Length() > 1)
     rv = composeStringBundle->FormatStringFromName(
-        "smtpEnterPasswordPromptWithUsername", formatStrings, 2,
+        "smtpEnterPasswordPromptWithUsername", formatStrings,
         passwordPromptString);
   else
     rv = composeStringBundle->FormatStringFromName(
-        "smtpEnterPasswordPrompt", formatStrings, 1, passwordPromptString);
+        "smtpEnterPasswordPrompt", formatStrings, passwordPromptString);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIAuthPrompt> netPrompt;
   rv = aSmtpUrl->GetAuthPrompt(getter_AddRefs(netPrompt));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString passwordTitle;
   rv = composeStringBundle->GetStringFromName("smtpEnterPasswordPromptTitle",
@@ -2228,17 +2225,16 @@ nsresult nsSmtpProtocol::GetUsernamePass
   }
   // empty password
 
   aPassword.Truncate();
 
   nsCString hostname;
   rv = smtpServer->GetHostname(hostname);
   NS_ENSURE_SUCCESS(rv, rv);
-  nsAutoString hostnameUTF16;
-  CopyASCIItoUTF16(hostname, hostnameUTF16);
 
-  const char16_t *formatStrings[] = {hostnameUTF16.get(), nullptr};
+  AutoTArray<nsString, 1> formatStrings;
+  CopyASCIItoUTF16(hostname, *formatStrings.AppendElement());
 
   rv = PromptForPassword(smtpServer, smtpUrl, formatStrings, aPassword);
   NS_ENSURE_SUCCESS(rv, rv);
   return rv;
 }
--- a/mailnews/compose/src/nsSmtpProtocol.h
+++ b/mailnews/compose/src/nsSmtpProtocol.h
@@ -216,17 +216,17 @@ class nsSmtpProtocol : public nsMsgAsync
   ////////////////////////////////////////////////////////////////////////////////////////
 
   void SendMessageInFile();
 
   void AppendHelloArgument(nsACString &aResult);
   nsresult GetPassword(nsString &aPassword);
   nsresult GetUsernamePassword(nsACString &aUsername, nsAString &aPassword);
   nsresult PromptForPassword(nsISmtpServer *aSmtpServer, nsISmtpUrl *aSmtpUrl,
-                             const char16_t **formatStrings,
+                             nsTArray<nsString> &formatStrings,
                              nsAString &aPassword);
 
   void InitPrefAuthMethods(int32_t authMethodPrefValue);
   nsresult ChooseAuthMethod();
   void MarkAuthMethodAsFailed(int32_t failedAuthMethod);
   void ResetAuthMethods();
 
   virtual const char *GetType() override { return "smtp"; }
--- a/mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp
+++ b/mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp
@@ -92,31 +92,31 @@ nsMsgMdnGenerator::nsMsgMdnGenerator() {
   m_notInToCcOp = eNeverSendOp;
   m_outsideDomainOp = eNeverSendOp;
   m_otherOp = eNeverSendOp;
 }
 
 nsMsgMdnGenerator::~nsMsgMdnGenerator() {}
 
 nsresult nsMsgMdnGenerator::FormatStringFromName(const char *aName,
-                                                 const char16_t *aString,
+                                                 const nsString &aString,
                                                  nsAString &aResultString) {
   DEBUG_MDN("nsMsgMdnGenerator::FormatStringFromName");
 
   nsCOMPtr<nsIStringBundleService> bundleService =
       mozilla::services::GetStringBundleService();
   NS_ENSURE_TRUE(bundleService, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIStringBundle> bundle;
   nsresult rv =
       bundleService->CreateBundle(MDN_STRINGBUNDLE_URL, getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  const char16_t *formatStrings[1] = {aString};
-  rv = bundle->FormatStringFromName(aName, formatStrings, 1, aResultString);
+  AutoTArray<nsString, 1> formatStrings = {aString};
+  rv = bundle->FormatStringFromName(aName, formatStrings, aResultString);
   NS_ENSURE_SUCCESS(rv, rv);
   return rv;
 }
 
 nsresult nsMsgMdnGenerator::GetStringFromName(const char *aName,
                                               nsAString &aResultString) {
   DEBUG_MDN("nsMsgMdnGenerator::GetStringFromName");
 
@@ -420,18 +420,18 @@ nsresult nsMsgMdnGenerator::CreateFirstP
   // convert fullName to UTF8 before passing it to MakeMimeAddress
   MakeMimeAddress(NS_ConvertUTF16toUTF8(fullName), m_email, fullAddress);
 
   convbuf = nsMsgI18NEncodeMimePartIIStr(fullAddress.get(), true,
                                          m_charset.get(), 0, conformToStandard);
 
   parm = PR_smprintf("From: %s" CRLF, convbuf ? convbuf : m_email.get());
 
-  rv = FormatStringFromName("MsgMdnMsgSentTo",
-                            NS_ConvertASCIItoUTF16(m_email).get(), firstPart1);
+  rv = FormatStringFromName("MsgMdnMsgSentTo", NS_ConvertASCIItoUTF16(m_email),
+                            firstPart1);
   if (NS_FAILED(rv)) return rv;
 
   PUSH_N_FREE_STRING(parm);
 
   PR_Free(convbuf);
 
   if (compUtils) {
     nsCString msgId;
@@ -973,33 +973,32 @@ NS_IMETHODIMP nsMsgMdnGenerator::OnStopR
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Get the smtp hostname and format the string.
   nsCString smtpHostName;
   nsCOMPtr<nsISmtpServer> smtpServer;
   rv = smtpService->GetServerByIdentity(m_identity, getter_AddRefs(smtpServer));
   if (NS_SUCCEEDED(rv)) smtpServer->GetHostname(smtpHostName);
 
-  nsAutoString hostStr;
-  CopyASCIItoUTF16(smtpHostName, hostStr);
-  const char16_t *params[] = {hostStr.get()};
+  AutoTArray<nsString, 1> params;
+  CopyASCIItoUTF16(smtpHostName, *params.AppendElement());
 
   nsCOMPtr<nsIStringBundle> bundle;
   nsCOMPtr<nsIStringBundleService> bundleService =
       mozilla::services::GetStringBundleService();
   NS_ENSURE_TRUE(bundleService, NS_ERROR_UNEXPECTED);
 
   rv = bundleService->CreateBundle(
       "chrome://messenger/locale/messengercompose/composeMsgs.properties",
       getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsString failed_msg, dialogTitle;
 
-  bundle->FormatStringFromName(exitString, params, 1, failed_msg);
+  bundle->FormatStringFromName(exitString, params, failed_msg);
   bundle->GetStringFromName("sendMessageErrorTitle", dialogTitle);
 
   nsCOMPtr<nsIPrompt> dialog;
   rv = m_window->GetPromptDialog(getter_AddRefs(dialog));
   if (NS_SUCCEEDED(rv)) dialog->Alert(dialogTitle.get(), failed_msg.get());
 
   return NS_OK;
 }
--- a/mailnews/extensions/mdn/src/nsMsgMdnGenerator.h
+++ b/mailnews/extensions/mdn/src/nsMsgMdnGenerator.h
@@ -47,17 +47,17 @@ class nsMsgMdnGenerator : public nsIMsgM
   nsresult CreateMdnMsg();
   nsresult CreateFirstPart();
   nsresult CreateSecondPart();
   nsresult CreateThirdPart();
   nsresult SendMdnMsg();
 
   // string bundle helper methods
   nsresult GetStringFromName(const char *aName, nsAString &aResultString);
-  nsresult FormatStringFromName(const char *aName, const char16_t *aString,
+  nsresult FormatStringFromName(const char *aName, const nsString &aString,
                                 nsAString &aResultString);
 
   // other helper methods
   nsresult InitAndProcess(bool *needToAskUser);
   nsresult OutputAllHeaders();
   nsresult WriteString(const char *str);
 
  private:
--- a/mailnews/extensions/smime/src/nsMsgComposeSecure.cpp
+++ b/mailnews/extensions/smime/src/nsMsgComposeSecure.cpp
@@ -162,23 +162,22 @@ nsresult nsMsgComposeSecure::GetSMIMEBun
 
   NS_ENSURE_TRUE(InitializeSMIMEBundle(), NS_ERROR_FAILURE);
 
   return mSMIMEBundle->GetStringFromName(NS_ConvertUTF16toUTF8(name).get(),
                                          outString);
 }
 
 nsresult nsMsgComposeSecure::SMIMEBundleFormatStringFromName(
-    const char *name, const char16_t **params, uint32_t numParams,
-    nsAString &outString) {
+    const char *name, nsTArray<nsString> &params, nsAString &outString) {
   NS_ENSURE_ARG_POINTER(name);
 
   if (!InitializeSMIMEBundle()) return NS_ERROR_FAILURE;
 
-  return mSMIMEBundle->FormatStringFromName(name, params, numParams, outString);
+  return mSMIMEBundle->FormatStringFromName(name, params, outString);
 }
 
 bool nsMsgComposeSecure::InitializeSMIMEBundle() {
   if (mSMIMEBundle) return true;
 
   nsCOMPtr<nsIStringBundleService> bundleService =
       mozilla::services::GetStringBundleService();
   nsresult rv = bundleService->CreateBundle(SMIME_STRBUNDLE_URL,
@@ -210,22 +209,19 @@ void nsMsgComposeSecure::SetErrorWithPar
   if (!sendReport || !bundle_string || !param) return;
 
   if (mErrorAlreadyReported) return;
 
   mErrorAlreadyReported = true;
 
   nsString errorString;
   nsresult res;
-  const char16_t *params[1];
-
-  NS_ConvertASCIItoUTF16 ucs2(param);
-  params[0] = ucs2.get();
-
-  res = SMIMEBundleFormatStringFromName(bundle_string, params, 1, errorString);
+  AutoTArray<nsString, 1> params;
+  CopyASCIItoUTF16(MakeStringSpan(param), *params.AppendElement());
+  res = SMIMEBundleFormatStringFromName(bundle_string, params, errorString);
 
   if (NS_SUCCEEDED(res) && !errorString.IsEmpty()) {
     sendReport->SetMessage(nsIMsgSendReport::process_Current, errorString.get(),
                            true);
   }
 }
 
 nsresult nsMsgComposeSecure::ExtractEncryptionState(
--- a/mailnews/extensions/smime/src/nsMsgComposeSecure.h
+++ b/mailnews/extensions/smime/src/nsMsgComposeSecure.h
@@ -52,18 +52,17 @@ class nsMsgComposeSecure : public nsIMsg
   nsresult MimeInitEncryption(bool aSign, nsIMsgSendReport *sendReport);
   nsresult MimeFinishMultipartSigned(bool aOuter, nsIMsgSendReport *sendReport);
   nsresult MimeFinishEncryption(bool aSign, nsIMsgSendReport *sendReport);
   nsresult MimeCryptoHackCerts(const char *aRecipients,
                                nsIMsgSendReport *sendReport, bool aEncrypt,
                                bool aSign, nsIMsgIdentity *aIdentity);
   bool InitializeSMIMEBundle();
   nsresult SMIMEBundleFormatStringFromName(const char *name,
-                                           const char16_t **params,
-                                           uint32_t numParams,
+                                           nsTArray<nsString> &paramsparams,
                                            nsAString &outString);
   nsresult ExtractEncryptionState(nsIMsgIdentity *aIdentity,
                                   nsIMsgCompFields *aComposeFields,
                                   bool *aSignMessage, bool *aEncrypt);
 
   bool mSignMessage;
   bool mAlwaysEncryptMessage;
   mimeDeliveryCryptoState mCryptoState;
--- a/mailnews/imap/src/nsImapIncomingServer.cpp
+++ b/mailnews/imap/src/nsImapIncomingServer.cpp
@@ -1679,19 +1679,19 @@ nsImapIncomingServer::FEAlert(const nsAS
   GetStringBundle();
 
   if (m_stringBundle) {
     nsAutoString hostName;
     nsresult rv = GetPrettyName(hostName);
     if (NS_SUCCEEDED(rv)) {
       nsString message;
       nsString tempString(aAlertString);
-      const char16_t *params[] = {hostName.get(), tempString.get()};
-
-      rv = m_stringBundle->FormatStringFromName("imapServerAlert", params, 2,
+      AutoTArray<nsString, 2> params = {hostName, tempString};
+
+      rv = m_stringBundle->FormatStringFromName("imapServerAlert", params,
                                                 message);
       if (NS_SUCCEEDED(rv)) {
         aUrl->SetErrorCode(NS_LITERAL_CSTRING("imap-server-alert"));
         aUrl->SetErrorMessage(message);
 
         return AlertUser(message, aUrl);
       }
     }
@@ -1718,19 +1718,19 @@ nsImapIncomingServer::FEAlertWithName(co
   GetStringBundle();
 
   nsString message;
 
   if (m_stringBundle) {
     nsAutoCString hostName;
     nsresult rv = GetHostName(hostName);
     if (NS_SUCCEEDED(rv)) {
-      const NS_ConvertUTF8toUTF16 hostName16(hostName);
-      const char16_t *params[] = {hostName16.get()};
-      rv = m_stringBundle->FormatStringFromName(aMsgName, params, 1, message);
+      AutoTArray<nsString, 1> params;
+      CopyUTF8toUTF16(hostName, *params.AppendElement());
+      rv = m_stringBundle->FormatStringFromName(aMsgName, params, message);
       if (NS_SUCCEEDED(rv)) {
         aUrl->SetErrorCode(nsDependentCString(aMsgName));
         aUrl->SetErrorMessage(message);
 
         return AlertUser(message, aUrl);
       }
     }
   }
@@ -1758,20 +1758,19 @@ NS_IMETHODIMP nsImapIncomingServer::FEAl
   if (pos != -1) pos = message.FindChar(' ', pos + 1);
 
   // Adjust the message.
   if (pos != -1) message = Substring(message, pos + 1);
 
   nsString hostName;
   GetPrettyName(hostName);
 
-  const char16_t *formatStrings[] = {hostName.get(), nullptr, nullptr};
+  AutoTArray<nsString, 3> formatStrings = {hostName};
 
   const char *msgName;
-  int32_t numStrings;
   nsString fullMessage;
   nsCOMPtr<nsIImapUrl> imapUrl = do_QueryInterface(aUrl);
   NS_ENSURE_TRUE(imapUrl, NS_ERROR_INVALID_ARG);
 
   nsImapState imapState;
   nsImapAction imapAction;
 
   imapUrl->GetRequiredImapState(&imapState);
@@ -1783,31 +1782,29 @@ NS_IMETHODIMP nsImapIncomingServer::FEAl
   aUrl->SetErrorCode(NS_LITERAL_CSTRING("imap-server-error"));
   aUrl->SetErrorMessage(unicodeMsg);
 
   nsCOMPtr<nsIMsgFolder> folder;
   if (imapState == nsIImapUrl::nsImapSelectedState ||
       imapAction == nsIImapUrl::nsImapFolderStatus) {
     aUrl->GetFolder(getter_AddRefs(folder));
     if (folder) folder->GetPrettyName(folderName);
-    numStrings = 3;
     msgName = "imapFolderCommandFailed";
-    formatStrings[1] = folderName.get();
+    formatStrings.AppendElement(folderName);
   } else {
     msgName = "imapServerCommandFailed";
-    numStrings = 2;
   }
 
-  formatStrings[numStrings - 1] = unicodeMsg.get();
+  formatStrings.AppendElement(unicodeMsg);
 
   nsresult rv = GetStringBundle();
   NS_ENSURE_SUCCESS(rv, rv);
   if (m_stringBundle) {
     rv = m_stringBundle->FormatStringFromName(msgName, formatStrings,
-                                              numStrings, fullMessage);
+                                              fullMessage);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return AlertUser(fullMessage, aUrl);
 }
 
 #define IMAP_MSGS_URL "chrome://messenger/locale/imapMsgs.properties"
 
@@ -1985,24 +1982,22 @@ nsImapIncomingServer::PromptPassword(nsI
   GetRealUsername(userName);
 
   nsAutoCString hostName;
   GetRealHostName(hostName);
 
   nsresult rv = GetStringBundle();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NS_ConvertASCIItoUTF16 finalUserName(userName);
-  NS_ConvertASCIItoUTF16 finalHostName(hostName);
-
-  const char16_t *formatStrings[] = {finalUserName.get(), finalHostName.get()};
-
+  AutoTArray<nsString, 2> formatStrings;
+  CopyASCIItoUTF16(userName, *formatStrings.AppendElement());
+  CopyASCIItoUTF16(hostName, *formatStrings.AppendElement());
   nsString passwordText;
   rv = m_stringBundle->FormatStringFromName("imapEnterServerPasswordPrompt",
-                                            formatStrings, 2, passwordText);
+                                            formatStrings, passwordText);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = GetPasswordWithUI(passwordText, passwordTitle, aMsgWindow, aPassword);
   if (NS_SUCCEEDED(rv)) m_password = aPassword;
   return rv;
 }
 
 // for the nsIImapServerSink interface
@@ -2668,20 +2663,20 @@ nsImapIncomingServer::GeneratePrettyName
                                     "imapDefaultAccountName", aPrettyName);
 }
 
 nsresult nsImapIncomingServer::GetFormattedStringFromName(
     const nsAString &aValue, const char *aName, nsAString &aResult) {
   nsresult rv = GetStringBundle();
   if (m_stringBundle) {
     nsString tmpVal(aValue);
-    const char16_t *formatStrings[] = {tmpVal.get()};
+    AutoTArray<nsString, 1> formatStrings = {tmpVal};
 
     nsString result;
-    rv = m_stringBundle->FormatStringFromName(aName, formatStrings, 1, result);
+    rv = m_stringBundle->FormatStringFromName(aName, formatStrings, result);
     aResult.Assign(result);
   }
   return rv;
 }
 
 nsresult nsImapIncomingServer::GetPrefForServerAttribute(const char *prefSuffix,
                                                          bool *prefValue) {
   // Any caller of this function must initialize prefValue with a default value
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -1427,33 +1427,33 @@ NS_IMETHODIMP nsImapMailFolder::Rename(c
   nsAutoString newNameStr(newName);
   if (newNameStr.FindChar(m_hierarchyDelimiter, 0) != kNotFound) {
     nsCOMPtr<nsIDocShell> docShell;
     if (msgWindow) msgWindow->GetRootDocShell(getter_AddRefs(docShell));
     if (docShell) {
       nsCOMPtr<nsIStringBundle> bundle;
       rv = IMAPGetStringBundle(getter_AddRefs(bundle));
       if (NS_SUCCEEDED(rv) && bundle) {
-        const char16_t delimiter[2] = {(char16_t)m_hierarchyDelimiter, '\0'};
-        const char16_t *formatStrings[] = {delimiter};
+        AutoTArray<nsString, 1> formatStrings;
+        formatStrings.AppendElement()->Append(m_hierarchyDelimiter);
         nsString alertString;
-        rv = bundle->FormatStringFromName("imapSpecialChar2", formatStrings, 1,
+        rv = bundle->FormatStringFromName("imapSpecialChar2", formatStrings,
                                           alertString);
         nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
         // setting up the dialog title
         nsCOMPtr<nsIMsgIncomingServer> server;
         rv = GetServer(getter_AddRefs(server));
         NS_ENSURE_SUCCESS(rv, rv);
         nsString dialogTitle;
         nsString accountName;
         rv = server->GetPrettyName(accountName);
         NS_ENSURE_SUCCESS(rv, rv);
-        const char16_t *titleParams[] = {accountName.get()};
+        AutoTArray<nsString, 1> titleParams = {accountName};
         rv = bundle->FormatStringFromName("imapAlertDialogTitle", titleParams,
-                                          1, dialogTitle);
+                                          dialogTitle);
 
         if (dialog && !alertString.IsEmpty())
           dialog->Alert(dialogTitle.get(), alertString.get());
       }
     }
     return NS_ERROR_FAILURE;
   }
   nsCOMPtr<nsIImapIncomingServer> incomingImapServer;
@@ -2185,32 +2185,32 @@ nsImapMailFolder::DeleteSubFolders(nsIAr
   {
     nsCOMPtr<nsIStringBundle> bundle;
     rv = IMAPGetStringBundle(getter_AddRefs(bundle));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsAutoString folderName;
     rv = curFolder->GetName(folderName);
     NS_ENSURE_SUCCESS(rv, rv);
-    const char16_t *formatStrings[1] = {folderName.get()};
+    AutoTArray<nsString, 1> formatStrings = {folderName};
 
     nsAutoString deleteFolderDialogTitle;
     rv = bundle->GetStringFromName("imapDeleteFolderDialogTitle",
                                    deleteFolderDialogTitle);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsAutoString deleteFolderButtonLabel;
     rv = bundle->GetStringFromName("imapDeleteFolderButtonLabel",
                                    deleteFolderButtonLabel);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsAutoString confirmationStr;
     rv = bundle->FormatStringFromName(
         (deleteNoTrash) ? "imapDeleteNoTrash" : "imapMoveFolderToTrash",
-        formatStrings, 1, confirmationStr);
+        formatStrings, confirmationStr);
     NS_ENSURE_SUCCESS(rv, rv);
     if (!msgWindow) return NS_ERROR_NULL_POINTER;
     nsCOMPtr<nsIDocShell> docShell;
     msgWindow->GetRootDocShell(getter_AddRefs(docShell));
     nsCOMPtr<nsIPrompt> dialog;
     if (docShell) dialog = do_GetInterface(docShell);
     if (dialog) {
       int32_t buttonPressed = 0;
@@ -5573,19 +5573,19 @@ nsImapMailFolder::FillInFolderProps(nsIM
     if (owner.IsEmpty()) {
       rv = IMAPGetStringByName(folderTypeStringID, getter_Copies(uniOwner));
       // Another user's folder, for which we couldn't find an owner name
       NS_ASSERTION(false, "couldn't get owner name for other user's folder");
     } else {
       // is this right? It doesn't leak, does it?
       CopyASCIItoUTF16(owner, uniOwner);
     }
-    const char16_t *params[] = {uniOwner.get()};
+    AutoTArray<nsString, 1> params = {uniOwner};
     rv = bundle->FormatStringFromName("imapOtherUsersFolderTypeDescription",
-                                      params, 1, folderTypeDesc);
+                                      params, folderTypeDesc);
   } else if (GetFolderACL()->GetIsFolderShared()) {
     folderTypeStringID = "imapPersonalSharedFolderTypeName";
     folderTypeDescStringID = "imapPersonalSharedFolderTypeDescription";
   } else {
     folderTypeStringID = "imapPersonalSharedFolderTypeName";
     folderTypeDescStringID = "imapPersonalFolderTypeDescription";
   }
 
@@ -7443,24 +7443,24 @@ nsresult nsImapMailFolder::CopyStreamMes
     if (m_copyState->m_totalCount > 1) {
       nsString dstFolderName, progressText;
       GetName(dstFolderName);
       nsAutoString curMsgString;
       nsAutoString totalMsgString;
       totalMsgString.AppendInt(m_copyState->m_totalCount);
       curMsgString.AppendInt(m_copyState->m_curIndex + 1);
 
-      const char16_t *formatStrings[3] = {
-          curMsgString.get(), totalMsgString.get(), dstFolderName.get()};
+      AutoTArray<nsString, 3> formatStrings = {curMsgString, totalMsgString,
+                                               dstFolderName};
 
       nsCOMPtr<nsIStringBundle> bundle;
       rv = IMAPGetStringBundle(getter_AddRefs(bundle));
       NS_ENSURE_SUCCESS(rv, rv);
       rv = bundle->FormatStringFromName("imapCopyingMessageOf2", formatStrings,
-                                        3, progressText);
+                                        progressText);
       nsCOMPtr<nsIMsgStatusFeedback> statusFeedback;
       if (m_copyState->m_msgWindow)
         m_copyState->m_msgWindow->GetStatusFeedback(
             getter_AddRefs(statusFeedback));
       if (statusFeedback) {
         statusFeedback->ShowStatusString(progressText);
         int32_t percent;
         percent = (100 * m_copyState->m_curIndex) /
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -5058,22 +5058,22 @@ void nsImapProtocol::ShowProgress() {
 
     int32_t progressCurrentNumber = ++m_progressCurrentNumber[m_stringIndex];
     nsAutoString progressCurrentNumberString;
     progressCurrentNumberString.AppendInt(progressCurrentNumber);
 
     nsAutoString progressExpectedNumberString;
     progressExpectedNumberString.AppendInt(m_progressExpectedNumber);
 
-    const char16_t *formatStrings[] = {progressCurrentNumberString.get(),
-                                       progressExpectedNumberString.get(),
-                                       unicodeMailboxName.get()};
+    AutoTArray<nsString, 3> formatStrings = {progressCurrentNumberString,
+                                             progressExpectedNumberString,
+                                             unicodeMailboxName};
 
     rv = m_bundle->FormatStringFromName(m_progressStringName.get(),
-                                        formatStrings, 3, progressString);
+                                        formatStrings, progressString);
 
     if (NS_SUCCEEDED(rv) && !progressString.IsEmpty()) {
       PercentProgressUpdateEvent(progressString.get(), progressCurrentNumber,
                                  m_progressExpectedNumber);
     }
   }
 }
 
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2565,19 +2565,19 @@ NS_IMETHODIMP nsImapService::NewChannel(
       nsString statusString, confirmText;
       nsCOMPtr<nsIStringBundle> bundle;
       rv = IMAPGetStringBundle(getter_AddRefs(bundle));
       NS_ENSURE_SUCCESS(rv, rv);
       // need to convert folder name from mod-utf7 to unicode
       nsAutoString unescapedName;
       if (NS_FAILED(CopyMUTF7toUTF16(fullFolderName, unescapedName)))
         CopyASCIItoUTF16(fullFolderName, unescapedName);
-      const char16_t *formatStrings[1] = {unescapedName.get()};
-
-      rv = bundle->FormatStringFromName("imapSubscribePrompt", formatStrings, 1,
+      AutoTArray<nsString, 1> formatStrings = {unescapedName};
+
+      rv = bundle->FormatStringFromName("imapSubscribePrompt", formatStrings,
                                         confirmText);
       NS_ENSURE_SUCCESS(rv, rv);
 
       bool confirmResult = false;
       rv = dialog->Confirm(nullptr, confirmText.get(), &confirmResult);
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (confirmResult) {
--- a/mailnews/import/applemail/src/nsAppleMailImport.cpp
+++ b/mailnews/import/applemail/src/nsAppleMailImport.cpp
@@ -579,19 +579,19 @@ nsAppleMailImportMail::ImportMailbox(nsI
 
   return NS_OK;
 }
 
 void nsAppleMailImportMail::ReportStatus(const char16_t *aErrorName,
                                          nsString &aName, nsAString &aStream) {
   // get (and format, if needed) the error string from the bundle
   nsAutoString outString;
-  const char16_t *fmt = {aName.get()};
+  AutoTArray<nsString, 1> fmt = {aName};
   nsresult rv = mBundle->FormatStringFromName(
-      NS_ConvertUTF16toUTF8(aErrorName).get(), &fmt, 1, outString);
+      NS_ConvertUTF16toUTF8(aErrorName).get(), fmt, outString);
   // write it out the stream
   if (NS_SUCCEEDED(rv)) {
     aStream.Append(outString);
     aStream.Append(char16_t('\n'));
   }
 }
 
 void nsAppleMailImportMail::SetLogs(const nsAString &aSuccess,
--- a/mailnews/import/becky/src/nsBeckyMail.cpp
+++ b/mailnews/import/becky/src/nsBeckyMail.cpp
@@ -543,19 +543,19 @@ nsBeckyMail::ImportMailbox(nsIImportMail
   uint32_t finalSize;
   aSource->GetSize(&finalSize);
   mReadBytes = finalSize;
 
   nsAutoString name;
   aSource->GetDisplayName(getter_Copies(name));
 
   nsAutoString successMessage;
-  const char16_t *format = {name.get()};
+  AutoTArray<nsString, 1> format = {name};
   rv = nsBeckyStringBundle::FormatStringFromName("BeckyImportMailboxSuccess",
-                                                 &format, 1, successMessage);
+                                                 format, successMessage);
   successMessage.AppendLiteral("\n");
   *aSuccessLog = ToNewUnicode(successMessage);
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsBeckyMail::GetImportProgress(uint32_t *_retval) {
--- a/mailnews/import/becky/src/nsBeckyStringBundle.cpp
+++ b/mailnews/import/becky/src/nsBeckyStringBundle.cpp
@@ -40,17 +40,16 @@ char16_t *nsBeckyStringBundle::GetString
     mBundle->GetStringFromName(aName, string);
     return ToNewUnicode(string);
   }
 
   return nullptr;
 }
 
 nsresult nsBeckyStringBundle::FormatStringFromName(const char *name,
-                                                   const char16_t **params,
-                                                   uint32_t length,
+                                                   nsTArray<nsString> &params,
                                                    nsAString &_retval) {
   EnsureStringBundle();
 
-  return mBundle->FormatStringFromName(name, params, length, _retval);
+  return mBundle->FormatStringFromName(name, params, _retval);
 }
 
 void nsBeckyStringBundle::Cleanup(void) { mBundle = nullptr; }
--- a/mailnews/import/becky/src/nsBeckyStringBundle.h
+++ b/mailnews/import/becky/src/nsBeckyStringBundle.h
@@ -7,17 +7,17 @@
 #include "nsString.h"
 
 class nsIStringBundle;
 
 class nsBeckyStringBundle final {
  public:
   static char16_t *GetStringByName(const char *name);
   static nsresult FormatStringFromName(const char *name,
-                                       const char16_t **params, uint32_t length,
+                                       nsTArray<nsString> &params,
                                        nsAString &_retval);
   static void GetStringBundle(void);
   static void EnsureStringBundle(void);
   static void Cleanup(void);
 
  private:
   static nsCOMPtr<nsIStringBundle> mBundle;
 };
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -825,18 +825,18 @@ bool nsImportGenericMail::CreateFolder(n
   nsCOMPtr<nsIStringBundle> bundle;
   nsCOMPtr<nsIStringBundleService> bundleService =
       mozilla::services::GetStringBundleService();
   if (!bundleService) return false;
   rv = bundleService->CreateBundle(IMPORT_MSGS_URL, getter_AddRefs(bundle));
   if (NS_FAILED(rv)) return false;
   nsString folderName;
   if (!m_pName.IsEmpty()) {
-    const char16_t *moduleName[] = {m_pName.get()};
-    rv = bundle->FormatStringFromName("ImportModuleFolderName", moduleName, 1,
+    AutoTArray<nsString, 1> moduleName = {m_pName};
+    rv = bundle->FormatStringFromName("ImportModuleFolderName", moduleName,
                                       folderName);
   } else {
     rv = bundle->GetStringFromName("DefaultFolderName", folderName);
   }
   if (NS_FAILED(rv)) {
     IMPORT_LOG0("*** Failed to get Folder Name!\n");
     return false;
   }
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -695,31 +695,31 @@ nsresult nsMsgLocalMailFolder::ConfirmFo
       rv = bundleService->CreateBundle(
           "chrome://messenger/locale/localMsgs.properties",
           getter_AddRefs(bundle));
       NS_ENSURE_SUCCESS(rv, rv);
 
       nsAutoString folderName;
       rv = aFolder->GetName(folderName);
       NS_ENSURE_SUCCESS(rv, rv);
-      const char16_t *formatStrings[1] = {folderName.get()};
+      AutoTArray<nsString, 1> formatStrings = {folderName};
 
       nsAutoString deleteFolderDialogTitle;
       rv = bundle->GetStringFromName("pop3DeleteFolderDialogTitle",
                                      deleteFolderDialogTitle);
       NS_ENSURE_SUCCESS(rv, rv);
 
       nsAutoString deleteFolderButtonLabel;
       rv = bundle->GetStringFromName("pop3DeleteFolderButtonLabel",
                                      deleteFolderButtonLabel);
       NS_ENSURE_SUCCESS(rv, rv);
 
       nsAutoString confirmationStr;
       rv = bundle->FormatStringFromName("pop3MoveFolderToTrash", formatStrings,
-                                        1, confirmationStr);
+                                        confirmationStr);
       NS_ENSURE_SUCCESS(rv, rv);
 
       nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
       if (dialog) {
         int32_t buttonPressed = 0;
         // Default the dialog to "cancel".
         const uint32_t buttonFlags =
             (nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_0) +
@@ -3026,22 +3026,22 @@ nsresult nsMsgLocalMailFolder::DisplayMo
       nsAutoString numMsgSoFarString;
       numMsgSoFarString.AppendInt((mCopyState->m_copyingMultipleMessages)
                                       ? mCopyState->m_curCopyIndex
                                       : 1);
 
       nsAutoString totalMessagesString;
       totalMessagesString.AppendInt(mCopyState->m_totalMsgCount);
       nsString finalString;
-      const char16_t *stringArray[] = {
-          numMsgSoFarString.get(), totalMessagesString.get(), folderName.get()};
+      AutoTArray<nsString, 3> stringArray = {numMsgSoFarString,
+                                             totalMessagesString, folderName};
       rv = mCopyState->m_stringBundle->FormatStringFromName(
           (mCopyState->m_isMove) ? "movingMessagesStatus"
                                  : "copyingMessagesStatus",
-          stringArray, 3, finalString);
+          stringArray, finalString);
       int64_t nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
 
       // only update status/progress every half second
       if (nowMS - mCopyState->m_lastProgressTime < 500 &&
           mCopyState->m_curCopyIndex < mCopyState->m_totalMsgCount)
         return NS_OK;
 
       mCopyState->m_lastProgressTime = nowMS;
--- a/mailnews/local/src/nsMovemailService.cpp
+++ b/mailnews/local/src/nsMovemailService.cpp
@@ -97,18 +97,18 @@ nsMovemailService::CheckForNewMail(nsIUr
                                    nsIMsgFolder *inbox,
                                    nsIMovemailIncomingServer *movemailServer,
                                    nsIURI **aURL) {
   nsresult rv = NS_OK;
   LOG(("nsMovemailService::CheckForNewMail\n"));
   return rv;
 }
 
-void nsMovemailService::Error(const char *errorCode, const char16_t **params,
-                              uint32_t length) {
+void nsMovemailService::Error(const char *errorCode,
+                              nsTArray<nsString> &params, ) {
   if (!mMsgWindow) return;
 
   nsCOMPtr<nsIPrompt> dialog;
   nsresult rv = mMsgWindow->GetPromptDialog(getter_AddRefs(dialog));
   if (NS_FAILED(rv)) return;
 
   nsCOMPtr<nsIStringBundleService> bundleService =
       mozilla::services::GetStringBundleService();
@@ -116,17 +116,17 @@ void nsMovemailService::Error(const char
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(
       "chrome://messenger/locale/localMsgs.properties", getter_AddRefs(bundle));
   if (NS_FAILED(rv)) return;
 
   nsString errStr;
   // Format the error string if necessary
   if (params)
-    bundle->FormatStringFromName(errorCode, params, length, errStr);
+    bundle->FormatStringFromName(errorCode, params, errStr);
   else
     bundle->GetStringFromName(errorCode, errStr);
 
   if (!errStr.IsEmpty()) {
     dialog->Alert(nullptr, errStr.get());
   }
 }
 
@@ -135,30 +135,30 @@ SpoolLock::SpoolLock(nsACString *aSpoolN
                      nsIMsgIncomingServer *aServer)
     : mLocked(false),
       mSpoolName(*aSpoolName),
       mOwningService(&aMovemail),
       mServer(aServer) {
   if (!ObtainSpoolLock(aSeconds)) {
     NS_ConvertUTF8toUTF16 lockFile(mSpoolName);
     lockFile.AppendLiteral(LOCK_SUFFIX);
-    const char16_t *params[] = {lockFile.get()};
-    mOwningService->Error("movemailCantCreateLock", params, 1);
+    AutoTArray<nsString, 1> params = {lockFile};
+    mOwningService->Error("movemailCantCreateLock", params);
     return;
   }
   mServer->SetServerBusy(true);
   mLocked = true;
 }
 
 SpoolLock::~SpoolLock() {
   if (mLocked && !YieldSpoolLock()) {
     NS_ConvertUTF8toUTF16 lockFile(mSpoolName);
     lockFile.AppendLiteral(LOCK_SUFFIX);
-    const char16_t *params[] = {lockFile.get()};
-    mOwningService->Error("movemailCantDeleteLock", params, 1);
+    AutoTArray<nsString, 1> params = {lockFile};
+    mOwningService->Error("movemailCantDeleteLock", params);
   }
   mServer->SetServerBusy(false);
 }
 
 bool SpoolLock::isLocked() { return mLocked; }
 
 bool SpoolLock::ObtainSpoolLock(
     unsigned int aSeconds /* number of seconds to retry */) {
--- a/mailnews/local/src/nsMovemailService.h
+++ b/mailnews/local/src/nsMovemailService.h
@@ -16,16 +16,16 @@
 class nsMovemailService : public nsIMsgProtocolInfo, public nsIMovemailService {
  public:
   nsMovemailService();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMOVEMAILSERVICE
   NS_DECL_NSIMSGPROTOCOLINFO
 
-  void Error(const char* errorCode, const char16_t** params, uint32_t length);
+  void Error(const char* errorCode, nsTArray<nsString>& params);
 
  private:
   virtual ~nsMovemailService();
   nsCOMPtr<nsIMsgWindow> mMsgWindow;
 };
 
 #endif /* nsMovemailService_h___ */
--- a/mailnews/local/src/nsParseMailbox.cpp
+++ b/mailnews/local/src/nsParseMailbox.cpp
@@ -268,18 +268,18 @@ void nsMsgMailboxParser::UpdateStatusTex
         mozilla::services::GetStringBundleService();
     if (!bundleService) return;
     nsCOMPtr<nsIStringBundle> bundle;
     rv = bundleService->CreateBundle(
         "chrome://messenger/locale/localMsgs.properties",
         getter_AddRefs(bundle));
     if (NS_FAILED(rv)) return;
     nsString finalString;
-    const char16_t *stringArray[] = {m_folderName.get()};
-    rv = bundle->FormatStringFromName(stringName, stringArray, 1, finalString);
+    AutoTArray<nsString, 1> stringArray = {m_folderName};
+    rv = bundle->FormatStringFromName(stringName, stringArray, finalString);
     m_statusFeedback->ShowStatusString(finalString);
   }
 }
 
 void nsMsgMailboxParser::UpdateProgressPercent() {
   if (m_statusFeedback && m_graph_progress_total != 0) {
     // prevent overflow by dividing both by 100
     int64_t progressTotal = m_graph_progress_total / 100;
--- a/mailnews/local/src/nsPop3Protocol.cpp
+++ b/mailnews/local/src/nsPop3Protocol.cpp
@@ -556,26 +556,22 @@ bool nsPop3Protocol::TestCapFlag(uint32_
 
 uint32_t nsPop3Protocol::GetCapFlags() {
   return m_pop3ConData->capability_flags;
 }
 
 nsresult nsPop3Protocol::FormatCounterString(const nsString &stringName,
                                              uint32_t count1, uint32_t count2,
                                              nsString &resultString) {
-  nsAutoString count1String;
-  count1String.AppendInt(count1);
-
-  nsAutoString count2String;
-  count2String.AppendInt(count2);
-
-  const char16_t *formatStrings[] = {count1String.get(), count2String.get()};
+  AutoTArray<nsString, 2> formatStrings;
+  formatStrings.AppendElement()->AppendInt(count1);
+  formatStrings.AppendElement()->AppendInt(count2);
 
   return mLocalBundle->FormatStringFromName(
-      NS_ConvertUTF16toUTF8(stringName).get(), formatStrings, 2, resultString);
+      NS_ConvertUTF16toUTF8(stringName).get(), formatStrings, resultString);
 }
 
 void nsPop3Protocol::UpdateStatus(const char *aStatusName) {
   nsString statusMessage;
   mLocalBundle->GetStringFromName(aStatusName, statusMessage);
   UpdateStatusWithString(statusMessage.get());
 }
 
@@ -700,19 +696,19 @@ NS_IMETHODIMP nsPop3Protocol::OnPromptSt
 
   nsCString hostName;
   server->GetRealHostName(hostName);
 
   nsString accountName;
   server->GetPrettyName(accountName);
 
   nsString passwordPrompt;
-  NS_ConvertUTF8toUTF16 userNameUTF16(userName);
-  NS_ConvertUTF8toUTF16 hostNameUTF16(hostName);
-  const char16_t *passwordParams[] = {userNameUTF16.get(), hostNameUTF16.get()};
+  AutoTArray<nsString, 2> passwordParams;
+  CopyUTF8toUTF16(userName, *passwordParams.AppendElement());
+  CopyUTF8toUTF16(hostName, *passwordParams.AppendElement());
 
   // if the last prompt got us a bad password then show a special dialog
   if (TestFlag(POP3_PASSWORD_FAILED)) {
     // Biff case (no msgWindow) shouldn't cause prompts or passwords to get
     // forgotten at all
     // TODO shouldn't we skip the new password prompt below as well for biff?
     // Just exit here?
     if (msgWindow) {
@@ -785,23 +781,23 @@ NS_IMETHODIMP nsPop3Protocol::OnPromptSt
           // As we're async, calling ProcessProtocolState gets things going
           // again.
           ProcessProtocolState(nullptr, nullptr, 0, 0);
           return NS_OK;
         }
       }
     }
     mLocalBundle->FormatStringFromName(
-        "pop3PreviouslyEnteredPasswordIsInvalidPrompt", passwordParams, 2,
+        "pop3PreviouslyEnteredPasswordIsInvalidPrompt", passwordParams,
         passwordPrompt);
   } else
     // Otherwise this is the first time we've asked about the server's
     // password so show a first time prompt.
     mLocalBundle->FormatStringFromName("pop3EnterPasswordPrompt",
-                                       passwordParams, 2, passwordPrompt);
+                                       passwordParams, passwordPrompt);
 
   nsString passwordTitle;
   mLocalBundle->GetStringFromName("pop3EnterPasswordPromptTitle",
                                   passwordTitle);
 
   // Now go and get the password.
   if (!passwordPrompt.IsEmpty() && !passwordTitle.IsEmpty())
     rv = server->GetPasswordWithUI(passwordPrompt, passwordTitle, msgWindow,
@@ -1173,44 +1169,43 @@ int32_t nsPop3Protocol::WaitForResponse(
 
   m_pop3ConData->next_state = m_pop3ConData->next_state_after_response;
   m_pop3ConData->pause_for_read = false; /* don't pause */
 
   PR_Free(line);
   return (1); /* everything ok */
 }
 
-int32_t nsPop3Protocol::Error(const char *err_code, const char16_t **params,
-                              uint32_t length) {
+int32_t nsPop3Protocol::Error(const char *err_code, const char16_t *param) {
   MOZ_LOG(POP3LOGMODULE, LogLevel::Info, (POP3LOG("ERROR: %s"), err_code));
   nsresult rv = NS_OK;
 
   // the error code is just the resource name for the error string...
   // so print out that error message!
   nsAutoString message;
   // Format the alert string if parameter list isn't empty
-  if (params) {
-    mLocalBundle->FormatStringFromName(err_code, params, length, message);
+  if (param) {
+    AutoTArray<nsString, 1> params = {nsDependentString(param)};
+    mLocalBundle->FormatStringFromName(err_code, params, message);
   } else {
     mLocalBundle->GetStringFromName(err_code, message);
   }
   if (!m_pop3ConData->command_succeeded) {
     // Server error message
     nsString serverSaidPrefix;
     nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
     nsCString hostName;
     // Format string with hostname.
     if (server) {
       rv = server->GetRealHostName(hostName);
     }
     if (NS_SUCCEEDED(rv)) {
-      nsAutoString hostStr;
-      CopyASCIItoUTF16(hostName, hostStr);
-      const char16_t *params[] = {hostStr.get()};
-      mLocalBundle->FormatStringFromName("pop3ServerSaid", params, 1,
+      AutoTArray<nsString, 1> params;
+      CopyASCIItoUTF16(hostName, *params.AppendElement());
+      mLocalBundle->FormatStringFromName("pop3ServerSaid", params,
                                          serverSaidPrefix);
     }
 
     message.Append(' ');
     message.Append(serverSaidPrefix);
     message.Append(' ');
     message.Append(NS_ConvertASCIItoUTF16(m_commandResponse));
   }
@@ -1218,19 +1213,19 @@ int32_t nsPop3Protocol::Error(const char
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_url, &rv);
   mailnewsUrl->SetErrorCode(nsDependentCString(err_code));
   mailnewsUrl->SetErrorMessage(message);
 
   nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
   nsString accountName;
   rv = server->GetPrettyName(accountName);
   NS_ENSURE_SUCCESS(rv, -1);
-  const char16_t *titleParams[] = {accountName.get()};
+  AutoTArray<nsString, 1> titleParams = {accountName};
   nsString dialogTitle;
-  mLocalBundle->FormatStringFromName("pop3ErrorDialogTitle", titleParams, 1,
+  mLocalBundle->FormatStringFromName("pop3ErrorDialogTitle", titleParams,
                                      dialogTitle);
   // we handle "pop3TmpDownloadError" earlier...
   if (strcmp(err_code, "pop3TmpDownloadError") && NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIMsgWindow> msgWindow;
     nsCOMPtr<nsIPrompt> dialog;
     rv = mailnewsUrl->GetMsgWindow(
         getter_AddRefs(msgWindow));  // it is ok to have null msgWindow, for
                                      // example when biffing
@@ -1728,30 +1723,29 @@ int32_t nsPop3Protocol::NextAuthStep() {
     // response code received shows that login failed not because of
     // wrong credential -> stop login without retry or pw dialog, only alert
     // parameter list -> user
     nsCString userName;
     nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
     nsresult rv = server->GetRealUsername(userName);
     NS_ENSURE_SUCCESS(rv, -1);
     NS_ConvertUTF8toUTF16 userNameUTF16(userName);
-    const char16_t *params[] = {userNameUTF16.get()};
     if (TestFlag(POP3_STOPLOGIN)) {
       if (m_password_already_sent)
-        return Error("pop3PasswordFailed", params, 1);
+        return Error("pop3PasswordFailed", userNameUTF16.get());
 
       return Error("pop3UsernameFailure");
     }
     // response code received shows that server is certain about the
     // credential was wrong -> no fallback, show alert and pw dialog
     if (TestFlag(POP3_AUTH_FAILURE)) {
       MOZ_LOG(POP3LOGMODULE, LogLevel::Debug,
               (POP3LOG("auth failure, setting password failed")));
       if (m_password_already_sent)
-        Error("pop3PasswordFailed", params, 1);
+        Error("pop3PasswordFailed", userNameUTF16.get());
       else
         Error("pop3UsernameFailure");
       SetFlag(POP3_PASSWORD_FAILED);
       ClearFlag(POP3_AUTH_FAILURE);
       return 0;
     }
 
     // We have no certain response code -> fallback and try again.
@@ -1777,17 +1771,17 @@ int32_t nsPop3Protocol::NextAuthStep() {
          which, upon success, will re-open the connection.  Set a flag
          which causes the prompt to be different that time (to indicate
          that the old password was bogus.)
 
          But if we're just checking for new mail (biff) then don't bother
          prompting the user for a password: just fail silently.
       */
       SetFlag(POP3_PASSWORD_FAILED);
-      Error("pop3PasswordFailed", params, 1);
+      Error("pop3PasswordFailed", userNameUTF16.get());
       return 0;
     }
     MOZ_LOG(POP3LOGMODULE, LogLevel::Debug,
             (POP3LOG("still have some auth methods to try")));
 
     // TODO needed?
     // m_pop3Server->SetPop3CapabilityFlags(m_pop3ConData->capability_flags);
 
@@ -2204,18 +2198,17 @@ int32_t nsPop3Protocol::GetStat() {
     if (NS_FAILED(rv)) {
       m_nsIPop3Sink->AbortMailDelivery(this);
       if (rv == NS_MSG_FOLDER_BUSY) {
         nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
         nsString accountName;
         rv = server->GetPrettyName(accountName);
         NS_ENSURE_SUCCESS(rv, -1);
 
-        const char16_t *params[] = {accountName.get()};
-        return Error("pop3ServerBusy", params, 1);
+        return Error("pop3ServerBusy", accountName.get());
       }
 
       return Error("pop3MessageWriteError");
     }
 
     if (!m_pop3ConData->msg_del_started) return Error("pop3MessageWriteError");
   }
 
@@ -2353,18 +2346,17 @@ int32_t nsPop3Protocol::HandleNoUidListA
     return 0;
   }
   m_pop3ConData->next_state = POP3_SEND_QUIT;
   nsCString hostName;
   nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
   nsresult rv = server->GetRealHostName(hostName);
   NS_ENSURE_SUCCESS(rv, -1);
   NS_ConvertASCIItoUTF16 hostNameUnicode(hostName);
-  const char16_t *params[] = {hostNameUnicode.get()};
-  return Error("pop3ServerDoesNotSupportUidlEtc", params, 1);
+  return Error("pop3ServerDoesNotSupportUidlEtc", hostNameUnicode.get());
 }
 
 /* km
  *
  *  net_pop3_send_xtnd_xlst_msgid
  *
  *  Process state: POP3_SEND_XTND_XLST_MSGID
  *
--- a/mailnews/local/src/nsPop3Protocol.h
+++ b/mailnews/local/src/nsPop3Protocol.h
@@ -344,18 +344,17 @@ class nsPop3Protocol : public nsMsgProto
   nsresult GetApopTimestamp();
 
   //////////////////////////////////////////////////////////////////////////////////////////
   // Begin Pop3 protocol state handlers
   //////////////////////////////////////////////////////////////////////////////////////////
   int32_t WaitForStartOfConnectionResponse(nsIInputStream* inputStream,
                                            uint32_t length);
   int32_t WaitForResponse(nsIInputStream* inputStream, uint32_t length);
-  int32_t Error(const char* err_code, const char16_t** params = nullptr,
-                uint32_t length = 0);
+  int32_t Error(const char* err_code, const char16_t* param = nullptr);
   int32_t SendAuth();
   int32_t AuthResponse(nsIInputStream* inputStream, uint32_t length);
   int32_t SendCapa();
   int32_t CapaResponse(nsIInputStream* inputStream, uint32_t length);
   int32_t SendTLSResponse();
   int32_t ProcessAuth();
   int32_t NextAuthStep();
   int32_t AuthLogin();
--- a/mailnews/local/src/nsPop3Service.cpp
+++ b/mailnews/local/src/nsPop3Service.cpp
@@ -404,21 +404,21 @@ void nsPop3Service::AlertServerBusy(nsIM
 
   nsString accountName;
   nsCOMPtr<nsIMsgIncomingServer> server;
   rv = url->GetServer(getter_AddRefs(server));
   NS_ENSURE_SUCCESS_VOID(rv);
   rv = server->GetPrettyName(accountName);
   NS_ENSURE_SUCCESS_VOID(rv);
 
-  const char16_t *params[] = {accountName.get()};
+  AutoTArray<nsString, 1> params = {accountName};
   nsString alertString;
   nsString dialogTitle;
-  bundle->FormatStringFromName("pop3ServerBusy", params, 1, alertString);
-  bundle->FormatStringFromName("pop3ErrorDialogTitle", params, 1, dialogTitle);
+  bundle->FormatStringFromName("pop3ServerBusy", params, alertString);
+  bundle->FormatStringFromName("pop3ErrorDialogTitle", params, dialogTitle);
   if (!alertString.IsEmpty())
     dialog->Alert(dialogTitle.get(), alertString.get());
 }
 
 NS_IMETHODIMP nsPop3Service::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
                                         nsIChannel **_retval) {
   NS_ENSURE_ARG_POINTER(aURI);
   nsresult rv;
--- a/mailnews/local/src/nsPop3Sink.cpp
+++ b/mailnews/local/src/nsPop3Sink.cpp
@@ -689,19 +689,18 @@ nsresult nsPop3Sink::HandleTempDownloadF
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(
       "chrome://messenger/locale/localMsgs.properties", getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, rv);
   nsString fromStr, subjectStr, confirmString;
 
   m_newMailParser->m_newMsgHdr->GetMime2DecodedSubject(subjectStr);
   m_newMailParser->m_newMsgHdr->GetMime2DecodedAuthor(fromStr);
-  const char16_t *params[] = {fromStr.get(), subjectStr.get()};
-  bundle->FormatStringFromName("pop3TmpDownloadError", params, 2,
-                               confirmString);
+  AutoTArray<nsString, 2> params = {fromStr, subjectStr};
+  bundle->FormatStringFromName("pop3TmpDownloadError", params, confirmString);
   nsCOMPtr<mozIDOMWindowProxy> parentWindow;
   nsCOMPtr<nsIPromptService> promptService =
       do_GetService(NS_PROMPTSERVICE_CONTRACTID);
   nsCOMPtr<nsIDocShell> docShell;
   if (msgWindow) {
     (void)msgWindow->GetRootDocShell(getter_AddRefs(docShell));
     parentWindow = do_QueryInterface(docShell);
   }
--- a/mailnews/mapi/mapihook/src/msgMapiHook.cpp
+++ b/mailnews/mapi/mapihook/src/msgMapiHook.cpp
@@ -157,36 +157,35 @@ bool nsMapiHook::DisplayLoginDialog(bool
                                     getter_AddRefs(brandBundle));
     if (NS_FAILED(rv)) return false;
 
     nsString brandName;
     rv = brandBundle->GetStringFromName("brandFullName", brandName);
     if (NS_FAILED(rv)) return false;
 
     nsString loginTitle;
-    const char16_t *brandStrings[] = {brandName.get()};
-    rv =
-        bundle->FormatStringFromName("loginTitle", brandStrings, 1, loginTitle);
+    AutoTArray<nsString, 1> brandStrings = {brandName};
+    rv = bundle->FormatStringFromName("loginTitle", brandStrings, loginTitle);
     if (NS_FAILED(rv)) return false;
 
     if (aLogin) {
       nsString loginText;
       rv = bundle->GetStringFromName("loginTextwithName", loginText);
       if (NS_FAILED(rv) || loginText.IsEmpty()) return false;
 
       bool dummyValue = false;
       rv = dlgService->PromptUsernameAndPassword(
           nullptr, loginTitle.get(), loginText.get(), aUsername, aPassword,
           nullptr, &dummyValue, &btnResult);
     } else {
       // nsString loginString;
       nsString loginText;
-      const char16_t *userNameStrings[] = {*aUsername};
-      rv = bundle->FormatStringFromName("loginText", userNameStrings, 1,
-                                        loginText);
+      AutoTArray<nsString, 1> userNameStrings = {nsDependentString(*aUsername)};
+      rv =
+          bundle->FormatStringFromName("loginText", userNameStrings, loginText);
       if (NS_FAILED(rv)) return false;
 
       bool dummyValue = false;
       rv = dlgService->PromptPassword(nullptr, loginTitle.get(),
                                       loginText.get(), aPassword, nullptr,
                                       &dummyValue, &btnResult);
     }
   }
--- a/mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
+++ b/mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
@@ -90,22 +90,22 @@ static void PgpMimeGetNeedsAddonString(n
   if (NS_FAILED(rv)) return;
 
   nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
   if (NS_FAILED(rv)) return;
 
   nsCString url;
   if (NS_FAILED(prefs->GetCharPref("mail.pgpmime.addon_url", url))) return;
 
-  NS_ConvertUTF8toUTF16 url16(url);
-  const char16_t *formatStrings[] = {url16.get()};
+  AutoTArray<nsString, 1> formatStrings;
+  CopyUTF8toUTF16(url, *formatStrings.AppendElement());
 
   nsString result;
   rv = stringBundle->FormatStringFromName(PGPMIME_STR_NOT_SUPPORTED_ID,
-                                          formatStrings, 1, result);
+                                          formatStrings, result);
   if (NS_FAILED(rv)) return;
   aResult = NS_ConvertUTF16toUTF8(result);
 }
 
 static int MimeEncryptedPgpClassInitialize(MimeEncryptedPgpClass *clazz) {
   mozilla::DebugOnly<MimeObjectClass *> oclass = (MimeObjectClass *)clazz;
   NS_ASSERTION(!oclass->class_initialized, "oclass is not initialized");
 
--- a/mailnews/news/src/nsNNTPNewsgroupList.cpp
+++ b/mailnews/news/src/nsNNTPNewsgroupList.cpp
@@ -280,17 +280,17 @@ nsresult nsNNTPNewsgroupList::GetRangeOf
 
     nsCOMPtr<nsIStringBundle> bundle;
     rv = bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = bundle->GetStringFromName("noNewMessages", statusString);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    SetProgressStatus(statusString.get());
+    SetProgressStatus(statusString);
   }
 
   if (maxextra <= 0 || last_possible < first_possible || last_possible < 1) {
     *status = 0;
     return NS_OK;
   }
 
   m_knownArts.first_possible = first_possible;
@@ -799,22 +799,22 @@ nsresult nsNNTPNewsgroupList::FinishXOVE
       nsCOMPtr<nsIStringBundleService> bundleService =
           mozilla::services::GetStringBundleService();
       NS_ENSURE_TRUE(bundleService, NS_ERROR_UNEXPECTED);
 
       nsCOMPtr<nsIStringBundle> bundle;
       rv = bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
       NS_ENSURE_SUCCESS(rv, rv);
 
-      const char16_t *formatStrings[2] = {firstStr.get(), lastStr.get()};
-      rv = bundle->FormatStringFromName("downloadingArticles", formatStrings, 2,
+      AutoTArray<nsString, 2> formatStrings = {firstStr, lastStr};
+      rv = bundle->FormatStringFromName("downloadingArticles", formatStrings,
                                         statusString);
       NS_ENSURE_SUCCESS(rv, rv);
 
-      SetProgressStatus(statusString.get());
+      SetProgressStatus(statusString);
     }
   }
 
   if (newstatus) *newstatus = 0;
 
   return NS_OK;
 }
 
@@ -1098,17 +1098,17 @@ void nsNNTPNewsgroupList::SetProgressBar
     mailnewsUrl->GetStatusFeedback(getter_AddRefs(feedback));
 
     if (feedback) {
       feedback->ShowProgress(percent);
     }
   }
 }
 
-void nsNNTPNewsgroupList::SetProgressStatus(const char16_t *aMessage) {
+void nsNNTPNewsgroupList::SetProgressStatus(const nsString &aMessage) {
   if (!m_runningURL) return;
 
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_runningURL);
   if (mailnewsUrl) {
     nsCOMPtr<nsIMsgStatusFeedback> feedback;
     mailnewsUrl->GetStatusFeedback(getter_AddRefs(feedback));
 
     if (feedback) {
@@ -1120,18 +1120,18 @@ void nsNNTPNewsgroupList::SetProgressSta
       nsString accountName;
       server->GetPrettyName(accountName);
       nsString statusMessage;
       nsCOMPtr<nsIStringBundleService> sbs =
           mozilla::services::GetStringBundleService();
       nsCOMPtr<nsIStringBundle> bundle;
       rv = sbs->CreateBundle(MSGS_URL, getter_AddRefs(bundle));
       NS_ENSURE_SUCCESS_VOID(rv);
-      const char16_t *params[] = {accountName.get(), aMessage};
-      bundle->FormatStringFromName("statusMessage", params, 2, statusMessage);
+      AutoTArray<nsString, 2> params = {accountName, aMessage};
+      bundle->FormatStringFromName("statusMessage", params, statusMessage);
 
       feedback->ShowStatusString(statusMessage);
     }
   }
 }
 
 void nsNNTPNewsgroupList::UpdateStatus(bool filtering, int32_t numDLed,
                                        int32_t totToDL) {
@@ -1155,30 +1155,29 @@ void nsNNTPNewsgroupList::UpdateStatus(b
   if (!bundleService) return;
 
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
   if (!NS_SUCCEEDED(rv)) return;
 
   if (filtering) {
     NS_ConvertUTF8toUTF16 header(m_filterHeaders[m_currentXHDRIndex]);
-    const char16_t *formatStrings[4] = {header.get(), numDownloadedStr.get(),
-                                        totalToDownloadStr.get(),
-                                        newsgroupName.get()};
+    AutoTArray<nsString, 4> formatStrings = {header, numDownloadedStr,
+                                             totalToDownloadStr, newsgroupName};
     rv = bundle->FormatStringFromName("newNewsgroupFilteringHeaders",
-                                      formatStrings, 4, statusString);
+                                      formatStrings, statusString);
   } else {
-    const char16_t *formatStrings[3] = {
-        numDownloadedStr.get(), totalToDownloadStr.get(), newsgroupName.get()};
-    rv = bundle->FormatStringFromName("newNewsgroupHeaders", formatStrings, 3,
+    AutoTArray<nsString, 3> formatStrings = {numDownloadedStr,
+                                             totalToDownloadStr, newsgroupName};
+    rv = bundle->FormatStringFromName("newNewsgroupHeaders", formatStrings,
                                       statusString);
   }
   if (!NS_SUCCEEDED(rv)) return;
 
-  SetProgressStatus(statusString.get());
+  SetProgressStatus(statusString);
   m_lastStatusUpdate = PR_Now();
 
   // only update the progress meter if it has changed
   if (percent != m_lastPercent) {
     SetProgressBarPercent(percent);
     m_lastPercent = percent;
   }
 }
--- a/mailnews/news/src/nsNNTPNewsgroupList.h
+++ b/mailnews/news/src/nsNNTPNewsgroupList.h
@@ -67,17 +67,17 @@ class nsNNTPNewsgroupList : public nsINN
   bool m_finishingXover;
 
 #ifdef HAVE_CHANGELISTENER
   virtual void OnAnnouncerGoingAway(ChangeAnnouncer *instigator);
 #endif
   nsresult ParseLine(char *line, uint32_t *message_number);
   nsresult GetDatabase(const char *uri, nsIMsgDatabase **db);
   void SetProgressBarPercent(int32_t percent);
-  void SetProgressStatus(const char16_t *aMessage);
+  void SetProgressStatus(const nsString &aMessage);
 
   void UpdateStatus(bool filtering, int32_t numDled, int32_t totToDL);
 
   nsresult AddHeader(const char *header, const char *value);
 
  protected:
   bool m_getOldMessages;
   bool m_promptedAlready;
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -948,19 +948,19 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI 
       // as escaped. decode and unescape the newsgroup name so we'll
       // display a proper name.
 
       nsAutoString unescapedName;
       rv = NS_MsgDecodeUnescapeURLPath(group, unescapedName);
       NS_ENSURE_SUCCESS(rv, rv);
 
       bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
-      const char16_t *formatStrings[1] = {unescapedName.get()};
-
-      rv = bundle->FormatStringFromName("autoSubscribeText", formatStrings, 1,
+      AutoTArray<nsString, 1> formatStrings = {unescapedName};
+
+      rv = bundle->FormatStringFromName("autoSubscribeText", formatStrings,
                                         confirmText);
       NS_ENSURE_SUCCESS(rv, rv);
 
       bool confirmResult = false;
       rv = dialog->Confirm(nullptr, confirmText.get(), &confirmResult);
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (confirmResult) {
@@ -2630,21 +2630,21 @@ nsresult nsNNTPProtocol::ReadNewsList(ns
       // decimal precision.
       float rate = 0.0;
       ComputeRate(mBytesReceived, m_startTime, &rate);
       char rate_buf[RATE_STR_BUF_LEN];
       PR_snprintf(rate_buf, RATE_STR_BUF_LEN, "%.1f", rate);
 
       nsAutoString numGroupsStr;
       numGroupsStr.AppendInt(mNumGroupsListed);
-      NS_ConvertASCIItoUTF16 rateStr(rate_buf);
-
-      const char16_t *formatStrings[3] = {numGroupsStr.get(), bytesStr.get(),
-                                          rateStr.get()};
-      rv = bundle->FormatStringFromName("bytesReceived", formatStrings, 3,
+
+      AutoTArray<nsString, 3> formatStrings = {numGroupsStr, bytesStr};
+      CopyASCIItoUTF16(MakeStringSpan(rate_buf),
+                       *formatStrings.AppendElement());
+      rv = bundle->FormatStringFromName("bytesReceived", formatStrings,
                                         statusString);
 
       rv = msgStatusFeedback->ShowStatusString(statusString);
       if (NS_FAILED(rv)) {
         PR_Free(lineToFree);
         return rv;
       }
     }
--- a/mailnews/news/src/nsNewsDownloader.cpp
+++ b/mailnews/news/src/nsNewsDownloader.cpp
@@ -166,20 +166,19 @@ bool nsNewsDownloader::GetNextHdrToRetri
     firstStr.AppendInt(m_numwrote);
     nsAutoString totalStr;
     totalStr.AppendInt(int(m_keysToDownload.Length()));
     nsString prettyName;
     nsString statusString;
 
     m_folder->GetPrettyName(prettyName);
 
-    const char16_t *formatStrings[3] = {firstStr.get(), totalStr.get(),
-                                        prettyName.get()};
+    AutoTArray<nsString, 3> formatStrings = {firstStr, totalStr, prettyName};
     rv = bundle->FormatStringFromName("downloadingArticlesForOffline",
-                                      formatStrings, 3, statusString);
+                                      formatStrings, statusString);
     NS_ENSURE_SUCCESS(rv, false);
     ShowProgress(statusString.get(), percent);
     return true;
   }
   NS_ASSERTION(false, "shouldn't get here if we're not downloading from keys.");
   return false;  // shouldn't get here if we're not downloading from keys.
 }
 
--- a/mailnews/news/src/nsNewsFolder.cpp
+++ b/mailnews/news/src/nsNewsFolder.cpp
@@ -1119,25 +1119,23 @@ nsMsgNewsFolder::GetAuthenticationCreden
 
       nsCOMPtr<nsINntpIncomingServer> nntpServer;
       rv = GetNntpServer(getter_AddRefs(nntpServer));
       NS_ENSURE_SUCCESS(rv, rv);
 
       bool singleSignon = true;
       nntpServer->GetSingleSignon(&singleSignon);
 
-      const char16_t *params[2];
-      params[0] = mName.get();
-      params[1] = serverName.get();
-      if (singleSignon)
-        bundle->FormatStringFromName("enterUserPassServer", &params[1], 1,
-                                     promptText);
-      else
-        bundle->FormatStringFromName("enterUserPassGroup", params, 2,
-                                     promptText);
+      if (singleSignon) {
+        AutoTArray<nsString, 1> params = {serverName};
+        bundle->FormatStringFromName("enterUserPassServer", params, promptText);
+      } else {
+        AutoTArray<nsString, 2> params = {mName, serverName};
+        bundle->FormatStringFromName("enterUserPassGroup", params, promptText);
+      }
 
       // Fill the signon url for the dialog
       nsString signonURL;
       rv = CreateNewsgroupUrlForSignon(nullptr, signonURL);
       NS_ENSURE_SUCCESS(rv, rv);
 
       // Prefill saved username/password
       char16_t *uniGroupUsername =
--- a/mailnews/news/src/nsNntpIncomingServer.cpp
+++ b/mailnews/news/src/nsNntpIncomingServer.cpp
@@ -1414,22 +1414,21 @@ nsNntpIncomingServer::GroupNotFound(nsIM
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCString hostname;
   rv = GetRealHostName(hostname);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NS_ConvertUTF8toUTF16 hostStr(hostname);
-
   nsString groupName(aName);
-  const char16_t *formatStrings[2] = {groupName.get(), hostStr.get()};
+  AutoTArray<nsString, 2> formatStrings = {groupName};
+  CopyUTF8toUTF16(hostname, *formatStrings.AppendElement());
   nsString confirmText;
-  rv = bundle->FormatStringFromName("autoUnsubscribeText", formatStrings, 2,
+  rv = bundle->FormatStringFromName("autoUnsubscribeText", formatStrings,
                                     confirmText);
   NS_ENSURE_SUCCESS(rv, rv);
 
   bool confirmResult = false;
   rv = prompt->Confirm(nullptr, confirmText.get(), &confirmResult);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (confirmResult) {