Bug 1088497, implement NewChannel2 in mailnews, r=jcranmer
authorKent James <kent>
Fri, 24 Oct 2014 10:05:00 -0500
changeset 21170 0e9dfec40751925da4c8e9cb6b48d3c27de420fa
parent 21169 1a8314ae0ae54b0e98aae095db3e5553a369906e
child 21171 d57ce6c3e3433fdfd159e9633646617755c38392
push id1274
push usermbanner@mozilla.com
push dateMon, 12 Jan 2015 19:54:49 +0000
treeherdercomm-beta@baea280adc1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcranmer
bugs1088497
Bug 1088497, implement NewChannel2 in mailnews, r=jcranmer
calendar/base/src/calProtocolHandler.js
calendar/lightning/components/calItipProtocolHandler.js
chat/components/src/smileProtocolHandler.js
ldap/xpcom/src/nsLDAPProtocolHandler.js
mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
mailnews/base/src/nsCidProtocolHandler.cpp
mailnews/compose/src/nsSMTPProtocolHandler.js
mailnews/compose/src/nsSmtpService.cpp
mailnews/imap/src/nsImapService.cpp
mailnews/local/src/nsMailboxService.cpp
mailnews/local/src/nsPop3Service.cpp
mailnews/news/src/nsNntpService.cpp
--- a/calendar/base/src/calProtocolHandler.js
+++ b/calendar/base/src/calProtocolHandler.js
@@ -34,26 +34,31 @@ calProtocolHandler.prototype = {
         var uri = Components.classes["@mozilla.org/network/standard-url;1"].
                              createInstance(Components.interfaces.nsIStandardURL);
         uri.init(Components.interfaces.nsIStandardURL.URLTYPE_STANDARD, 
                  this.mHttpProtocol.defaultPort, aSpec, anOriginalCharset, aBaseURI);
         return uri;
     },
     
     newChannel: function cph_newChannel(aUri) {
+      return this.newChannel2(aUri, null);
+    },
+
+    newChannel2: function cph_newChannel2(aUri, aLoadInfo)
+    {
         // make sure to clone the uri, because we are about to change
         // it, and we don't want to change the original uri.
         var uri = aUri.clone();
         uri.scheme = this.mHttpProtocol.scheme;
 
         var channel = Services.io.newChannelFromURI(uri, null);
         channel.originalURI = aUri;
         return channel;
     },
-    
+
     // We are not overriding any special ports
     allowPort: function cph_allowPort(aPort, aScheme) false
 };
 
 const calProtocolHandlerWebcalClassID = Components.ID("{1153c73a-39be-46aa-9ba9-656d188865ca}");
 const calProtocolHandlerWebcalInterfaces = [Components.interfaces.nsIProtocolHandler];
 calProtocolHandlerWebcal.prototype = {
     __proto__: calProtocolHandler.prototype,
--- a/calendar/lightning/components/calItipProtocolHandler.js
+++ b/calendar/lightning/components/calItipProtocolHandler.js
@@ -78,16 +78,21 @@ ItipProtocolHandler.prototype = {
         let cls = Components.classes["@mozilla.org/network/standard-url;1"];
         let url = cls.createInstance(CI.nsIStandardURL);
         url.init(CI.nsIStandardURL.URLTYPE_STANDARD, 0, spec, charSet, baseURI);
         dump("Creating new URI for " + spec + "\n");
         return url.QueryInterface(CI.nsIURI);
     },
     
     newChannel: function (URI) {
+        return this.newChannel2(URI, null);
+    },
+
+    newChannel2: function(URI, aLoadInfo)
+    {
         dump("Creating new ItipChannel for " + URI + "\n");
         return new ItipChannel(URI);
     },
 };
 
 function ItipContentHandler() {
     this.wrappedJSObject = this;
 }
--- a/chat/components/src/smileProtocolHandler.js
+++ b/chat/components/src/smileProtocolHandler.js
@@ -22,16 +22,19 @@ smileProtocolHandler.prototype = {
   newURI: function SPH_newURI(aSpec, aOriginCharset, aBaseURI) {
     let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
     uri.spec = aSpec;
     uri.QueryInterface(Ci.nsIMutable);
     uri.mutable = false;
     return uri;
   },
   newChannel: function SPH_newChannel(aURI) {
+    return this.newChannel2(aURI, null);
+  },
+  newChannel2: function SPH_newChannel2(aURI, aLoadInfo) {
     let smile = aURI.spec.replace(kSmileRegexp, "");
     let channel = Services.io.newChannel(getSmileRealURI(smile), null, null);
     channel.originalURI = aURI;
     return channel;
   },
   allowPort: function  SPH_allowPort(aPort, aScheme) false,
 
   classDescription: "Smile Protocol Handler",
--- a/ldap/xpcom/src/nsLDAPProtocolHandler.js
+++ b/ldap/xpcom/src/nsLDAPProtocolHandler.js
@@ -25,16 +25,20 @@ function makeProtocolHandler(aCID, aProt
       if (url instanceof Components.interfaces.nsILDAPURL)
 	url.init(Components.interfaces.nsIStandardURL.URLTYPE_STANDARD,
 		 aDefaultPort, aSpec, aOriginCharset, aBaseURI);
 
       return url;
     },
 
     newChannel: function (aURI) {
+      return this.newChannel2(aURI, null);
+    },
+
+    newChannel2: function (aURI, aLoadInfo) {
       if ("@mozilla.org/network/ldap-channel;1" in Components.classes) {
         var channel = Components.classes["@mozilla.org/network/ldap-channel;1"]
                                 .createInstance(Components.interfaces.nsIChannel);
         channel.init(aURI);
         return channel;
       }
 
       throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
--- a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
+++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
@@ -108,19 +108,27 @@ nsAddbookProtocolHandler::GenerateXMLOut
                                 nsIContentPolicy::TYPE_OTHER,
                                 NS_LITERAL_CSTRING("text/xml"));
   NS_ENSURE_SUCCESS(rv, rv);
   
   *_retval = channel;
   return rv;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsAddbookProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
+  return NewChannel2(aURI, nullptr, _retval);
+}
+
+NS_IMETHODIMP
+nsAddbookProtocolHandler::NewChannel2(nsIURI *aURI,
+                                      nsILoadInfo* aLoadInfo,
+                                      nsIChannel **_retval)
+{
   nsresult rv;
   nsCOMPtr <nsIAddbookUrl> addbookUrl = do_QueryInterface(aURI, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
   
   rv = addbookUrl->GetAddbookOperation(&mAddbookOperation);
   NS_ENSURE_SUCCESS(rv,rv);
 
   if (mAddbookOperation == nsIAddbookUrlOperation::InvalidUrl) {
--- a/mailnews/base/src/nsCidProtocolHandler.cpp
+++ b/mailnews/base/src/nsCidProtocolHandler.cpp
@@ -54,13 +54,20 @@ NS_IMETHODIMP nsCidProtocolHandler::NewU
   return NS_OK;
 }
 
 NS_IMETHODIMP nsCidProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
+NS_IMETHODIMP nsCidProtocolHandler::NewChannel2(nsIURI *aURI,
+                                                nsILoadInfo* aLoadInfo,
+                                                nsIChannel **_retval)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
 NS_IMETHODIMP nsCidProtocolHandler::AllowPort(int32_t port, const char *scheme, bool *_retval)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
--- a/mailnews/compose/src/nsSMTPProtocolHandler.js
+++ b/mailnews/compose/src/nsSMTPProtocolHandler.js
@@ -27,16 +27,21 @@ function makeProtocolHandler(aProtocol, 
 
       return url;
     },
 
     newChannel: function (aURI) {
       throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
     },
 
+    newChannel2: function(aURI, aLoadInfo)
+    {
+      throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+    },
+
     allowPort: function (port, scheme) {
       return port == aDefaultPort;
     }
   };
 }
 
 function nsSMTPProtocolHandler() {}
 
--- a/mailnews/compose/src/nsSmtpService.cpp
+++ b/mailnews/compose/src/nsSmtpService.cpp
@@ -315,16 +315,23 @@ NS_IMETHODIMP nsSmtpService::NewURI(cons
   NS_ENSURE_SUCCESS(rv, rv);
 
   mailtoUrl.forget(_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsSmtpService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
+  return NewChannel2(aURI, nullptr, _retval);
+}
+
+NS_IMETHODIMP nsSmtpService::NewChannel2(nsIURI *aURI,
+                                         nsILoadInfo* aLoadInfo,
+                                         nsIChannel **_retval)
+{
   NS_ENSURE_ARG_POINTER(aURI);
   // create an empty pipe for use with the input stream channel.
   nsCOMPtr<nsIAsyncInputStream> pipeIn;
   nsCOMPtr<nsIAsyncOutputStream> pipeOut;
   nsCOMPtr<nsIPipe> pipe = do_CreateInstance("@mozilla.org/pipe;1");
   nsresult rv = pipe->Init(false, false, 0, 0);
   if (NS_FAILED(rv)) 
     return rv;
@@ -341,17 +348,16 @@ NS_IMETHODIMP nsSmtpService::NewChannel(
     return rv;
 
   return NS_NewInputStreamChannel(_retval, aURI, pipeIn,
                                   nullPrincipal, nsILoadInfo::SEC_NORMAL,
                                   nsIContentPolicy::TYPE_OTHER,
                                   NS_LITERAL_CSTRING("application/x-mailto"));
 }
 
-
 NS_IMETHODIMP
 nsSmtpService::GetServers(nsISimpleEnumerator **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
   // now read in the servers from prefs if necessary
   uint32_t serverCount = mSmtpServers.Count();
 
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2624,16 +2624,23 @@ NS_IMETHODIMP nsImapService::NewURI(cons
 
   imapUri.swap(*aRetVal);
 
   return rv;
 }
 
 NS_IMETHODIMP nsImapService::NewChannel(nsIURI *aURI, nsIChannel **aRetVal)
 {
+  return NewChannel2(aURI, nullptr, aRetVal);
+}
+
+NS_IMETHODIMP nsImapService::NewChannel2(nsIURI *aURI,
+                                         nsILoadInfo* aLoadInfo,
+                                         nsIChannel **aRetVal)
+{
   NS_ENSURE_ARG_POINTER(aURI);
   NS_ENSURE_ARG_POINTER(aRetVal);
   *aRetVal = nullptr;
 
   nsresult rv;
   nsCOMPtr<nsIImapUrl> imapUrl = do_QueryInterface(aURI, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr <nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(imapUrl, &rv);
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -567,16 +567,23 @@ NS_IMETHODIMP nsMailboxService::NewURI(c
   }
   aMsgUri.swap(*_retval);
 
   return rv;
 }
 
 NS_IMETHODIMP nsMailboxService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
+  return NewChannel2(aURI, nullptr, _retval);
+}
+
+NS_IMETHODIMP nsMailboxService::NewChannel2(nsIURI *aURI,
+                                            nsILoadInfo *aLoadInfo,
+                                            nsIChannel **_retval)
+{
   NS_ENSURE_ARG_POINTER(aURI);
   NS_ENSURE_ARG_POINTER(_retval);
   nsresult rv = NS_OK;
   nsAutoCString spec;
   aURI->GetSpec(spec);
 
   if (spec.Find("?uidl=") >= 0 || spec.Find("&uidl=") >= 0)
   {
--- a/mailnews/local/src/nsPop3Service.cpp
+++ b/mailnews/local/src/nsPop3Service.cpp
@@ -472,16 +472,23 @@ void nsPop3Service::AlertServerBusy(nsIM
     MOZ_UTF16("pop3ErrorDialogTitle"),
     params, 1, getter_Copies(dialogTitle));
   if (!alertString.IsEmpty())
     dialog->Alert(dialogTitle.get(), alertString.get());
 }
 
 NS_IMETHODIMP nsPop3Service::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
+  return NewChannel2(aURI, nullptr, _retval);
+}
+
+NS_IMETHODIMP nsPop3Service::NewChannel2(nsIURI *aURI,
+                                         nsILoadInfo *aLoadInfo,
+                                         nsIChannel **_retval)
+{
   NS_ENSURE_ARG_POINTER(aURI);
   nsresult rv;
 
   nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(aURI, &rv);
   nsCString realUserName;
   if (NS_SUCCEEDED(rv) && url)
   {
     nsCOMPtr<nsIMsgIncomingServer> server;
--- a/mailnews/news/src/nsNntpService.cpp
+++ b/mailnews/news/src/nsNntpService.cpp
@@ -1227,16 +1227,23 @@ NS_IMETHODIMP nsNntpService::NewURI(cons
     NS_ENSURE_SUCCESS(rv,rv);
 
     NS_ADDREF(*_retval = nntpUri);
     return NS_OK;
 }
 
 NS_IMETHODIMP nsNntpService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
+  return NewChannel2(aURI, nullptr, _retval);
+}
+
+NS_IMETHODIMP nsNntpService::NewChannel2(nsIURI *aURI,
+                                         nsILoadInfo *aLoadInfo,
+                                         nsIChannel **_retval)
+{
   NS_ENSURE_ARG_POINTER(aURI);
   nsresult rv = NS_OK;
   nsCOMPtr<nsINntpIncomingServer> server;
   rv = GetServerForUri(aURI, getter_AddRefs(server));
   NS_ENSURE_SUCCESS(rv, rv);
   return server->GetNntpChannel(aURI, nullptr, _retval);
 }