Bug 1604081 - Avoid using nsIURILoader::registerContentListener if possible. r=benc DONTBUILD
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Wed, 26 Feb 2020 12:55:33 +0200
changeset 37436 b8fd942d5dccc7b135e65204238aa43a3d551877
parent 37435 867f7a2af4cad3b09fe274f10fbf213a8f684eba
child 37437 0498fb268e27f56d3d67b7cef3e6eae54a2f63d5
push id2566
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:20:31 +0000
treeherdercomm-beta@a352facfa0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenc
bugs1604081
Bug 1604081 - Avoid using nsIURILoader::registerContentListener if possible. r=benc DONTBUILD
mailnews/base/src/nsMsgWindow.cpp
--- a/mailnews/base/src/nsMsgWindow.cpp
+++ b/mailnews/base/src/nsMsgWindow.cpp
@@ -46,24 +46,16 @@ NS_IMPL_ISUPPORTS(nsMsgWindow, nsIMsgWin
 nsMsgWindow::nsMsgWindow() {
   mCharsetOverride = false;
   m_stopped = false;
 }
 
 nsMsgWindow::~nsMsgWindow() { CloseWindow(); }
 
 nsresult nsMsgWindow::Init() {
-  // register ourselves as a content listener with the uri dispatcher service
-  nsresult rv;
-  nsCOMPtr<nsIURILoader> dispatcher = mozilla::components::URILoader::Service();
-  NS_ENSURE_TRUE(dispatcher, NS_ERROR_UNEXPECTED);
-
-  rv = dispatcher->RegisterContentListener(this);
-  if (NS_FAILED(rv)) return rv;
-
   // create Undo/Redo Transaction Manager
   mTransactionManager = new mozilla::TransactionManager();
   return mTransactionManager->SetMaxTransactionCount(-1);
 }
 
 NS_IMETHODIMP nsMsgWindow::GetMessageWindowDocShell(nsIDocShell **aDocShell) {
   *aDocShell = nullptr;
   nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mMessageWindowDocShellWeak));
@@ -98,20 +90,16 @@ NS_IMETHODIMP nsMsgWindow::GetMessageWin
     }
   }
   NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
   docShell.forget(aDocShell);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgWindow::CloseWindow() {
-  nsCOMPtr<nsIURILoader> dispatcher = mozilla::components::URILoader::Service();
-  if (dispatcher)  // on shut down it's possible dispatcher will be null.
-    dispatcher->UnRegisterContentListener(this);
-
   mMsgWindowCommands = nullptr;
   mStatusFeedback = nullptr;
 
   StopUrls();
 
   nsCOMPtr<nsIDocShell> messagePaneDocShell(
       do_QueryReferent(mMessageWindowDocShellWeak));
   if (messagePaneDocShell) {
@@ -400,16 +388,18 @@ NS_IMETHODIMP nsMsgWindow::DoContent(con
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgWindow::IsPreferred(const char *aContentType, char **aDesiredContentType,
                          bool *aCanHandleContent) {
+  // We don't want to handle opening any attachments inside the
+  // message pane, but want to let nsIExternalHelperAppService take care.
   *aCanHandleContent = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgWindow::CanHandleContent(const char *aContentType,
                                             bool aIsContentPreferred,
                                             char **aDesiredContentType,
                                             bool *aCanHandleContent)