Bug 1431913 - Port bug 1431204 to mailnews: Make nsIURI.spec readonly. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Sun, 21 Jan 2018 20:56:48 +0100
changeset 23120 56a1e0215340d31f7e86c82a8102e65ec439d46f
parent 23119 3b24922dc1938d8d8a8c2475e046984ce2fb154f
child 23121 603955ee98d37a04c231db0c5025f20b7d934a1b
push id13990
push usermozilla@jorgk.com
push dateSun, 21 Jan 2018 19:57:06 +0000
treeherdercomm-central@603955ee98d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage-fix
bugs1431913, 1431204
Bug 1431913 - Port bug 1431204 to mailnews: Make nsIURI.spec readonly. rs=bustage-fix
ldap/xpcom/src/nsLDAPURL.cpp
mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
mailnews/addrbook/src/nsAddbookUrl.cpp
mailnews/base/src/nsMessengerOSXIntegration.mm
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgMailNewsUrl.cpp
mailnews/base/util/nsMsgUtils.cpp
mailnews/compose/src/nsMsgAttachmentHandler.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/compose/src/nsMsgCopy.cpp
mailnews/compose/src/nsMsgSend.cpp
mailnews/compose/src/nsSmtpService.cpp
mailnews/compose/src/nsSmtpUrl.cpp
mailnews/imap/src/nsImapService.cpp
mailnews/imap/src/nsImapUrl.cpp
mailnews/imap/src/nsImapUrl.h
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/local/src/nsLocalUtils.cpp
mailnews/local/src/nsMailboxService.cpp
mailnews/local/src/nsMailboxUrl.cpp
mailnews/local/src/nsMailboxUrl.h
mailnews/local/src/nsMsgMaildirStore.cpp
mailnews/local/src/nsPop3Service.cpp
mailnews/news/src/nsNewsFolder.cpp
mailnews/news/src/nsNntpService.cpp
mailnews/news/src/nsNntpUrl.cpp
mailnews/news/src/nsNntpUrl.h
--- a/ldap/xpcom/src/nsLDAPURL.cpp
+++ b/ldap/xpcom/src/nsLDAPURL.cpp
@@ -51,17 +51,17 @@ nsLDAPURL::Init(uint32_t aUrlType, int32
                          aBaseURI);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Now get the spec from the mBaseURL in case it was a relative one
   nsCString spec;
   rv = mBaseURL->GetSpec(spec);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return SetSpec(spec);
+  return SetSpecInternal(spec);
 }
 
 void
 nsLDAPURL::GetPathInternal(nsCString &aPath)
 {
   aPath.Assign('/');
 
   if (!mDN.IsEmpty())
@@ -144,34 +144,34 @@ NS_IMETHODIMP
 nsLDAPURL::GetSpec(nsACString &_retval)
 {
   if (!mBaseURL)
     return NS_ERROR_NOT_INITIALIZED;
 
   return mBaseURL->GetSpec(_retval);
 }
 
-NS_IMETHODIMP
-nsLDAPURL::SetSpec(const nsACString &aSpec)
+nsresult
+nsLDAPURL::SetSpecInternal(const nsACString &aSpec)
 {
   if (!mBaseURL)
     return NS_ERROR_NOT_INITIALIZED;
 
   // Cache the original spec in case we don't like what we've been passed and
   // need to reset ourselves.
   nsCString originalSpec;
   nsresult rv = mBaseURL->GetSpec(originalSpec);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mBaseURL->SetSpec(aSpec);
+  rv = mBaseURL->SetSpecInternal(aSpec);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = SetPathInternal(PromiseFlatCString(aSpec));
   if (NS_FAILED(rv))
-    mBaseURL->SetSpec(originalSpec);
+    mBaseURL->SetSpecInternal(originalSpec);
 
   return rv;
 }
 
 NS_IMETHODIMP nsLDAPURL::GetPrePath(nsACString &_retval)
 {
   if (!mBaseURL)
     return NS_ERROR_NOT_INITIALIZED;
--- a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
+++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
@@ -58,17 +58,17 @@ NS_IMETHODIMP nsAddbookProtocolHandler::
                                                const char *aOriginCharset, // ignored
                                                nsIURI *aBaseURI,
                                                nsIURI **_retval)
 {
   nsresult rv;
   nsCOMPtr<nsIAddbookUrl> addbookUrl = do_CreateInstance(NS_ADDBOOKURL_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
-  rv = addbookUrl->SetSpec(aSpec);
+  rv = addbookUrl->SetSpecInternal(aSpec);
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCOMPtr<nsIURI> uri = do_QueryInterface(addbookUrl, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
   uri.forget(_retval);
   return NS_OK;
 }
--- a/mailnews/addrbook/src/nsAddbookUrl.cpp
+++ b/mailnews/addrbook/src/nsAddbookUrl.cpp
@@ -23,20 +23,20 @@ nsAddbookUrl::nsAddbookUrl()
 }
 
 nsAddbookUrl::~nsAddbookUrl()
 {
 }
 
 NS_IMPL_ISUPPORTS(nsAddbookUrl, nsIAddbookUrl, nsIURI)
 
-NS_IMETHODIMP
-nsAddbookUrl::SetSpec(const nsACString &aSpec)
+nsresult
+nsAddbookUrl::SetSpecInternal(const nsACString &aSpec)
 {
-  nsresult rv = m_baseURL->SetSpec(aSpec);
+  nsresult rv = m_baseURL->SetSpecInternal(aSpec);
   NS_ENSURE_SUCCESS(rv, rv);
   return ParseUrl();
 }
 
 nsresult nsAddbookUrl::ParseUrl()
 {
   nsAutoCString pathStr;
 
--- a/mailnews/base/src/nsMessengerOSXIntegration.mm
+++ b/mailnews/base/src/nsMessengerOSXIntegration.mm
@@ -88,17 +88,17 @@ static void openMailWindow(const nsCStri
   if (topMostMsgWindow)
   {
     if (!aUri.IsEmpty())
     {
       nsCOMPtr<nsIMsgMailNewsUrl> msgUri(do_CreateInstance(NS_MAILBOXURL_CONTRACTID, &rv));
       if (NS_FAILED(rv))
         return;
 
-      rv = msgUri->SetSpec(aUri);
+      rv = msgUri->SetSpecInternal(aUri);
       if (NS_FAILED(rv))
         return;
 
       bool isMessageUri = false;
       msgUri->GetIsMessageUri(&isMessageUri);
       if (isMessageUri)
       {
         nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -3128,17 +3128,17 @@ nsresult
 nsMsgDBFolder::parseURI(bool needServer)
 {
   nsresult rv;
   nsCOMPtr<nsIURL> url;
 
   url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = url->SetSpec(mURI);
+  rv = url->SetSpecInternal(mURI);
   NS_ENSURE_SUCCESS(rv, rv);
   // empty path tells us it's a server.
   if (!mIsServerIsValid)
   {
     nsAutoCString path;
     rv = url->GetPathQueryRef(path);
     if (NS_SUCCEEDED(rv))
       mIsServer = path.EqualsLiteral("/");
--- a/mailnews/base/util/nsMsgMailNewsUrl.cpp
+++ b/mailnews/base/util/nsMsgMailNewsUrl.cpp
@@ -202,17 +202,17 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetServe
   nsAutoCString urlstr;
   nsAutoCString scheme;
 
   nsCOMPtr<nsIURL> url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
 
   rv = m_baseURL->GetSpec(urlstr);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = url->SetSpec(urlstr);
+  rv = url->SetSpecInternal(urlstr);
   if (NS_FAILED(rv)) return rv;
   rv = GetScheme(scheme);
     if (NS_SUCCEEDED(rv))
     {
         if (scheme.EqualsLiteral("pop"))
           scheme.AssignLiteral("pop3");
         // we use "nntp" in the server list so translate it here.
         if (scheme.EqualsLiteral("news"))
@@ -393,17 +393,17 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetSearc
 
 NS_IMETHODIMP nsMsgMailNewsUrl::GetSpec(nsACString &aSpec)
 {
   return m_baseURL->GetSpec(aSpec);
 }
 
 #define FILENAME_PART_LEN 10
 
-NS_IMETHODIMP nsMsgMailNewsUrl::SetSpec(const nsACString &aSpec)
+nsresult nsMsgMailNewsUrl::SetSpecInternal(const nsACString &aSpec)
 {
   nsAutoCString spec(aSpec);
   // Parse out "filename" attribute if present.
   char *start, *end;
   start = PL_strcasestr(spec.BeginWriting(),"?filename=");
   if (!start)
     start = PL_strcasestr(spec.BeginWriting(),"&filename=");
   if (start)
@@ -415,17 +415,17 @@ NS_IMETHODIMP nsMsgMailNewsUrl::SetSpec(
       mAttachmentFileName = start+FILENAME_PART_LEN;
       *end = '&';
     }
     else
       mAttachmentFileName = start+FILENAME_PART_LEN;
   }
 
   // Now, set the rest.
-  nsresult rv = m_baseURL->SetSpec(aSpec);
+  nsresult rv = m_baseURL->SetSpecInternal(aSpec);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Check whether the URL is in normalised form.
   nsCOMPtr <nsIMsgMessageUrl> msgUrl;
   QueryInterface(NS_GET_IID(nsIMsgMessageUrl), getter_AddRefs(msgUrl));
 
   nsAutoCString principalSpec;
   if (!msgUrl || NS_FAILED(msgUrl->GetPrincipalSpec(principalSpec))) {
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -196,17 +196,17 @@ nsresult CreateStartupUrl(const char *ur
   else if (PL_strncasecmp(uri, "news", 4) == 0)
   {
     nsCOMPtr<nsINntpUrl> nntpUrl = do_CreateInstance(kCNntpUrlCID, &rv);
     if (NS_SUCCEEDED(rv) && nntpUrl)
       rv = nntpUrl->QueryInterface(NS_GET_IID(nsIURI),
       (void**) aUrl);
   }
   if (*aUrl) // SetSpec can fail, for mailbox urls, but we still have a url.
-    (void) (*aUrl)->SetSpec(nsDependentCString(uri));
+    (void)(*aUrl)->SetSpecInternal(nsDependentCString(uri));
   return rv;
 }
 
 
 // Where should this live? It's a utility used to convert a string priority,
 //  e.g., "High, Low, Normal" to an enum.
 // Perhaps we should have an interface that groups together all these
 //  utilities...
--- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp
@@ -851,17 +851,17 @@ nsMsgAttachmentHandler::ConvertToAppleEn
   bool sendResourceFork = HasResourceFork(&fsRef);
 
   // if we have a resource fork, check the filename extension, maybe we don't need the resource fork!
   if (sendResourceFork)
   {
     nsCOMPtr<nsIURL> fileUrl(do_CreateInstance(NS_STANDARDURL_CONTRACTID));
     if (fileUrl)
     {
-      rv = fileUrl->SetSpec(aFileURI);
+      rv = fileUrl->SetSpecInternal(aFileURI);
       if (NS_SUCCEEDED(rv))
       {
         nsAutoCString ext;
         rv = fileUrl->GetFileExtension(ext);
         if (NS_SUCCEEDED(rv) && !ext.IsEmpty())
         {
           sendResourceFork =
           PL_strcasecmp(ext.get(), "TXT") &&
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -1328,17 +1328,17 @@ nsMsgComposeService::RunMessageThroughMi
   if (fileUrl || PromiseFlatCString(aMsgURI).Find("&type=application/x-message-display") >= 0)
     rv = NS_NewURI(getter_AddRefs(url), mailboxUri);
   else
     rv = messageService->GetUrlForUri(PromiseFlatCString(aMsgURI).get(), getter_AddRefs(url), aMsgWindow);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // ignore errors here - it's not fatal, and in the case of mailbox messages,
   // we're always passing in an invalid spec...
-  (void )url->SetSpec(mailboxUri);
+  (void)url->SetSpecInternal(mailboxUri);
 
   // if we are forwarding a message and that message used a charset over ride
   // then use that over ride charset instead of the charset specified in the message
   nsCString mailCharset;
   if (aMsgWindow)
   {
     bool charsetOverride;
     if (NS_SUCCEEDED(aMsgWindow->GetCharsetOverride(&charsetOverride)) && charsetOverride)
--- a/mailnews/compose/src/nsMsgCopy.cpp
+++ b/mailnews/compose/src/nsMsgCopy.cpp
@@ -537,17 +537,17 @@ MessageFolderIsLocal(nsIMsgIdentity   *u
 {
   nsresult rv;
 
   if (!aFolderURI) return NS_ERROR_NULL_POINTER;
 
   nsCOMPtr <nsIURL> url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
 
-  rv = url->SetSpec(nsDependentCString(aFolderURI));
+  rv = url->SetSpecInternal(nsDependentCString(aFolderURI));
   if (NS_FAILED(rv)) return rv;
 
   /* mailbox:/ means its local (on disk) */
   rv = url->SchemeIs("mailbox", aResult);
   if (NS_FAILED(rv)) return rv;
   return NS_OK;
 }
 
--- a/mailnews/compose/src/nsMsgSend.cpp
+++ b/mailnews/compose/src/nsMsgSend.cpp
@@ -2095,17 +2095,17 @@ nsMsgComposeAndSend::AddCompFieldLocalAt
   #endif
                     m_attachments[newLoc]->m_type = type;
                   }
                 }
 
                 //Then try using the url if we still haven't figured out the content type
                 if (m_attachments[newLoc]->m_type.IsEmpty())
                 {
-                  rv = fileUrl->SetSpec(url);
+                  rv = fileUrl->SetSpecInternal(url);
                   if (NS_SUCCEEDED(rv))
                   {
                     rv = fileUrl->GetFileExtension(fileExt);
                     if (NS_SUCCEEDED(rv) && !fileExt.IsEmpty()) {
                       nsAutoCString type;
                       mimeFinder->GetTypeFromExtension(fileExt, type);
   #ifndef XP_MACOSX
                     if (!type.EqualsLiteral("multipart/appledouble"))  // can't do apple double on non-macs
@@ -2196,17 +2196,17 @@ nsMsgComposeAndSend::AddCompFieldRemoteA
       {
         // Just look for files that are NOT local file attachments and do
         // the right thing.
         if (! nsMsgIsLocalFile(url.get()))
         {
           // Check for message attachment, see nsMsgMailNewsUrl::GetIsMessageUri.
           nsCOMPtr<nsIURI> nsiuri = do_CreateInstance(NS_STANDARDURL_CONTRACTID);
           NS_ENSURE_STATE(nsiuri);
-          nsiuri->SetSpec(url);
+          nsiuri->SetSpecInternal(url);
           nsAutoCString scheme;
           nsiuri->GetScheme(scheme);
           bool isAMessageAttachment =
             StringEndsWith(scheme, NS_LITERAL_CSTRING("-message"));
 
           m_attachments[newLoc]->mDeleteFile = true;
           m_attachments[newLoc]->m_done = false;
           m_attachments[newLoc]->SetMimeDeliveryState(this);
--- a/mailnews/compose/src/nsSmtpService.cpp
+++ b/mailnews/compose/src/nsSmtpService.cpp
@@ -171,17 +171,17 @@ nsresult NS_MsgBuildSmtpUrl(nsIFile * aF
   {
     urlSpec.Append(':');
     urlSpec.AppendInt(smtpPort);
   }
 
   nsCOMPtr<nsIMsgMailNewsUrl> url(do_QueryInterface(smtpUrl, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = url->SetSpec(urlSpec);
+  rv = url->SetSpecInternal(urlSpec);
   NS_ENSURE_SUCCESS(rv, rv);
 
   smtpUrl->SetSender(aSender);
   smtpUrl->SetRecipients(aRecipients);
   smtpUrl->SetRequestDSN(aRequestDSN);
   smtpUrl->SetPostMessageFile(aFilePath);
   smtpUrl->SetSenderIdentity(aSenderIdentity);
   if (aNotificationCallbacks)
@@ -309,19 +309,19 @@ NS_IMETHODIMP nsSmtpService::NewURI(cons
       utf8Converter(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID, &rv));
     if (NS_SUCCEEDED(rv))
       rv = utf8Converter->ConvertURISpecToUTF8(aSpec, aOriginCharset, utf8Spec);
   }
 
   // utf8Spec is filled up only when aOriginCharset is specified and
   // the conversion is successful. Otherwise, fall back to aSpec.
   if (aOriginCharset && NS_SUCCEEDED(rv))
-    rv = mailtoUrl->SetSpec(utf8Spec);
+    rv = mailtoUrl->SetSpecInternal(utf8Spec);
   else
-    rv = mailtoUrl->SetSpec(aSpec);
+    rv = mailtoUrl->SetSpecInternal(aSpec);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mailtoUrl.forget(_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsSmtpService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
--- a/mailnews/compose/src/nsSmtpUrl.cpp
+++ b/mailnews/compose/src/nsSmtpUrl.cpp
@@ -258,19 +258,19 @@ nsresult nsMailtoUrl::ParseMailtoUrl(cha
         m_referencePart += inReplyToPart;
       }
     }
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsMailtoUrl::SetSpec(const nsACString &aSpec)
+nsresult nsMailtoUrl::SetSpecInternal(const nsACString &aSpec)
 {
-  nsresult rv = m_baseURL->SetSpec(aSpec);
+  nsresult rv = m_baseURL->SetSpecInternal(aSpec);
   NS_ENSURE_SUCCESS(rv, rv);
   return ParseUrl();
 }
 
 nsresult nsMailtoUrl::CleanupMailtoState()
 {
     m_ccPart = "";
     m_subjectPart = "";
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -211,17 +211,17 @@ NS_IMETHODIMP nsImapService::SelectFolde
 
     if (NS_SUCCEEDED(rv))
     {
       nsAutoCString folderName;
       GetFolderName(aImapMailFolder, folderName);
       urlSpec.AppendLiteral("/select>");
       urlSpec.Append(hierarchyDelimiter);
       urlSpec.Append(folderName);
-      rv = mailNewsUrl->SetSpec(urlSpec);
+      rv = mailNewsUrl->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   } // if we have a url to run....
 
   return rv;
 }
 
@@ -269,17 +269,17 @@ NS_IMETHODIMP nsImapService::GetUrlForUr
     urlSpec.AppendLiteral("fetch>UID>");
     urlSpec.Append(hierarchyDelimiter);
 
     nsAutoCString folderName;
     GetFolderName(folder, folderName);
     urlSpec.Append(folderName);
     urlSpec.Append('>');
     urlSpec.Append(msgKey);
-    rv = url->SetSpec(urlSpec);
+    rv = url->SetSpecInternal(urlSpec);
     imapUrl->QueryInterface(NS_GET_IID(nsIURI), (void **) aURL);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP nsImapService::OpenAttachment(const char *aContentType, 
                                             const char *aFileName,
@@ -353,17 +353,17 @@ NS_IMETHODIMP nsImapService::OpenAttachm
       urlSpec.Append(msgKey);
       urlSpec.Append(uriMimePart);
 
       if (!uriMimePart.IsEmpty())
       {
         nsCOMPtr<nsIMsgMailNewsUrl> mailUrl (do_QueryInterface(imapUrl));
         if (mailUrl)
         {
-          rv = mailUrl->SetSpec(urlSpec);
+          rv = mailUrl->SetSpecInternal(urlSpec);
           NS_ENSURE_SUCCESS(rv, rv);
           if (aFileName)
             mailUrl->SetFileName(nsDependentCString(aFileName));
         }
         rv =  FetchMimePart(imapUrl, nsIImapUrl::nsImapOpenMimePart, folder, imapMessageSink,
                             nullptr, aDisplayConsumer, msgKey, uriMimePart);
       }
     } // if we got a message sink
@@ -598,17 +598,17 @@ nsresult nsImapService::FetchMimePart(ns
     NS_ENSURE_SUCCESS(rv, rv);
 
     // rhp: If we are displaying this message for the purpose of printing, we
     // need to append the header=print option.
     //
     if (mPrintingOperation)
       urlSpec.AppendLiteral("?header=print");
 
-    rv = url->SetSpec(urlSpec);
+    rv = url->SetSpecInternal(urlSpec);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = aImapUrl->SetImapAction(actionToUse /* nsIImapUrl::nsImapMsgFetch */);
     if (aImapMailFolder && aDisplayConsumer)
     {
       nsCOMPtr<nsIMsgIncomingServer> aMsgIncomingServer;
       rv = aImapMailFolder->GetServer(getter_AddRefs(aMsgIncomingServer));
       if (NS_SUCCEEDED(rv) && aMsgIncomingServer)
@@ -836,17 +836,17 @@ NS_IMETHODIMP nsImapService::Search(nsIM
     urlSpec.Append('>');
     // escape aSearchUri so that IMAP special characters (i.e. '\')
     // won't be replaced with '/' in NECKO.
     // it will be unescaped in nsImapUrl::ParseUrl().
     nsCString escapedSearchUri;
 
     MsgEscapeString(nsDependentCString(aSearchUri), nsINetUtil::ESCAPE_XALPHAS, escapedSearchUri);
     urlSpec.Append(escapedSearchUri);
-    rv = mailNewsUrl->SetSpec(urlSpec);
+    rv = mailNewsUrl->SetSpecInternal(urlSpec);
     if (NS_SUCCEEDED(rv))
       rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, nullptr);
   }
   return rv;
 }
 
 // just a helper method to break down imap message URIs....
 nsresult nsImapService::DecomposeImapURI(const nsACString &aMessageURI,
@@ -971,17 +971,17 @@ NS_IMETHODIMP nsImapService::AddImapFetc
   urlSpec.Append(aMessageIdentifierList);
 
   if (!aAdditionalHeader.IsEmpty())
   {
     urlSpec.AppendLiteral("?header=");
     urlSpec.Append(aAdditionalHeader);
   }
 
-  return aUrl->SetSpec(urlSpec);
+  return aUrl->SetSpecInternal(urlSpec);
 }
 
 NS_IMETHODIMP nsImapService::FetchMessage(nsIImapUrl *aImapUrl,
                                           nsImapAction aImapAction,
                                           nsIMsgFolder *aImapMailFolder, 
                                           nsIImapMessageSink *aImapMessage,
                                           nsIMsgWindow *aMsgWindow,
                                           nsISupports *aDisplayConsumer, 
@@ -1293,18 +1293,18 @@ NS_IMETHODIMP nsImapService::IsMsgInMemC
     // stick the uid validity in front of the url, so that if the uid validity
     // changes, we won't re-use the wrong cache entries.
     nsAutoCString extension;
     extension.AppendInt(uidValidity, 16);
 
     bool exists;
     if (truncated) {
       nsCOMPtr<nsIURI> newUri;
-      aUrl->Clone(getter_AddRefs(newUri));
-      newUri->SetSpec(urlSpec);
+      rv = NS_NewURI(getter_AddRefs(newUri), urlSpec);
+      NS_ENSURE_SUCCESS(rv, rv);
       rv = mCacheStorage->Exists(newUri, extension, &exists);
     } else {
       rv = mCacheStorage->Exists(aUrl, extension, &exists);
     }
     if (NS_SUCCEEDED(rv) && exists) {
       *aResult = true;
     }
   }
@@ -1360,17 +1360,17 @@ nsresult nsImapService::CreateStartOfIma
     urlSpec.Append(':');
 
     nsAutoCString portStr;
     portStr.AppendInt(port);
     urlSpec.Append(portStr);
 
     // *** jefft - force to parse the urlSpec in order to search for
     // the correct incoming server
-    rv = mailnewsUrl->SetSpec(urlSpec);
+    rv = mailnewsUrl->SetSpecInternal(urlSpec);
     NS_ENSURE_SUCCESS(rv, rv);
 
     hierarchyDelimiter = kOnlineHierarchySeparatorUnknown;
     nsCOMPtr <nsIMsgImapMailFolder> imapFolder = do_QueryInterface(aImapMailFolder);
     if (imapFolder)
       imapFolder->GetHierarchyDelimiter(&hierarchyDelimiter);
   }
   return rv;
@@ -1412,17 +1412,17 @@ NS_IMETHODIMP nsImapService::GetHeaders(
       urlSpec.Append(char (hierarchyDelimiter));
 
       nsCString folderName;
 
       GetFolderName(aImapMailFolder, folderName);
       urlSpec.Append(folderName);
       urlSpec.Append('>');
       urlSpec.Append(messageIdentifierList);
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
 
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   }
   return rv;
 }
 
@@ -1463,17 +1463,17 @@ NS_IMETHODIMP nsImapService::GetBodyStar
 
       nsCString folderName;
       GetFolderName(aImapMailFolder, folderName);
       urlSpec.Append(folderName);
       urlSpec.Append('>');
       urlSpec.Append(messageIdentifierList);
       urlSpec.Append('>');
       urlSpec.AppendInt(numBytes);
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   }
   return rv;
 }
 
 nsresult nsImapService::FolderCommand(nsIMsgFolder *imapMailFolder,
@@ -1503,17 +1503,17 @@ nsresult nsImapService::FolderCommand(ns
     if (NS_SUCCEEDED(rv))
     {
       urlSpec.Append(aCommand);
       urlSpec.Append(hierarchyDelimiter);
 
       nsCString folderName;
       GetFolderName(imapMailFolder, folderName);
       urlSpec.Append(folderName);
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, url);
     }
   }
   return rv;
 }
 
 NS_IMETHODIMP
@@ -1530,17 +1530,17 @@ nsImapService::VerifyLogon(nsIMsgFolder 
   {
     nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
 
     nsCOMPtr<nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(imapUrl);
     mailNewsUrl->SetSuppressErrorMsgs(true);
     mailNewsUrl->SetMsgWindow(aMsgWindow);
     rv = SetImapUrlSink(aFolder, imapUrl);
     urlSpec.AppendLiteral("/verifyLogon");
-    rv = uri->SetSpec(urlSpec);
+    rv = uri->SetSpecInternal(urlSpec);
     if (NS_SUCCEEDED(rv))
       rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, nullptr);
     if (aURL)
       uri.forget(aURL);
   }
   return rv;
 }
 
@@ -1604,17 +1604,17 @@ NS_IMETHODIMP nsImapService::Biff(nsIMsg
       urlSpec.AppendLiteral("/Biff>");
       urlSpec.Append(hierarchyDelimiter);
 
       nsCString folderName;
       GetFolderName(aImapMailFolder, folderName);
       urlSpec.Append(folderName);
       urlSpec.Append('>');
       urlSpec.AppendInt(uidHighWater);
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   }
   return rv;
 }
 
 NS_IMETHODIMP nsImapService::DeleteFolder(nsIMsgFolder *aImapMailFolder,
@@ -1672,17 +1672,17 @@ NS_IMETHODIMP nsImapService::DeleteMessa
       urlSpec.Append('>');
       urlSpec.Append(hierarchyDelimiter);
 
       nsCString folderName;
       GetFolderName(aImapMailFolder, folderName);
       urlSpec.Append(folderName);
       urlSpec.Append('>');
       urlSpec.Append(messageIdentifierList);
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   }
   return rv;
 }
 
 // Delete all messages in a folder, used to empty trash
@@ -1772,17 +1772,17 @@ nsresult nsImapService::DiddleFlags(nsIM
       urlSpec.Append(hierarchyDelimiter);
       nsCString folderName;
       GetFolderName(aImapMailFolder, folderName);
       urlSpec.Append(folderName);
       urlSpec.Append('>');
       urlSpec.Append(messageIdentifierList);
       urlSpec.Append('>');
       urlSpec.AppendInt(flags);
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   }
   return rv;
 }
 
 nsresult nsImapService::SetImapUrlSink(nsIMsgFolder *aMsgFolder, nsIImapUrl *aImapUrl)
@@ -1836,17 +1836,17 @@ NS_IMETHODIMP nsImapService::DiscoverAll
     if (NS_SUCCEEDED(rv))
     {
       nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
       nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(imapUrl);
       if (mailnewsurl)
         mailnewsurl->SetMsgWindow(aMsgWindow);
       urlSpec.AppendLiteral("/discoverallboxes");
       nsCOMPtr <nsIURI> url = do_QueryInterface(imapUrl, &rv);
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   }
   return rv;
 }
 
 NS_IMETHODIMP nsImapService::DiscoverAllAndSubscribedFolders(nsIMsgFolder *aImapMailFolder,
@@ -1863,17 +1863,17 @@ NS_IMETHODIMP nsImapService::DiscoverAll
                                      aUrlListener, urlSpec, hierarchyDelimiter);
   if (NS_SUCCEEDED(rv) && aImapUrl)
   {
     rv = SetImapUrlSink(aImapMailFolder, aImapUrl);
     if (NS_SUCCEEDED(rv))
     {
       nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
       urlSpec.AppendLiteral("/discoverallandsubscribedboxes");
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(aImapUrl, nullptr, aURL);
     }
   }
   return rv;
 }
 
 NS_IMETHODIMP nsImapService::DiscoverChildren(nsIMsgFolder *aImapMailFolder,
@@ -1895,17 +1895,17 @@ NS_IMETHODIMP nsImapService::DiscoverChi
     if (NS_SUCCEEDED(rv))
     {
       if (!folderPath.IsEmpty())
       {
         nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
         urlSpec.AppendLiteral("/discoverchildren>");
         urlSpec.Append(hierarchyDelimiter);
         urlSpec.Append(folderPath);
-        rv = uri->SetSpec(urlSpec);
+        rv = uri->SetSpecInternal(urlSpec);
 
         // Make sure the uri has the same hierarchy separator as the one in msg folder 
         // obj if it's not kOnlineHierarchySeparatorUnknown (ie, '^').
         char uriDelimiter;
         nsresult rv1 = aImapUrl->GetOnlineSubDirSeparator(&uriDelimiter);
         if (NS_SUCCEEDED (rv1) && hierarchyDelimiter != kOnlineHierarchySeparatorUnknown &&
             uriDelimiter != hierarchyDelimiter)
           aImapUrl->SetOnlineSubDirSeparator(hierarchyDelimiter);
@@ -1986,17 +1986,17 @@ NS_IMETHODIMP nsImapService::OnlineMessa
     urlSpec.Append('>');
     urlSpec.Append(messageIds);
     urlSpec.Append('>');
     urlSpec.Append(hierarchyDelimiter);
     folderName.Adopt(strdup(""));
     GetFolderName(aDstFolder, folderName);
     urlSpec.Append(folderName);
 
-    rv = uri->SetSpec(urlSpec);
+    rv = uri->SetSpecInternal(urlSpec);
     if (NS_SUCCEEDED(rv))
       rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
   }
   return rv;
 }
 
 nsresult nsImapService::OfflineAppendFromFile(nsIFile *aFile,
                                               nsIURI *aUrl,
@@ -2176,17 +2176,17 @@ NS_IMETHODIMP nsImapService::AppendMessa
         urlSpec.Append(uidString);
       else
         urlSpec.Append(sequenceString);
       urlSpec.Append('>');
       if (!messageId.IsEmpty())
         urlSpec.Append(messageId);
     }
     
-    rv = uri->SetSpec(urlSpec);
+    rv = uri->SetSpecInternal(urlSpec);
     if (WeAreOffline())
     {
       // handle offline append to drafts or templates folder here.
       return OfflineAppendFromFile(aFile, uri, aDstFolder, messageId, inSelectedState, aListener, aURL, aCopyState);
     }
     if (NS_SUCCEEDED(rv))
       rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
   }
@@ -2269,17 +2269,17 @@ NS_IMETHODIMP nsImapService::MoveFolder(
       urlSpec.Append(folderName);
       urlSpec.Append('>');
       GetFolderName(dstFolder, folderName);
       if (!folderName.IsEmpty())
       {
         urlSpec.Append(hierarchyDelimiter);
         urlSpec.Append(folderName);
       }
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
       {
         GetFolderName(srcFolder, folderName);
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, url);
       }
     }
   }
   return rv;
@@ -2329,17 +2329,17 @@ NS_IMETHODIMP nsImapService::RenameLeaf(
       CopyUTF16toMUTF7(PromiseFlatString(newLeafName), utfNewName);
       nsCString escapedNewName;
       MsgEscapeString(utfNewName, nsINetUtil::ESCAPE_URL_PATH, escapedNewName);
       nsCString escapedSlashName;
       rv = nsImapUrl::EscapeSlashes(escapedNewName.get(), getter_Copies(escapedSlashName));
       NS_ENSURE_SUCCESS(rv, rv);
       urlSpec.Append(escapedSlashName);
 
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, url);
     } // if (NS_SUCCEEDED(rv))
   } // if (NS_SUCCEEDED(rv) && imapUrl)
   return rv;
 }
 
 NS_IMETHODIMP nsImapService::CreateFolder(nsIMsgFolder *parent,
@@ -2379,17 +2379,17 @@ NS_IMETHODIMP nsImapService::CreateFolde
 
       nsAutoCString utfNewName;
       rv = CopyUTF16toMUTF7(PromiseFlatString(newFolderName), utfNewName);
       NS_ENSURE_SUCCESS(rv, rv);
       nsCString escapedFolderName;
       MsgEscapeString(utfNewName, nsINetUtil::ESCAPE_URL_PATH, escapedFolderName);
       urlSpec.Append(escapedFolderName);
 
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, url);
     } // if (NS_SUCCEEDED(rv))
   } // if (NS_SUCCEEDED(rv) && imapUrl)
   return rv;
 }
 
 NS_IMETHODIMP nsImapService::EnsureFolderExists(nsIMsgFolder *parent,
@@ -2422,17 +2422,17 @@ NS_IMETHODIMP nsImapService::EnsureFolde
         urlSpec.Append(hierarchyDelimiter);
       }
       nsAutoCString utfNewName; 
       CopyUTF16toMUTF7(PromiseFlatString(newFolderName), utfNewName);
       nsCString escapedFolderName;
       MsgEscapeString(utfNewName, nsINetUtil::ESCAPE_URL_PATH, escapedFolderName);
       urlSpec.Append(escapedFolderName);
 
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, url);
     } // if (NS_SUCCEEDED(rv))
   } // if (NS_SUCCEEDED(rv) && imapUrl)
   return rv;
 }
 
 NS_IMETHODIMP nsImapService::ListFolder(nsIMsgFolder *aImapMailFolder,
@@ -2527,17 +2527,17 @@ nsresult nsImapService::GetServerFromUrl
   if (NS_FAILED(rv) || !aServer)
   {
     nsAutoCString turl;
     nsCOMPtr<nsIURL> url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = mailnewsUrl->GetSpec(turl);
     NS_ENSURE_SUCCESS(rv, rv);
-    rv = url->SetSpec(turl);
+    rv = url->SetSpecInternal(turl);
     NS_ENSURE_SUCCESS(rv, rv);
 
     url->SetUserPass(EmptyCString());
     rv = accountManager->FindServerByURI(url, false, aServer);
     if (*aServer)
       aImapUrl->SetExternalLinkUrl(true);
   }
   
@@ -2562,21 +2562,21 @@ NS_IMETHODIMP nsImapService::NewURI(cons
   // nsAutoCString unescapedSpec(aSpec);
   // nsUnescape(unescapedSpec.BeginWriting());
 
   // set the spec
   if (aBaseURI)
   {
     nsAutoCString newSpec;
     aBaseURI->Resolve(aSpec, newSpec);
-    rv = mailnewsUrl->SetSpec(newSpec);
+    rv = mailnewsUrl->SetSpecInternal(newSpec);
   }
   else
   {
-    rv = mailnewsUrl->SetSpec(aSpec);
+    rv = mailnewsUrl->SetSpecInternal(aSpec);
   }
 
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCString folderName;
   // if we can't get a folder name out of the url then I think this is an error
   aImapUrl->CreateCanonicalSourceFolderPathString(getter_Copies(folderName));
   if (folderName.IsEmpty())
@@ -3077,17 +3077,17 @@ nsresult nsImapService::ChangeFolderSubs
       urlSpec.Append(command);
       urlSpec.Append(hierarchyDelimiter);
       nsAutoCString utfFolderName;
       rv = CopyUTF16toMUTF7(PromiseFlatString(folderName), utfFolderName);
       NS_ENSURE_SUCCESS(rv, rv);
       nsCString escapedFolderName;
       MsgEscapeString(utfFolderName, nsINetUtil::ESCAPE_URL_PATH, escapedFolderName);
       urlSpec.Append(escapedFolderName);
-      rv = uri->SetSpec(urlSpec);
+      rv = uri->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, url);
     }
   }
   return rv;
 }
 
 NS_IMETHODIMP nsImapService::UnsubscribeFolder(nsIMsgFolder *aFolder,
@@ -3144,17 +3144,17 @@ NS_IMETHODIMP nsImapService::IssueComman
       urlSpec.Append(aCommand);
       urlSpec.Append('>');
       urlSpec.Append(uidString);
       urlSpec.Append('>');
       urlSpec.Append(hierarchyDelimiter);
       urlSpec.Append(folderName);
       urlSpec.Append('>');
       urlSpec.Append(uids);
-      rv = mailNewsUrl->SetSpec(urlSpec);
+      rv = mailNewsUrl->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   } // if we have a url to run....
 
   return rv;
 }
 
@@ -3189,17 +3189,17 @@ NS_IMETHODIMP nsImapService::FetchCustom
       GetFolderName(anImapFolder, folderName);
       urlSpec.AppendLiteral("/customFetch>UID>");
       urlSpec.Append(hierarchyDelimiter);
       urlSpec.Append(folderName);
       urlSpec.Append('>');
       urlSpec.Append(uids);
       urlSpec.Append('>');
       urlSpec.Append(aAttribute);
-      rv = mailNewsUrl->SetSpec(urlSpec);
+      rv = mailNewsUrl->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   } // if we have a url to run....
 
   return rv;
 }
 
@@ -3236,17 +3236,17 @@ NS_IMETHODIMP nsImapService::StoreCustom
       urlSpec.Append(hierarchyDelimiter);
       urlSpec.Append(folderName);
       urlSpec.Append('>');
       urlSpec.Append(uids);
       urlSpec.Append('>');
       urlSpec.Append(flagsToAdd);
       urlSpec.Append('>');
       urlSpec.Append(flagsToSubtract);
-      rv = mailNewsUrl->SetSpec(urlSpec);
+      rv = mailNewsUrl->SetSpecInternal(urlSpec);
       if (NS_SUCCEEDED(rv))
         rv = GetImapConnectionAndLoadUrl(imapUrl, nullptr, aURL);
     }
   } // if we have a url to run....
 
   return rv;
 }
 
--- a/mailnews/imap/src/nsImapUrl.cpp
+++ b/mailnews/imap/src/nsImapUrl.cpp
@@ -195,19 +195,19 @@ NS_IMETHODIMP nsImapUrl::SetImapServerSi
   return rv;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////////
 // End nsIImapUrl specific support
 ////////////////////////////////////////////////////////////////////////////////////
 
-NS_IMETHODIMP nsImapUrl::SetSpec(const nsACString &aSpec)
+nsresult nsImapUrl::SetSpecInternal(const nsACString &aSpec)
 {
-  nsresult rv = nsMsgMailNewsUrl::SetSpec(aSpec);
+  nsresult rv = nsMsgMailNewsUrl::SetSpecInternal(aSpec);
   if (NS_SUCCEEDED(rv))
   {
     m_validUrl = true;  // assume the best.
     rv = ParseUrl();
   }
   return rv;
 }
 
--- a/mailnews/imap/src/nsImapUrl.h
+++ b/mailnews/imap/src/nsImapUrl.h
@@ -22,17 +22,17 @@
 
 class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl, public nsIMsgI18NUrl
 {
 public:
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIURI override
-  NS_IMETHOD SetSpec(const nsACString &aSpec) override;
+  nsresult SetSpecInternal(const nsACString &aSpec) override;
   NS_IMETHOD SetQuery(const nsACString &aQuery) override;
   NS_IMETHOD CloneInternal(uint32_t aRefHandlingMode,
                            const nsACString& newRef, nsIURI **_retval) override;
 
   //////////////////////////////////////////////////////////////////////////////
   // we support the nsIImapUrl interface
   //////////////////////////////////////////////////////////////////////////////
   NS_DECL_NSIIMAPURL
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -3107,17 +3107,17 @@ nsMsgLocalMailFolder::GetIncomingServerT
 {
   nsresult rv;
   if (mType.IsEmpty())
   {
     nsCOMPtr<nsIURL> url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
     if (NS_FAILED(rv))
       return rv;
 
-    rv = url->SetSpec(mURI);
+    rv = url->SetSpecInternal(mURI);
     if (NS_FAILED(rv))
       return rv;
 
     nsCOMPtr<nsIMsgAccountManager> accountManager =
              do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
     if (NS_FAILED(rv))
       return rv;
 
--- a/mailnews/local/src/nsLocalUtils.cpp
+++ b/mailnews/local/src/nsLocalUtils.cpp
@@ -28,17 +28,17 @@
 static nsresult
 nsGetMailboxServer(const char *uriStr, nsIMsgIncomingServer** aResult)
 {
   nsresult rv = NS_OK;
 
   nsCOMPtr<nsIURL> aUrl = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
 
-  rv = aUrl->SetSpec(nsDependentCString(uriStr));
+  rv = aUrl->SetSpecInternal(nsDependentCString(uriStr));
   if (NS_FAILED(rv)) return rv;
 
   // retrieve the AccountManager
   nsCOMPtr<nsIMsgAccountManager> accountManager =
     do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
 
   // find all local mail "no servers" matching the given hostname
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -56,17 +56,17 @@ nsresult nsMailboxService::ParseMailbox(
     nsAutoCString buf;
     MsgEscapeURL(mailboxPath,
                  nsINetUtil::ESCAPE_URL_MINIMAL | nsINetUtil::ESCAPE_URL_FORCED, buf);
     nsEscapeNativePath(buf);
     url->SetUpdatingFolder(true);
     url->SetMsgWindow(aMsgWindow);
     nsAutoCString uriSpec("mailbox://");
     uriSpec.Append(buf);
-    rv = url->SetSpec(uriSpec);
+    rv = url->SetSpecInternal(uriSpec);
     NS_ENSURE_SUCCESS(rv, rv);
 
     mailboxurl->SetMailboxParser(aMailboxParser);
     if (aUrlListener)
       url->RegisterListener(aUrlListener);
 
     rv = RunMailboxUrl(url, nullptr);
     NS_ENSURE_SUCCESS(rv, rv);
@@ -474,17 +474,17 @@ nsresult nsMailboxService::PrepareMessag
       else if (part)
         urlSpec = PR_smprintf("mailbox://%s?number=%lu&%s", buf.get(), msgKey, part);
       else if (header)
         urlSpec = PR_smprintf("mailbox://%s?number=%lu&%s", buf.get(), msgKey, header);
       else
         urlSpec = PR_smprintf("mailbox://%s?number=%lu", buf.get(), msgKey);
 
       nsCOMPtr <nsIMsgMailNewsUrl> url = do_QueryInterface(*aMailboxUrl);
-      rv = url->SetSpec(nsDependentCString(urlSpec));
+      rv = url->SetSpecInternal(nsDependentCString(urlSpec));
       NS_ENSURE_SUCCESS(rv, rv);
 
       PR_smprintf_free(urlSpec);
 
       (*aMailboxUrl)->SetMailboxAction(aMailboxAction);
 
       // set up the url listener
       if (aUrlListener)
@@ -551,21 +551,21 @@ NS_IMETHODIMP nsMailboxService::NewURI(c
   // mailbox://<account>/<mailbox name>?... instead of
   // mailbox://<path to folder>?.... This is the case for pop3 download urls.
   // We know this, and the failure is harmless.
   if (aBaseURI)
   {
     nsAutoCString newSpec;
     rv = aBaseURI->Resolve(aSpec, newSpec);
     NS_ENSURE_SUCCESS(rv, rv);
-    (void) aMsgUri->SetSpec(newSpec);
+    (void)aMsgUri->SetSpecInternal(newSpec);
   }
   else
   {
-    (void) aMsgUri->SetSpec(aSpec);
+    (void)aMsgUri->SetSpecInternal(aSpec);
   }
   aMsgUri.forget(_retval);
 
   return rv;
 }
 
 NS_IMETHODIMP nsMailboxService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
--- a/mailnews/local/src/nsMailboxUrl.cpp
+++ b/mailnews/local/src/nsMailboxUrl.cpp
@@ -409,19 +409,19 @@ nsresult nsMailboxUrl::ParseUrl()
     m_filePath = do_QueryInterface(fileURLFile, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   GetPathQueryRef(m_file);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsMailboxUrl::SetSpec(const nsACString &aSpec)
+nsresult nsMailboxUrl::SetSpecInternal(const nsACString &aSpec)
 {
-  nsresult rv = nsMsgMailNewsUrl::SetSpec(aSpec);
+  nsresult rv = nsMsgMailNewsUrl::SetSpecInternal(aSpec);
   if (NS_SUCCEEDED(rv))
     rv = ParseUrl();
   return rv;
 }
 
 NS_IMETHODIMP nsMailboxUrl::SetQuery(const nsACString &aQuery)
 {
   nsresult rv = nsMsgMailNewsUrl::SetQuery(aQuery);
--- a/mailnews/local/src/nsMailboxUrl.h
+++ b/mailnews/local/src/nsMailboxUrl.h
@@ -14,17 +14,17 @@
 #include "nsCOMPtr.h"
 #include "MailNewsTypes.h"
 #include "nsTArray.h"
 
 class nsMailboxUrl : public nsIMailboxUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl, public nsIMsgI18NUrl
 {
 public:
   // nsIURI over-ride...
-  NS_IMETHOD SetSpec(const nsACString &aSpec) override;
+  nsresult SetSpecInternal(const nsACString &aSpec) override;
   NS_IMETHOD SetQuery(const nsACString &aQuery) override;
 
   // from nsIMailboxUrl:
   NS_IMETHOD SetMailboxParser(nsIStreamListener * aConsumer) override;
   NS_IMETHOD GetMailboxParser(nsIStreamListener ** aConsumer) override;
   NS_IMETHOD SetMailboxCopyHandler(nsIStreamListener *  aConsumer) override;
   NS_IMETHOD GetMailboxCopyHandler(nsIStreamListener ** aConsumer) override;
 
--- a/mailnews/local/src/nsMsgMaildirStore.cpp
+++ b/mailnews/local/src/nsMsgMaildirStore.cpp
@@ -1250,17 +1250,17 @@ void MaildirStoreParser::TimerCallback(n
       nsCOMPtr<nsIMailboxUrl> mailboxurl =
         do_CreateInstance(NS_MAILBOXURL_CONTRACTID, &rv);
       if (NS_SUCCEEDED(rv) && mailboxurl)
       {
         nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(mailboxurl);
         url->SetUpdatingFolder(true);
         nsAutoCString uriSpec("mailbox://");
         // ### TODO - what if SetSpec fails?
-        (void) url->SetSpec(uriSpec);
+        (void)url->SetSpecInternal(uriSpec);
         parser->m_listener->OnStopRunningUrl(url, NS_OK);
       }
     }
     // Parsing complete and timer cancelled, so we release the parser object.
     delete parser;
     return;
   }
   nsCOMPtr<nsISupports> aSupport;
--- a/mailnews/local/src/nsPop3Service.cpp
+++ b/mailnews/local/src/nsPop3Service.cpp
@@ -215,17 +215,17 @@ nsresult nsPop3Service::BuildPop3Url(con
   nsCOMPtr<nsIPop3URL> pop3Url = do_CreateInstance(kPop3UrlCID, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
   pop3Url->SetPop3Sink(pop3Sink);
 
   rv = CallQueryInterface(pop3Url, aUrl);
   NS_ENSURE_SUCCESS(rv,rv);
 
-  rv = (*aUrl)->SetSpec(nsDependentCString(urlSpec));
+  rv = (*aUrl)->SetSpecInternal(nsDependentCString(urlSpec));
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(pop3Url);
   if (mailnewsurl)
   {
     if (aUrlListener)
       mailnewsurl->RegisterListener(aUrlListener);
     if (aMsgWindow)
--- a/mailnews/news/src/nsNewsFolder.cpp
+++ b/mailnews/news/src/nsNewsFolder.cpp
@@ -1102,22 +1102,22 @@ nsresult nsMsgNewsFolder::CreateNewsgrou
   rv = nntpServer->GetSingleSignon(&singleSignon);
 
   if (singleSignon)
   {
     nsCString serverURI;
     rv = server->GetServerURI(serverURI);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    rv = url->SetSpec(serverURI);
+    rv = url->SetSpecInternal(serverURI);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   else
   {
-    rv = url->SetSpec(mURI);
+    rv = url->SetSpecInternal(mURI);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   int32_t port = 0;
   rv = url->GetPort(&port);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (port <= 0)
--- a/mailnews/news/src/nsNntpService.cpp
+++ b/mailnews/news/src/nsNntpService.cpp
@@ -522,17 +522,17 @@ nsNntpService::DecomposeNewsMessageURI(c
 
   nsresult rv = NS_OK;
 
   // Construct the news URL
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_CreateInstance(NS_NNTPURL_CONTRACTID,&rv);
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsINntpUrl> nntpUrl = do_QueryInterface(mailnewsurl, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = mailnewsurl->SetSpec(nsDependentCString(aMessageURI));
+  rv = mailnewsurl->SetSpecInternal(nsDependentCString(aMessageURI));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Get the group name and key from the url
   nsAutoCString groupName;
   rv = nntpUrl->GetGroup(groupName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = nntpUrl->GetKey(aMsgKey);
@@ -850,17 +850,17 @@ nsNntpService::PostMessage(nsIFile *aFil
 
   nsCString newsUrlSpec;
   rv = SetUpNntpUrlForPosting(aAccountKey, getter_Copies(newsUrlSpec));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(nntpUrl, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mailnewsurl->SetSpec(newsUrlSpec);
+  rv = mailnewsurl->SetSpecInternal(newsUrlSpec);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aUrlListener) // register listener if there is one...
     mailnewsurl->RegisterListener(aUrlListener);
 
   nsCOMPtr<nsINNTPNewsgroupPost> post = do_CreateInstance(NS_NNTPNEWSGROUPPOST_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -887,17 +887,17 @@ nsNntpService::ConstructNntpUrl(const ch
 
   nsCOMPtr<nsINntpUrl> nntpUrl = do_CreateInstance(NS_NNTPURL_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(nntpUrl);
   mailnewsurl->SetMsgWindow(aMsgWindow);
   nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(nntpUrl);
   msgUrl->SetUri(originalMessageUri);
-  rv = mailnewsurl->SetSpec(nsDependentCString(urlString));
+  rv = mailnewsurl->SetSpecInternal(nsDependentCString(urlString));
   NS_ENSURE_SUCCESS(rv, rv);
   nntpUrl->SetNewsAction(action);
 
   if (originalMessageUri)
   {
     // we'll use this later in nsNNTPProtocol::ParseURL()
     rv = msgUrl->SetOriginalSpec(originalMessageUri);
     NS_ENSURE_SUCCESS(rv,rv);
@@ -1211,21 +1211,21 @@ NS_IMETHODIMP nsNntpService::NewURI(cons
 
     nsCOMPtr<nsIURI> nntpUri = do_CreateInstance(NS_NNTPURL_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv,rv);
 
     if (aBaseURI)
     {
       nsAutoCString newSpec;
       aBaseURI->Resolve(aSpec, newSpec);
-      rv = nntpUri->SetSpec(newSpec);
+      rv = nntpUri->SetSpecInternal(newSpec);
     }
     else
     {
-      rv = nntpUri->SetSpec(aSpec);
+      rv = nntpUri->SetSpecInternal(aSpec);
     }
     NS_ENSURE_SUCCESS(rv,rv);
 
     nntpUri.forget(_retval);
     return NS_OK;
 }
 
 NS_IMETHODIMP nsNntpService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
--- a/mailnews/news/src/nsNntpUrl.cpp
+++ b/mailnews/news/src/nsNntpUrl.cpp
@@ -67,17 +67,17 @@ NS_INTERFACE_MAP_END_INHERITING(nsMsgMai
  * nntp://host/group/key
  * news-message://host/group#key
  *
  * In addition, we use queries on the news URIs with authorities for internal
  * NNTP processing. The most important one is ?group=group&key=key, for cache
  * canonicalization.
  */
 
-NS_IMETHODIMP nsNntpUrl::SetSpec(const nsACString &aSpec)
+nsresult nsNntpUrl::SetSpecInternal(const nsACString &aSpec)
 {
   // For [s]news: URIs, we need to munge the spec if it is no authority, because
   // the URI parser guesses the wrong thing otherwise
   nsCString parseSpec(aSpec);
   int32_t colon = parseSpec.Find(":");
 
   // Our smallest scheme is 4 characters long, so colon must be at least 4
   if (colon < 4 || colon + 1 == (int32_t) parseSpec.Length())
@@ -88,17 +88,17 @@ NS_IMETHODIMP nsNntpUrl::SetSpec(const n
   {
     // To make this parse properly, we add in three slashes, which convinces the
     // parser that the authority component is empty.
     parseSpec = Substring(aSpec, 0, colon + 1);
     parseSpec.AppendLiteral("///");
     parseSpec += Substring(aSpec, colon + 1);
   }
 
-  nsresult rv = nsMsgMailNewsUrl::SetSpec(parseSpec);
+  nsresult rv = nsMsgMailNewsUrl::SetSpecInternal(parseSpec);
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsAutoCString scheme;
   rv = GetScheme(scheme);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (scheme.EqualsLiteral("news") || scheme.EqualsLiteral("snews"))
     rv = ParseNewsURL();
--- a/mailnews/news/src/nsNntpUrl.h
+++ b/mailnews/news/src/nsNntpUrl.h
@@ -14,17 +14,17 @@
 class nsNntpUrl : public nsINntpUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl, public nsIMsgI18NUrl
 {
 public:
   NS_DECL_NSINNTPURL
   NS_DECL_NSIMSGMESSAGEURL
   NS_DECL_NSIMSGI18NURL
 
   // nsIURI over-ride...
-  NS_IMETHOD SetSpec(const nsACString &aSpec) override;
+  nsresult SetSpecInternal(const nsACString &aSpec) override;
 
   NS_IMETHOD IsUrlType(uint32_t type, bool *isType) override;
 
   // nsIMsgMailNewsUrl overrides
   NS_IMETHOD GetServer(nsIMsgIncomingServer **server) override;
   NS_IMETHOD GetFolder(nsIMsgFolder **msgFolder) override;
   NS_IMETHOD CloneInternal(uint32_t aRefHandlingMode,
                            const nsACString& newRef,nsIURI **_retval) override;