Bug 1229649 - Eliminate nulls in out parameter for nsIURI, rs=jcranmer
authorR Kent James <rkent@caspia.com>
Sat, 05 Dec 2015 01:41:11 -0800
changeset 18690 7b180f673933eff317d9c81857a85d88192a723a
parent 18689 fbbb6917b2cdf1db323334709c7646abddda778e
child 18691 4de2764e81a0fdb014d4b77410a08e5fdd2e39d4
push id11450
push userkent@caspia.com
push dateSat, 05 Dec 2015 09:47:41 +0000
treeherdercomm-central@7b180f673933 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcranmer
bugs1229649
Bug 1229649 - Eliminate nulls in out parameter for nsIURI, rs=jcranmer
mailnews/base/src/nsMessenger.cpp
mailnews/base/src/nsMsgPrintEngine.cpp
mailnews/compose/src/nsMsgAttachmentHandler.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/compose/src/nsMsgSendLater.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/local/src/nsLocalMailFolder.cpp
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -433,17 +433,19 @@ nsMessenger::OpenURL(const nsACString& a
   // This is to setup the display DocShell as UTF-8 capable...
   SetDisplayCharset(NS_LITERAL_CSTRING("UTF-8"));
 
   nsCOMPtr <nsIMsgMessageService> messageService;
   nsresult rv = GetMessageServiceFromURI(aURL, getter_AddRefs(messageService));
 
   if (NS_SUCCEEDED(rv) && messageService)
   {
-    messageService->DisplayMessage(PromiseFlatCString(aURL).get(), mDocShell, mMsgWindow, nullptr, nullptr, nullptr);
+    nsCOMPtr<nsIURI> dummyNull;
+    messageService->DisplayMessage(PromiseFlatCString(aURL).get(), mDocShell,
+        mMsgWindow, nullptr, nullptr, getter_AddRefs(dummyNull));
     AddMsgUrlToNavigateHistory(aURL);
     mLastDisplayURI = aURL; // remember the last uri we displayed....
     return NS_OK;
   }
 
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
   if(!webNav)
     return NS_ERROR_FAILURE;
@@ -707,20 +709,26 @@ nsresult nsMessenger::SaveAttachment(nsI
 
         rv = streamConverterService->AsyncConvertData(APPLICATION_BINHEX,
                                                       "*/*",
                                                       listener,
                                                       channelSupport,
                                                       getter_AddRefs(convertedListener));
       }
 #endif
+      nsCOMPtr<nsIURI> dummyNull;
       if (fetchService)
-        rv = fetchService->FetchMimePart(URL, fullMessageUri.get(), convertedListener, mMsgWindow, saveListener, nullptr);
+        rv = fetchService->FetchMimePart(URL, fullMessageUri.get(),
+                                         convertedListener, mMsgWindow,
+                                         saveListener, getter_AddRefs(dummyNull));
       else
-        rv = messageService->DisplayMessage(fullMessageUri.get(), convertedListener, mMsgWindow, nullptr, nullptr, nullptr);
+        rv = messageService->DisplayMessage(fullMessageUri.get(),
+                                            convertedListener, mMsgWindow,
+                                            nullptr, nullptr,
+                                            getter_AddRefs(dummyNull));
     } // if we got a message service
   } // if we created a url
 
   if (NS_FAILED(rv))
     Alert("saveAttachmentFailed");
 
   return rv;
 }
@@ -1050,18 +1058,19 @@ nsMessenger::SaveAs(const nsACString& aU
       goto done;
     }
     rv = saveListener->QueryInterface(NS_GET_IID(nsIUrlListener), getter_AddRefs(urlListener));
     if (NS_FAILED(rv))
       goto done;
 
     if (saveAsFileType == EML_FILE_TYPE)
     {
+      nsCOMPtr<nsIURI> dummyNull;
       rv = messageService->SaveMessageToDisk(PromiseFlatCString(aURI).get(), saveAsFile, false,
-        urlListener, nullptr,
+        urlListener, getter_AddRefs(dummyNull),
         true, mMsgWindow);
     }
     else
     {
       nsAutoCString urlString(aURI);
 
       // we can't go RFC822 to TXT until bug #1775 is fixed
       // so until then, do the HTML to TXT conversion in
@@ -1115,18 +1124,19 @@ nsMessenger::SaveAs(const nsACString& aU
         TEXT_HTML,
         saveListener,
         channelSupport,
         getter_AddRefs(convertedListener));
       NS_ASSERTION(NS_SUCCEEDED(rv), "AsyncConvertData failed");
       if (NS_FAILED(rv))
         goto done;
 
+      nsCOMPtr<nsIURI> dummyNull;
       rv = messageService->DisplayMessage(urlString.get(), convertedListener, mMsgWindow,
-        nullptr, nullptr, nullptr);
+        nullptr, nullptr, getter_AddRefs(dummyNull));
     }
   }
   else
   {
     // ** save as Template
     nsCOMPtr <nsIFile> tmpFile;
     nsresult rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
                                                   "nsmail.tmp",
@@ -1155,19 +1165,20 @@ nsMessenger::SaveAs(const nsACString& aU
     bool canonicalLineEnding = StringBeginsWith(saveListener->m_templateUri, NS_LITERAL_CSTRING("imap://"));
 
     rv = saveListener->QueryInterface(
       NS_GET_IID(nsIUrlListener),
       getter_AddRefs(urlListener));
     if (NS_FAILED(rv))
       goto done;
 
+    nsCOMPtr<nsIURI> dummyNull;
     rv = messageService->SaveMessageToDisk(PromiseFlatCString(aURI).get(), tmpFile,
       needDummyHeader,
-      urlListener, nullptr,
+      urlListener, getter_AddRefs(dummyNull),
       canonicalLineEnding, mMsgWindow);
   }
 
 done:
   if (NS_FAILED(rv))
   {
     NS_IF_RELEASE(saveListener);
     Alert("saveMessageFailed");
@@ -1393,19 +1404,20 @@ nsMessenger::SaveMessages(uint32_t aCoun
                                       getter_AddRefs(urlListener));
     if (NS_FAILED(rv)) {
       NS_IF_RELEASE(saveListener);
       Alert("saveMessageFailed");
       return rv;
     }
 
     // Ok, now save the message.
+    nsCOMPtr<nsIURI> dummyNull;
     rv = messageService->SaveMessageToDisk(aMessageUriArray[i],
                                            saveToFile, false,
-                                           urlListener, nullptr,
+                                           urlListener, getter_AddRefs(dummyNull),
                                            true, mMsgWindow);
     if (NS_FAILED(rv)) {
       NS_IF_RELEASE(saveListener);
       Alert("saveMessageFailed");
       return rv;
     }
   }
   return rv;
@@ -1589,18 +1601,19 @@ NS_IMETHODIMP nsMessenger::SetDocumentCh
   {
     SetDisplayCharset(NS_LITERAL_CSTRING("UTF-8"));
 
     nsCOMPtr <nsIMsgMessageService> messageService;
     nsresult rv = GetMessageServiceFromURI(mLastDisplayURI, getter_AddRefs(messageService));
 
     if (NS_SUCCEEDED(rv) && messageService)
     {
+      nsCOMPtr<nsIURI> dummyNull;
       messageService->DisplayMessage(mLastDisplayURI.get(), mDocShell, mMsgWindow, nullptr,
-                                     PromiseFlatCString(aCharacterSet).get(), nullptr);
+                                     PromiseFlatCString(aCharacterSet).get(), getter_AddRefs(dummyNull));
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMessenger::GetLastDisplayedMessageUri(nsACString& aLastDisplayedMessageUri)
--- a/mailnews/base/src/nsMsgPrintEngine.cpp
+++ b/mailnews/base/src/nsMsgPrintEngine.cpp
@@ -474,18 +474,21 @@ nsMsgPrintEngine::FireThatLoadOperation(
   // example:  imap://sspitzer@nsmail-1:143/fetch%3EUID%3E/INBOX%3E180958?part=1.1.2&type=application/x-message-display&filename=test"
   if (!StringBeginsWith(uriCStr, NS_LITERAL_CSTRING(DATA_URL_PREFIX)) &&
       !StringBeginsWith(uriCStr, NS_LITERAL_CSTRING(ADDBOOK_URL_PREFIX)) &&
       !uriCStr.EqualsLiteral("about:blank") && 
       uriCStr.Find(NS_LITERAL_CSTRING("type=application/x-message-display")) == -1) {
     rv = GetMessageServiceFromURI(uriCStr, getter_AddRefs(messageService));
   }
 
-  if (NS_SUCCEEDED(rv) && messageService)
-    rv = messageService->DisplayMessageForPrinting(uriCStr.get(), mDocShell, nullptr, nullptr, nullptr);
+  if (NS_SUCCEEDED(rv) && messageService) {
+    nsCOMPtr<nsIURI> dummyNull;
+    rv = messageService->DisplayMessageForPrinting(uriCStr.get(), mDocShell, nullptr, nullptr,
+                                                   getter_AddRefs(dummyNull));
+  }
   //If it's not something we know about, then just load try loading it directly.
   else
   {
     nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
     if (webNav)
       rv = webNav->LoadURI(uri.get(),                        // URI string
                            nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
                            nullptr,                            // Referring URI
--- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp
@@ -577,17 +577,19 @@ nsMsgAttachmentHandler::SnarfMsgAttachme
       if (NS_FAILED(rv))
         goto done;
 
       rv = m_mime_parser->AsyncConvertData("message/rfc822", "message/rfc822",
                                            strListener, m_converter_channel);
       if (NS_FAILED(rv))
         goto done;
 
-      rv = messageService->DisplayMessage(uri.get(), convertedListener, nullptr, nullptr, nullptr, nullptr);
+      nsCOMPtr<nsIURI> dummyNull;
+      rv = messageService->DisplayMessage(uri.get(), convertedListener, nullptr, nullptr, nullptr,
+                                          getter_AddRefs(dummyNull));
     }
   }
 done:
   if (NS_FAILED(rv))
   {
       if (mOutFile)
       {
         mOutFile->Close();
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -1612,18 +1612,20 @@ nsMsgComposeService::RunMessageThroughMi
     return rv;
 
   nsCOMPtr<nsIStreamConverter> converter = do_QueryInterface(mimeConverter);
   rv = converter->AsyncConvertData(nullptr, nullptr, nullptr, channel);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Now, just plug the two together and get the hell out of the way!
   nsCOMPtr<nsIStreamListener> streamListener = do_QueryInterface(mimeConverter);
+  nsCOMPtr<nsIURI> dummyNull;
   return messageService->DisplayMessage(PromiseFlatCString(aMsgURI).get(), streamListener,
-                                        aMsgWindow, nullptr, mailCharset.get(), nullptr);;
+                                        aMsgWindow, nullptr, mailCharset.get(),
+                                        getter_AddRefs(dummyNull));
 }
 
 NS_IMETHODIMP
 nsMsgComposeService::Handle(nsICommandLine* aCmdLine)
 {
   NS_ENSURE_ARG_POINTER(aCmdLine);
 
   nsresult rv;
--- a/mailnews/compose/src/nsMsgSendLater.cpp
+++ b/mailnews/compose/src/nsMsgSendLater.cpp
@@ -671,19 +671,21 @@ nsMsgSendLater::StartNextMailFileSend(ns
   m_flagsPosition = 0;
   m_headersSize = 0;
   PR_FREEIF(mLeftoverBuffer);
 
   // Now, get our stream listener interface and plug it into the DisplayMessage
   // operation
   AddRef();
 
+  nsCOMPtr<nsIURI> dummyNull;
   rv = messageService->DisplayMessage(messageURI.get(),
                                       static_cast<nsIStreamListener*>(this),
-                                      nullptr, nullptr, nullptr, nullptr);
+                                      nullptr, nullptr, nullptr,
+                                      getter_AddRefs(dummyNull));
 
   Release();
 
   return rv;
 }
 
 NS_IMETHODIMP 
 nsMsgSendLater::GetUnsentMessagesFolder(nsIMsgIdentity *aIdentity, nsIMsgFolder **folder)
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -8205,18 +8205,20 @@ nsImapMailFolder::CopyStreamMessage(nsIM
       if (statusFeedback)
       {
         statusFeedback->ShowStatusString(progressText);
         int32_t percent;
         percent = (100 * m_copyState->m_curIndex) / (int32_t) m_copyState->m_totalCount;
           statusFeedback->ShowProgress(percent);
       }
     }
+    nsCOMPtr<nsIURI> dummyNull;
     rv = m_copyState->m_msgService->CopyMessage(uri.get(), streamListener,
-                                                isMove && !m_copyState->m_isCrossServerOp, nullptr, aMsgWindow, nullptr);
+                                                isMove && !m_copyState->m_isCrossServerOp, nullptr, aMsgWindow,
+                                                getter_AddRefs(dummyNull));
     if (NS_FAILED(rv))
       MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("CopyMessage failed: uri %s\n", uri.get()));
   } 
   return rv;
 }
 
 nsImapMailCopyState::nsImapMailCopyState() :
     m_isMove(false), m_selectedState(false),
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -2790,21 +2790,22 @@ nsresult nsMsgLocalMailFolder::CopyMessa
     // before starting the next message. Only do this if the source folder
     // is a local folder, however. IMAP will handle calling StartMessage for
     // each message that gets downloaded, and news doesn't go through here
     // because news only downloads one message at a time, and this routine
     // is for multiple message copy.
     nsCOMPtr <nsIMsgLocalMailFolder> srcLocalFolder = do_QueryInterface(srcFolder);
     if (srcLocalFolder)
       StartMessage();
+    nsCOMPtr<nsIURI> dummyNull;
     rv = mCopyState->m_messageService->CopyMessages(keyArray.Length(),
                                                     keyArray.Elements(),
                                                     srcFolder, streamListener,
                                                     isMove, nullptr, aMsgWindow,
-                                                    nullptr);
+                                                    getter_AddRefs(dummyNull));
   }
   return rv;
 }
 
 nsresult nsMsgLocalMailFolder::CopyMessageTo(nsISupports *message,
                                              nsIMsgFolder *dstFolder /* dst same as "this" */,
                                              nsIMsgWindow *aMsgWindow,
                                              bool isMove)
@@ -2835,17 +2836,19 @@ nsresult nsMsgLocalMailFolder::CopyMessa
 
   if (!mCopyState->m_messageService)
     rv = GetMessageServiceFromURI(uri, getter_AddRefs(mCopyState->m_messageService));
 
   if (NS_SUCCEEDED(rv) && mCopyState->m_messageService)
   {
     nsCOMPtr<nsIStreamListener> streamListener(do_QueryInterface(copyStreamListener, &rv));
     NS_ENSURE_SUCCESS(rv, NS_ERROR_NO_INTERFACE);
-    rv = mCopyState->m_messageService->CopyMessage(uri.get(), streamListener, isMove, nullptr, aMsgWindow, nullptr);
+    nsCOMPtr<nsIURI> dummyNull;
+    rv = mCopyState->m_messageService->CopyMessage(uri.get(), streamListener, isMove, nullptr, aMsgWindow,
+                                                   getter_AddRefs(dummyNull));
   }
   return rv;
 }
 
 // A message is being deleted from a POP3 mail file, so check and see if we have the message
 // being deleted in the server. If so, then we need to remove the message from the server as well.
 // We have saved the UIDL of the message in the popstate.dat file and we must match this uidl, so
 // read the message headers and see if we have it, then mark the message for deletion from the server.