Bug 1489566 - Follow-up: Convert 1st argument of DisplayURIInMessagePane() to nsAString. r=mkmelin
authorJorg K <jorgk@jorgk.com>
Fri, 07 Sep 2018 20:53:24 +0200
changeset 33092 5eade664a1a913ccd1497f8d05ec5b8aa4df60a9
parent 33091 38e2a60486af46320c357b412e42a0bba97ffca6
child 33093 c1a9f19c8216d71c640076a1ecb63ce43cf5092a
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersmkmelin
bugs1489566
Bug 1489566 - Follow-up: Convert 1st argument of DisplayURIInMessagePane() to nsAString. r=mkmelin
mailnews/base/public/nsIMsgWindow.idl
mailnews/base/src/nsMsgWindow.cpp
mailnews/news/src/nsNNTPProtocol.cpp
--- a/mailnews/base/public/nsIMsgWindow.idl
+++ b/mailnews/base/public/nsIMsgWindow.idl
@@ -53,17 +53,17 @@ interface nsIMsgWindow : nsISupports {
   readonly attribute nsIAuthPrompt authPrompt;
 
   /**
    * These are currently used to set notification callbacks on
    * protocol channels to handle things like bad cert exceptions.
    */
   attribute nsIInterfaceRequestor notificationCallbacks;
 
-  void displayURIInMessagePane(in wstring uri, in boolean clearMsgHdr, in nsIPrincipal principal);
+  void displayURIInMessagePane(in AString uri, in boolean clearMsgHdr, in nsIPrincipal principal);
 
   void displayHTMLInMessagePane(in AString title, in AString body, in boolean clearMsgHdr);
 
   readonly attribute nsIPrompt promptDialog;
   attribute ACString mailCharacterSet;
 
   /**
     Remember the message's charaset was overridden, so it can be inherited (e.g for quoting).
--- a/mailnews/base/src/nsMsgWindow.cpp
+++ b/mailnews/base/src/nsMsgWindow.cpp
@@ -488,29 +488,29 @@ NS_IMETHODIMP nsMsgWindow::GetPromptDial
 
 NS_IMETHODIMP nsMsgWindow::SetPromptDialog(nsIPrompt* aPromptDialog)
 {
   mPromptDialog = aPromptDialog;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMsgWindow::DisplayURIInMessagePane(const char16_t *uri, bool clearMsgHdr, nsIPrincipal *principal)
+nsMsgWindow::DisplayURIInMessagePane(const nsAString& uri, bool clearMsgHdr, nsIPrincipal *principal)
 {
   if (clearMsgHdr && mMsgWindowCommands)
     mMsgWindowCommands->ClearMsgPane();
 
   nsCOMPtr <nsIDocShell> docShell;
   GetMessageWindowDocShell(getter_AddRefs(docShell));
   NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
   NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
 
-  return webNav->LoadURI(nsDependentString(uri), nsIWebNavigation::LOAD_FLAGS_NONE,
+  return webNav->LoadURI(uri, nsIWebNavigation::LOAD_FLAGS_NONE,
                          nullptr, nullptr, nullptr,
                          principal);
 }
 
 NS_IMETHODIMP
 nsMsgWindow::DisplayHTMLInMessagePane(const nsAString& title, const nsAString& body, bool clearMsgHdr)
 {
   nsString htmlStr;
@@ -523,13 +523,13 @@ nsMsgWindow::DisplayHTMLInMessagePane(co
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsCString dataSpec;
   dataSpec = "data:text/html;base64,";
   dataSpec += encodedHtml;
 
   PR_FREEIF(encodedHtml);
 
-  return DisplayURIInMessagePane(NS_ConvertASCIItoUTF16(dataSpec).get(),
+  return DisplayURIInMessagePane(NS_ConvertASCIItoUTF16(dataSpec),
                                  clearMsgHdr, nsContentUtils::GetSystemPrincipal());
 }
 
 NS_IMPL_GETSET(nsMsgWindow, Stopped, bool, m_stopped)
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -2002,17 +2002,17 @@ nsresult nsNNTPProtocol::SendFirstNNTPCo
       }
       if (!m_msgWindow) return NS_ERROR_FAILURE;
 
       // note, this will cause us to close the connection.
       // this will call nsDocShell::LoadURI(), which will
       // call nsDocShell::Stop(STOP_NETWORK), which will eventually
       // call nsNNTPProtocol::Cancel(), which will close the socket.
       // we need to fix this, since the connection is still valid.
-      rv = m_msgWindow->DisplayURIInMessagePane(NS_ConvertASCIItoUTF16(uri).get(), true,
+      rv = m_msgWindow->DisplayURIInMessagePane(NS_ConvertASCIItoUTF16(uri), true,
                                                 nsContentUtils::GetSystemPrincipal());
       NS_ENSURE_SUCCESS(rv,rv);
     }
     // let's take the opportunity of removing the hdr from the db so we don't try to download
     // it again.
     else if (savingArticleOffline)
     {
       if ((m_key != nsMsgKey_None) && (m_newsFolder)) {