Bug 1528971: Move newChannel2 being the only implementation within nsIProtocolHandler.idl. r=valentin
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Tue, 19 Feb 2019 19:20:37 +0100
changeset 517975 ec2056010064217db0dc48b9a70a7174eb3d254a
parent 517974 eb4fd889c65701a45c7b357e7d3f930ac655aa09
child 517976 1b04fd61d51221a8bb1ecc383c72e6b63b09fc7d
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1528971
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1528971: Move newChannel2 being the only implementation within nsIProtocolHandler.idl. r=valentin
chrome/nsChromeProtocolHandler.cpp
chrome/test/unit/test_no_remote_registration.js
dom/base/test/chrome/test_bug682305.html
dom/file/uri/BlobURLProtocolHandler.cpp
dom/file/uri/FontTableURIProtocolHandler.cpp
dom/jsurl/nsJSProtocolHandler.cpp
image/decoders/icon/nsIconProtocolHandler.cpp
modules/libjar/nsJARProtocolHandler.cpp
netwerk/base/nsIOService.cpp
netwerk/base/nsIProtocolHandler.idl
netwerk/protocol/about/nsAboutProtocolHandler.cpp
netwerk/protocol/data/nsDataHandler.cpp
netwerk/protocol/file/nsFileProtocolHandler.cpp
netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
netwerk/protocol/gio/nsGIOProtocolHandler.cpp
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/res/SubstitutingProtocolHandler.cpp
netwerk/protocol/viewsource/nsViewSourceHandler.cpp
netwerk/protocol/websocket/BaseWebSocketChannel.cpp
netwerk/protocol/wyciwyg/nsWyciwygProtocolHandler.cpp
netwerk/test/browser/browser_nsIFormPOSTActionChannel.js
netwerk/test/unit/test_bug894586.js
netwerk/test/unit/test_protocolproxyservice-async-filters.js
netwerk/test/unit/test_protocolproxyservice.js
toolkit/components/mozprotocol/MozProtocolHandler.jsm
toolkit/components/places/PageIconProtocolHandler.jsm
toolkit/components/places/nsAnnoProtocolHandler.cpp
toolkit/components/places/nsFaviconService.cpp
toolkit/components/thumbnails/PageThumbsProtocol.cpp
toolkit/components/thumbnails/test/test_thumbnails_interfaces.js
uriloader/exthandler/nsExternalProtocolHandler.cpp
widget/android/nsAndroidProtocolHandler.cpp
--- a/chrome/nsChromeProtocolHandler.cpp
+++ b/chrome/nsChromeProtocolHandler.cpp
@@ -87,18 +87,18 @@ nsChromeProtocolHandler::NewURI(const ns
   rv = nsChromeRegistry::Canonify(surl);
   if (NS_FAILED(rv)) return rv;
 
   surl.forget(result);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsChromeProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
-                                     nsIChannel **aResult) {
+nsChromeProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
+                                    nsIChannel **aResult) {
   nsresult rv;
 
   NS_ENSURE_ARG_POINTER(aURI);
   NS_ENSURE_ARG_POINTER(aLoadInfo);
 
   MOZ_ASSERT(aResult, "Null out param");
 
 #ifdef DEBUG
@@ -186,14 +186,9 @@ nsChromeProtocolHandler::NewChannel2(nsI
   // See bug 531886, bug 533038.
   result->SetContentCharset(NS_LITERAL_CSTRING("UTF-8"));
 
   *aResult = result;
   NS_ADDREF(*aResult);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsChromeProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult) {
-  return NewChannel2(aURI, nullptr, aResult);
-}
-
 ////////////////////////////////////////////////////////////////////////////////
--- a/chrome/test/unit/test_no_remote_registration.js
+++ b/chrome/test/unit/test_no_remote_registration.js
@@ -25,17 +25,16 @@ ProtocolHandler.prototype =
                     .createInstance(Ci.nsIURIMutator);
     if (aBaseURI) {
       mutator.setSpec(aBaseURI.resolve(aSpec));
     } else {
       mutator.setSpec(aSpec);
     }
     return mutator.finalize();
   },
-  newChannel2() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
   newChannel() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIProtocolHandler,
   ]),
 };
 
 var testProtocols = [
   // It doesn't matter if it has this flag - the only flag we accept is
--- a/dom/base/test/chrome/test_bug682305.html
+++ b/dom/base/test/chrome/test_bug682305.html
@@ -109,22 +109,19 @@ CustomProtocol.prototype = {
     return false;
   },
   newURI: function newURI(spec, charset, baseURI) {
     return Cc["@mozilla.org/network/simple-uri-mutator;1"]
              .createInstance(Ci.nsIURIMutator)
              .setSpec(spec)
              .finalize();
   },
-  newChannel2: function newChannel2(URI, loadInfo) {
+  newChannel: function newChannel2(URI, loadInfo) {
     return new CustomChannel(URI, loadInfo);
   },
-  newChannel: function newChannel(URI) {
-    return this.newChannel2(URI);
-  },
   QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIProtocolHandler]),
 };
 
 var gFactory = {
   register() {
     var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
 
     var classID = Components.ID("{ed064287-1e76-49ba-a28d-dc74394a8334}");
--- a/dom/file/uri/BlobURLProtocolHandler.cpp
+++ b/dom/file/uri/BlobURLProtocolHandler.cpp
@@ -760,18 +760,18 @@ BlobURLProtocolHandler::NewURI(const nsA
   MOZ_ASSERT(blobURL);
   blobURL->mRevoked = revoked;
 
   uri.forget(aResult);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-BlobURLProtocolHandler::NewChannel2(nsIURI* aURI, nsILoadInfo* aLoadInfo,
-                                    nsIChannel** aResult) {
+BlobURLProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
+                                   nsIChannel** aResult) {
   RefPtr<BlobURLChannel> channel = new BlobURLChannel(aURI, aLoadInfo);
 
   auto raii = MakeScopeExit([&] {
     channel->InitFailed();
     channel.forget(aResult);
   });
 
   RefPtr<BlobURL> blobURL;
@@ -810,21 +810,16 @@ BlobURLProtocolHandler::NewChannel2(nsIU
   raii.release();
 
   channel->Initialize(info->mBlobImpl);
   channel.forget(aResult);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-BlobURLProtocolHandler::NewChannel(nsIURI* uri, nsIChannel** result) {
-  return NewChannel2(uri, nullptr, result);
-}
-
-NS_IMETHODIMP
 BlobURLProtocolHandler::AllowPort(int32_t port, const char* scheme,
                                   bool* _retval) {
   // don't override anything.
   *_retval = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/dom/file/uri/FontTableURIProtocolHandler.cpp
+++ b/dom/file/uri/FontTableURIProtocolHandler.cpp
@@ -53,23 +53,18 @@ FontTableURIProtocolHandler::GetProtocol
 }
 
 NS_IMETHODIMP
 FontTableURIProtocolHandler::GetFlagsForURI(nsIURI *aURI, uint32_t *aResult) {
   return FontTableURIProtocolHandler::GetProtocolFlags(aResult);
 }
 
 NS_IMETHODIMP
-FontTableURIProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
-                                         nsIChannel **result) {
-  return NS_ERROR_DOM_BAD_URI;
-}
-
-NS_IMETHODIMP
-FontTableURIProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
+FontTableURIProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
+                                        nsIChannel **result) {
   return NS_ERROR_DOM_BAD_URI;
 }
 
 NS_IMETHODIMP
 FontTableURIProtocolHandler::AllowPort(int32_t port, const char *scheme,
                                        bool *_retval) {
   *_retval = false;
   return NS_OK;
--- a/dom/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/jsurl/nsJSProtocolHandler.cpp
@@ -1118,18 +1118,18 @@ nsJSProtocolHandler::NewURI(const nsACSt
     return rv;
   }
 
   url.forget(result);
   return rv;
 }
 
 NS_IMETHODIMP
-nsJSProtocolHandler::NewChannel2(nsIURI* uri, nsILoadInfo* aLoadInfo,
-                                 nsIChannel** result) {
+nsJSProtocolHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
+                                nsIChannel** result) {
   nsresult rv;
 
   NS_ENSURE_ARG_POINTER(uri);
   RefPtr<nsJSChannel> channel = new nsJSChannel();
   if (!channel) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
@@ -1138,21 +1138,16 @@ nsJSProtocolHandler::NewChannel2(nsIURI*
 
   if (NS_SUCCEEDED(rv)) {
     channel.forget(result);
   }
   return rv;
 }
 
 NS_IMETHODIMP
-nsJSProtocolHandler::NewChannel(nsIURI* uri, nsIChannel** result) {
-  return NewChannel2(uri, nullptr, result);
-}
-
-NS_IMETHODIMP
 nsJSProtocolHandler::AllowPort(int32_t port, const char* scheme,
                                bool* _retval) {
   // don't override anything.
   *_retval = false;
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////
--- a/image/decoders/icon/nsIconProtocolHandler.cpp
+++ b/image/decoders/icon/nsIconProtocolHandler.cpp
@@ -59,18 +59,18 @@ nsIconProtocolHandler::NewURI(const nsAC
                               const char* aOriginCharset,  // ignored
                               nsIURI* aBaseURI, nsIURI** result) {
   return NS_MutateURI(new nsMozIconURI::Mutator())
       .SetSpec(aSpec)
       .Finalize(result);
 }
 
 NS_IMETHODIMP
-nsIconProtocolHandler::NewChannel2(nsIURI* url, nsILoadInfo* aLoadInfo,
-                                   nsIChannel** result) {
+nsIconProtocolHandler::NewChannel(nsIURI* url, nsILoadInfo* aLoadInfo,
+                                  nsIChannel** result) {
   NS_ENSURE_ARG_POINTER(url);
   nsIconChannel* channel = new nsIconChannel;
   if (!channel) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   NS_ADDREF(channel);
 
   nsresult rv = channel->Init(url);
@@ -85,14 +85,9 @@ nsIconProtocolHandler::NewChannel2(nsIUR
     NS_RELEASE(channel);
     return rv;
   }
 
   *result = channel;
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsIconProtocolHandler::NewChannel(nsIURI* url, nsIChannel** result) {
-  return NewChannel2(url, nullptr, result);
-}
-
 ////////////////////////////////////////////////////////////////////////////////
--- a/modules/libjar/nsJARProtocolHandler.cpp
+++ b/modules/libjar/nsJARProtocolHandler.cpp
@@ -101,18 +101,18 @@ nsJARProtocolHandler::NewURI(const nsACS
   nsCOMPtr<nsIURI> base(aBaseURI);
   return NS_MutateURI(new nsJARURI::Mutator())
       .Apply(NS_MutatorMethod(&nsIJARURIMutator::SetSpecBaseCharset,
                               nsCString(aSpec), base, aCharset))
       .Finalize(result);
 }
 
 NS_IMETHODIMP
-nsJARProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
-                                  nsIChannel **result) {
+nsJARProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
+                                 nsIChannel **result) {
   nsJARChannel *chan = new nsJARChannel();
   if (!chan) return NS_ERROR_OUT_OF_MEMORY;
   NS_ADDREF(chan);
 
   nsresult rv = chan->Init(uri);
   if (NS_FAILED(rv)) {
     NS_RELEASE(chan);
     return rv;
@@ -125,21 +125,16 @@ nsJARProtocolHandler::NewChannel2(nsIURI
     return rv;
   }
 
   *result = chan;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsJARProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
-  return NewChannel2(uri, nullptr, result);
-}
-
-NS_IMETHODIMP
 nsJARProtocolHandler::AllowPort(int32_t port, const char *scheme,
                                 bool *_retval) {
   // don't override anything.
   *_retval = false;
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -916,31 +916,23 @@ nsresult nsIOService::NewChannelFromURIW
   nsCOMPtr<nsIProtocolHandler> handler;
   rv = GetProtocolHandler(scheme.get(), getter_AddRefs(handler));
   if (NS_FAILED(rv)) return rv;
 
   uint32_t protoFlags;
   rv = handler->DoGetProtocolFlags(aURI, &protoFlags);
   if (NS_FAILED(rv)) return rv;
 
-  // Ideally we are creating new channels by calling NewChannel2
-  // (NewProxiedChannel2). Keep in mind that Addons can implement their own
-  // Protocolhandlers, hence NewChannel2() might *not* be implemented. We do not
-  // want to break those addons, therefore we first try to create a channel
-  // calling NewChannel2(); if that fails:
-  // * we fall back to creating a channel by calling NewChannel()
-  // * wrap the addon channel
-  // * and attach the loadInfo to the channel wrapper
   nsCOMPtr<nsIChannel> channel;
   nsCOMPtr<nsIProxiedProtocolHandler> pph = do_QueryInterface(handler);
   if (pph) {
     rv = pph->NewProxiedChannel2(aURI, nullptr, aProxyFlags, aProxyURI,
                                  aLoadInfo, getter_AddRefs(channel));
   } else {
-    rv = handler->NewChannel2(aURI, aLoadInfo, getter_AddRefs(channel));
+    rv = handler->NewChannel(aURI, aLoadInfo, getter_AddRefs(channel));
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Make sure that all the individual protocolhandlers attach a loadInfo.
   if (aLoadInfo) {
     // make sure we have the same instance of loadInfo on the newly created
     // channel
     nsCOMPtr<nsILoadInfo> loadInfo = channel->GetLoadInfo();
--- a/netwerk/base/nsIProtocolHandler.idl
+++ b/netwerk/base/nsIProtocolHandler.idl
@@ -108,22 +108,17 @@ interface nsIProtocolHandler : nsISuppor
     nsIURI newURI(in AUTF8String aSpec,
                   [optional] in string aOriginCharset,
                   [optional] in nsIURI aBaseURI);
 
     /**
      * Constructs a new channel from the given URI for this protocol handler and
      * sets the loadInfo for the constructed channel.
      */
-    nsIChannel newChannel2(in nsIURI aURI, in nsILoadInfo aLoadinfo);
-
-    /**
-     * Constructs a new channel from the given URI for this protocol handler.
-     */
-    nsIChannel newChannel(in nsIURI aURI);
+    nsIChannel newChannel(in nsIURI aURI, in nsILoadInfo aLoadinfo);
 
     /**
      * Allows a protocol to override blacklisted ports.
      *
      * This method will be called when there is an attempt to connect to a port 
      * that is blacklisted.  For example, for most protocols, port 25 (Simple Mail
      * Transfer) is banned.  When a URI containing this "known-to-do-bad-things" 
      * port number is encountered, this function will be called to ask if the 
--- a/netwerk/protocol/about/nsAboutProtocolHandler.cpp
+++ b/netwerk/protocol/about/nsAboutProtocolHandler.cpp
@@ -154,18 +154,18 @@ nsAboutProtocolHandler::NewURI(const nsA
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   url.swap(*result);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsAboutProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
-                                    nsIChannel **result) {
+nsAboutProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
+                                   nsIChannel **result) {
   NS_ENSURE_ARG_POINTER(uri);
 
   // about:what you ask?
   nsCOMPtr<nsIAboutModule> aboutMod;
   nsresult rv = NS_GetAboutModule(uri, getter_AddRefs(aboutMod));
 
   bool aboutPageAllowed = true;
   nsAutoCString path;
@@ -257,21 +257,16 @@ nsAboutProtocolHandler::NewChannel2(nsIU
     // this to an invalid URI error.
     rv = NS_ERROR_MALFORMED_URI;
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsAboutProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
-  return NewChannel2(uri, nullptr, result);
-}
-
-NS_IMETHODIMP
 nsAboutProtocolHandler::AllowPort(int32_t port, const char *scheme,
                                   bool *_retval) {
   // don't override anything.
   *_retval = false;
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -310,24 +305,18 @@ nsSafeAboutProtocolHandler::NewURI(const
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSafeAboutProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
-                                        nsIChannel **result) {
-  *result = nullptr;
-  return NS_ERROR_NOT_AVAILABLE;
-}
-
-NS_IMETHODIMP
-nsSafeAboutProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
+nsSafeAboutProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
+                                       nsIChannel **result) {
   *result = nullptr;
   return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
 nsSafeAboutProtocolHandler::AllowPort(int32_t port, const char *scheme,
                                       bool *_retval) {
   // don't override anything.
--- a/netwerk/protocol/data/nsDataHandler.cpp
+++ b/netwerk/protocol/data/nsDataHandler.cpp
@@ -89,18 +89,18 @@ nsDataHandler::NewURI(const nsACString& 
 
   if (NS_FAILED(rv)) return rv;
 
   uri.forget(result);
   return rv;
 }
 
 NS_IMETHODIMP
-nsDataHandler::NewChannel2(nsIURI* uri, nsILoadInfo* aLoadInfo,
-                           nsIChannel** result) {
+nsDataHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
+                          nsIChannel** result) {
   NS_ENSURE_ARG_POINTER(uri);
   nsDataChannel* channel;
   if (XRE_IsParentProcess()) {
     channel = new nsDataChannel(uri);
   } else {
     channel = new mozilla::net::DataChannelChild(uri);
   }
   NS_ADDREF(channel);
@@ -118,21 +118,16 @@ nsDataHandler::NewChannel2(nsIURI* uri, 
     return rv;
   }
 
   *result = channel;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDataHandler::NewChannel(nsIURI* uri, nsIChannel** result) {
-  return NewChannel2(uri, nullptr, result);
-}
-
-NS_IMETHODIMP
 nsDataHandler::AllowPort(int32_t port, const char* scheme, bool* _retval) {
   // don't override anything.
   *_retval = false;
   return NS_OK;
 }
 
 /**
  * Helper that performs a case insensitive match to find the offset of a given
--- a/netwerk/protocol/file/nsFileProtocolHandler.cpp
+++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp
@@ -159,18 +159,18 @@ nsFileProtocolHandler::NewURI(const nsAC
       .Apply(NS_MutatorMethod(&nsIFileURLMutator::MarkFileURL))
       .Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
                               nsIStandardURL::URLTYPE_NO_AUTHORITY, -1, buf,
                               charset, base, nullptr))
       .Finalize(result);
 }
 
 NS_IMETHODIMP
-nsFileProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
-                                   nsIChannel **result) {
+nsFileProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
+                                  nsIChannel **result) {
   nsresult rv;
 
   nsFileChannel *chan;
   if (IsNeckoChild()) {
     chan = new mozilla::net::FileChannelChild(uri);
   } else {
     chan = new nsFileChannel(uri);
   }
@@ -192,21 +192,16 @@ nsFileProtocolHandler::NewChannel2(nsIUR
     return rv;
   }
 
   *result = chan;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsFileProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
-  return NewChannel2(uri, nullptr, result);
-}
-
-NS_IMETHODIMP
 nsFileProtocolHandler::AllowPort(int32_t port, const char *scheme,
                                  bool *result) {
   // don't override anything.
   *result = false;
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
--- a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
+++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
@@ -166,27 +166,22 @@ nsFtpProtocolHandler::NewURI(const nsACS
   return NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID)
       .Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
                               nsIStandardURL::URLTYPE_AUTHORITY, 21,
                               nsCString(aSpec), aCharset, base, nullptr))
       .Finalize(result);
 }
 
 NS_IMETHODIMP
-nsFtpProtocolHandler::NewChannel2(nsIURI *url, nsILoadInfo *aLoadInfo,
-                                  nsIChannel **result) {
+nsFtpProtocolHandler::NewChannel(nsIURI *url, nsILoadInfo *aLoadInfo,
+                                 nsIChannel **result) {
   return NewProxiedChannel2(url, nullptr, 0, nullptr, aLoadInfo, result);
 }
 
 NS_IMETHODIMP
-nsFtpProtocolHandler::NewChannel(nsIURI *url, nsIChannel **result) {
-  return NewChannel2(url, nullptr, result);
-}
-
-NS_IMETHODIMP
 nsFtpProtocolHandler::NewProxiedChannel2(nsIURI *uri, nsIProxyInfo *proxyInfo,
                                          uint32_t proxyResolveFlags,
                                          nsIURI *proxyURI,
                                          nsILoadInfo *aLoadInfo,
                                          nsIChannel **result) {
   NS_ENSURE_ARG_POINTER(uri);
   RefPtr<nsBaseChannel> channel;
   if (IsNeckoChild())
--- a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp
+++ b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp
@@ -960,18 +960,18 @@ nsGIOProtocolHandler::NewURI(const nsACS
   return NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID)
       .Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
                               nsIStandardURL::URLTYPE_STANDARD, -1, flatSpec,
                               aOriginCharset, base, nullptr))
       .Finalize(aResult);
 }
 
 NS_IMETHODIMP
-nsGIOProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
-                                  nsIChannel **aResult) {
+nsGIOProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
+                                 nsIChannel **aResult) {
   NS_ENSURE_ARG_POINTER(aURI);
   nsresult rv;
 
   nsAutoCString spec;
   rv = aURI->GetSpec(spec);
   if (NS_FAILED(rv)) return rv;
 
   RefPtr<nsGIOInputStream> stream = new nsGIOInputStream(spec);
@@ -987,21 +987,16 @@ nsGIOProtocolHandler::NewChannel2(nsIURI
                                        aLoadInfo);
   if (NS_SUCCEEDED(rv)) {
     stream->SetChannel(*aResult);
   }
   return rv;
 }
 
 NS_IMETHODIMP
-nsGIOProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult) {
-  return NewChannel2(aURI, nullptr, aResult);
-}
-
-NS_IMETHODIMP
 nsGIOProtocolHandler::AllowPort(int32_t aPort, const char *aScheme,
                                 bool *aResult) {
   // Don't override anything.
   *aResult = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -3662,17 +3662,17 @@ nsresult nsHttpChannel::ProcessFallback(
   mApplicationCacheForWrite = nullptr;
   mOfflineCacheEntry = nullptr;
 
   // Close the current cache entry.
   CloseCacheEntry(true);
 
   // Create a new channel to load the fallback entry.
   RefPtr<nsIChannel> newChannel;
-  rv = gHttpHandler->NewChannel2(mURI, mLoadInfo, getter_AddRefs(newChannel));
+  rv = gHttpHandler->NewChannel(mURI, mLoadInfo, getter_AddRefs(newChannel));
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint32_t redirectFlags = nsIChannelEventSink::REDIRECT_INTERNAL;
   rv = SetupReplacementChannel(mURI, newChannel, true, redirectFlags);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Make sure the new channel loads from the fallback key.
   nsCOMPtr<nsIHttpChannelInternal> httpInternal =
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -2021,18 +2021,18 @@ nsHttpHandler::GetProtocolFlags(uint32_t
 NS_IMETHODIMP
 nsHttpHandler::NewURI(const nsACString &aSpec, const char *aCharset,
                       nsIURI *aBaseURI, nsIURI **aURI) {
   return mozilla::net::NewURI(aSpec, aCharset, aBaseURI, NS_HTTP_DEFAULT_PORT,
                               aURI);
 }
 
 NS_IMETHODIMP
-nsHttpHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
-                           nsIChannel **result) {
+nsHttpHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
+                          nsIChannel **result) {
   LOG(("nsHttpHandler::NewChannel\n"));
 
   NS_ENSURE_ARG_POINTER(uri);
   NS_ENSURE_ARG_POINTER(result);
 
   bool isHttp = false, isHttps = false;
 
   // Verify that we have been given a valid scheme
@@ -2046,21 +2046,16 @@ nsHttpHandler::NewChannel2(nsIURI *uri, 
       return NS_ERROR_UNEXPECTED;
     }
   }
 
   return NewProxiedChannel2(uri, nullptr, 0, nullptr, aLoadInfo, result);
 }
 
 NS_IMETHODIMP
-nsHttpHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
-  return NewChannel2(uri, nullptr, result);
-}
-
-NS_IMETHODIMP
 nsHttpHandler::AllowPort(int32_t port, const char *scheme, bool *_retval) {
   // don't override anything.
   *_retval = false;
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsHttpHandler::nsIProxiedProtocolHandler
@@ -2558,26 +2553,21 @@ nsHttpsHandler::GetProtocolFlags(uint32_
 NS_IMETHODIMP
 nsHttpsHandler::NewURI(const nsACString &aSpec, const char *aOriginCharset,
                        nsIURI *aBaseURI, nsIURI **_retval) {
   return mozilla::net::NewURI(aSpec, aOriginCharset, aBaseURI,
                               NS_HTTPS_DEFAULT_PORT, _retval);
 }
 
 NS_IMETHODIMP
-nsHttpsHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
-                            nsIChannel **_retval) {
+nsHttpsHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
+                           nsIChannel **_retval) {
   MOZ_ASSERT(gHttpHandler);
   if (!gHttpHandler) return NS_ERROR_UNEXPECTED;
-  return gHttpHandler->NewChannel2(aURI, aLoadInfo, _retval);
-}
-
-NS_IMETHODIMP
-nsHttpsHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval) {
-  return NewChannel2(aURI, nullptr, _retval);
+  return gHttpHandler->NewChannel(aURI, aLoadInfo, _retval);
 }
 
 NS_IMETHODIMP
 nsHttpsHandler::AllowPort(int32_t aPort, const char *aScheme, bool *_retval) {
   // don't override anything.
   *_retval = false;
   return NS_OK;
 }
--- a/netwerk/protocol/res/SubstitutingProtocolHandler.cpp
+++ b/netwerk/protocol/res/SubstitutingProtocolHandler.cpp
@@ -221,19 +221,19 @@ nsresult SubstitutingProtocolHandler::Ne
   nsCOMPtr<nsIURI> base(aBaseURI);
   return NS_MutateURI(new SubstitutingURL::Mutator())
       .Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
                               nsIStandardURL::URLTYPE_STANDARD, -1, spec,
                               aCharset, base, nullptr))
       .Finalize(result);
 }
 
-nsresult SubstitutingProtocolHandler::NewChannel2(nsIURI* uri,
-                                                  nsILoadInfo* aLoadInfo,
-                                                  nsIChannel** result) {
+nsresult SubstitutingProtocolHandler::NewChannel(nsIURI* uri,
+                                                 nsILoadInfo* aLoadInfo,
+                                                 nsIChannel** result) {
   NS_ENSURE_ARG_POINTER(uri);
   NS_ENSURE_ARG_POINTER(aLoadInfo);
 
   nsAutoCString spec;
   nsresult rv = ResolveURI(uri, spec);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIURI> newURI;
@@ -254,21 +254,16 @@ nsresult SubstitutingProtocolHandler::Ne
   rv = aLoadInfo->SetResultPrincipalURI(savedResultPrincipalURI);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = (*result)->SetOriginalURI(uri);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return SubstituteChannel(uri, aLoadInfo, result);
 }
 
-nsresult SubstitutingProtocolHandler::NewChannel(nsIURI* uri,
-                                                 nsIChannel** result) {
-  return NewChannel2(uri, nullptr, result);
-}
-
 nsresult SubstitutingProtocolHandler::AllowPort(int32_t port,
                                                 const char* scheme,
                                                 bool* _retval) {
   // don't override anything.
   *_retval = false;
   return NS_OK;
 }
 
--- a/netwerk/protocol/viewsource/nsViewSourceHandler.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceHandler.cpp
@@ -97,18 +97,18 @@ nsViewSourceHandler::NewURI(const nsACSt
     return rv;
   }
 
   uri.swap(*aResult);
   return rv;
 }
 
 NS_IMETHODIMP
-nsViewSourceHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
-                                 nsIChannel **result) {
+nsViewSourceHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
+                                nsIChannel **result) {
   NS_ENSURE_ARG_POINTER(uri);
   nsViewSourceChannel *channel = new nsViewSourceChannel();
   if (!channel) return NS_ERROR_OUT_OF_MEMORY;
   NS_ADDREF(channel);
 
   nsresult rv = channel->Init(uri);
   if (NS_FAILED(rv)) {
     NS_RELEASE(channel);
@@ -121,21 +121,16 @@ nsViewSourceHandler::NewChannel2(nsIURI 
     NS_RELEASE(channel);
     return rv;
   }
 
   *result = static_cast<nsIViewSourceChannel *>(channel);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsViewSourceHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
-  return NewChannel2(uri, nullptr, result);
-}
-
 nsresult nsViewSourceHandler::NewSrcdocChannel(nsIURI *aURI, nsIURI *aBaseURI,
                                                const nsAString &aSrcdoc,
                                                nsILoadInfo *aLoadInfo,
                                                nsIChannel **outChannel) {
   NS_ENSURE_ARG_POINTER(aURI);
   RefPtr<nsViewSourceChannel> channel = new nsViewSourceChannel();
 
   nsresult rv = channel->InitSrcdoc(aURI, aBaseURI, aSrcdoc, aLoadInfo);
--- a/netwerk/protocol/websocket/BaseWebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/BaseWebSocketChannel.cpp
@@ -288,24 +288,18 @@ BaseWebSocketChannel::NewURI(const nsACS
   return NS_MutateURI(new nsStandardURL::Mutator())
       .Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
                               nsIStandardURL::URLTYPE_AUTHORITY, port,
                               nsCString(aSpec), aOriginCharset, base, nullptr))
       .Finalize(_retval);
 }
 
 NS_IMETHODIMP
-BaseWebSocketChannel::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
-                                  nsIChannel **outChannel) {
-  LOG(("BaseWebSocketChannel::NewChannel2() %p\n", this));
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-BaseWebSocketChannel::NewChannel(nsIURI *aURI, nsIChannel **_retval) {
+BaseWebSocketChannel::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
+                                 nsIChannel **outChannel) {
   LOG(("BaseWebSocketChannel::NewChannel() %p\n", this));
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 BaseWebSocketChannel::AllowPort(int32_t port, const char *scheme,
                                 bool *_retval) {
   LOG(("BaseWebSocketChannel::AllowPort() %p\n", this));
--- a/netwerk/protocol/wyciwyg/nsWyciwygProtocolHandler.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygProtocolHandler.cpp
@@ -61,18 +61,18 @@ nsWyciwygProtocolHandler::NewURI(const n
                                  const char *aCharset,  // ignored
                                  nsIURI *aBaseURI, nsIURI **result) {
   return NS_MutateURI(NS_SIMPLEURIMUTATOR_CONTRACTID)
       .SetSpec(aSpec)
       .Finalize(result);
 }
 
 NS_IMETHODIMP
-nsWyciwygProtocolHandler::NewChannel2(nsIURI *url, nsILoadInfo *aLoadInfo,
-                                      nsIChannel **result) {
+nsWyciwygProtocolHandler::NewChannel(nsIURI *url, nsILoadInfo *aLoadInfo,
+                                     nsIChannel **result) {
   if (mozilla::net::IsNeckoChild()) mozilla::net::NeckoChild::InitNeckoChild();
 
   NS_ENSURE_ARG_POINTER(url);
   nsresult rv;
 
   nsCOMPtr<nsIWyciwygChannel> channel;
   if (IsNeckoChild()) {
     NS_ENSURE_TRUE(gNeckoChild != nullptr, NS_ERROR_FAILURE);
@@ -116,21 +116,16 @@ nsWyciwygProtocolHandler::NewChannel2(ns
     return rv;
   }
 
   channel.forget(result);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWyciwygProtocolHandler::NewChannel(nsIURI *url, nsIChannel **result) {
-  return NewChannel2(url, nullptr, result);
-}
-
-NS_IMETHODIMP
 nsWyciwygProtocolHandler::GetProtocolFlags(uint32_t *result) {
   // Should this be an an nsINestedURI?  We don't really want random webpages
   // loading these URIs...
 
   // Note that using URI_INHERITS_SECURITY_CONTEXT here is OK -- untrusted code
   // is not allowed to link to wyciwyg URIs and users shouldn't be able to get
   // at them, and nsDocShell::InternalLoad forbids non-history loads of these
   // URIs.  And when loading from history we end up using the principal from
--- a/netwerk/test/browser/browser_nsIFormPOSTActionChannel.js
+++ b/netwerk/test/browser/browser_nsIFormPOSTActionChannel.js
@@ -32,22 +32,19 @@ CustomProtocolHandler.prototype = {
            Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE;
   },
   newURI: function(aSpec, aOriginCharset, aBaseURI) {
     return Cc["@mozilla.org/network/standard-url-mutator;1"]
              .createInstance(Ci.nsIURIMutator)
              .setSpec(aSpec)
              .finalize()
   },
-  newChannel2: function(aURI, aLoadInfo) {
+  newChannel: function(aURI, aLoadInfo) {
     return new CustomChannel(aURI, aLoadInfo);
   },
-  newChannel: function(aURI) {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
   allowPort: function(port, scheme) {
     return port != -1;
   },
 
   /** nsIFactory */
   createInstance: function(aOuter, aIID) {
     if (aOuter) {
       throw Cr.NS_ERROR_NO_AGGREGATION;
--- a/netwerk/test/unit/test_bug894586.js
+++ b/netwerk/test/unit/test_bug894586.js
@@ -29,23 +29,20 @@ ProtocolHandler.prototype = {
            Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE |
            Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
            Ci.nsIProtocolHandler.URI_NON_PERSISTABLE |
            Ci.nsIProtocolHandler.URI_SYNC_LOAD_IS_OK;
   },
   newURI: function(aSpec, aOriginCharset, aBaseURI) {
     return this.uri;
   },
-  newChannel2: function(aURI, aLoadInfo) {
+  newChannel: function(aURI, aLoadInfo) {
     this.loadInfo = aLoadInfo;
     return this;
   },
-  newChannel: function(aURI) {
-    return this;
-  },
   allowPort: function(port, scheme) {
     return port != -1;
   },
 
   /** nsIChannel */
   get originalURI() {
     return this.uri;
   },
--- a/netwerk/test/unit/test_protocolproxyservice-async-filters.js
+++ b/netwerk/test/unit/test_protocolproxyservice-async-filters.js
@@ -38,20 +38,17 @@ TestProtocolHandler.prototype = {
                  Ci.nsIProtocolHandler.ALLOWS_PROXY |
                  Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD,
   newURI: function(spec, originCharset, baseURI) {
     return Cc["@mozilla.org/network/simple-uri-mutator;1"]
              .createInstance(Ci.nsIURIMutator)
              .setSpec(spec)
              .finalize();
   },
-  newChannel2: function(uri, aLoadInfo) {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-  newChannel: function(uri) {
+  newChannel: function(uri, aLoadInfo) {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
   allowPort: function(port, scheme) {
     return true;
   }
 };
 
 function TestProtocolHandlerFactory() {
--- a/netwerk/test/unit/test_protocolproxyservice.js
+++ b/netwerk/test/unit/test_protocolproxyservice.js
@@ -49,20 +49,17 @@ TestProtocolHandler.prototype = {
                  Ci.nsIProtocolHandler.ALLOWS_PROXY |
                  Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD,
   newURI: function(spec, originCharset, baseURI) {
     return Cc["@mozilla.org/network/simple-uri-mutator;1"]
              .createInstance(Ci.nsIURIMutator)
              .setSpec(spec)
              .finalize();
   },
-  newChannel2: function(uri, aLoadInfo) {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-  newChannel: function(uri) {
+  newChannel: function(uri, aLoadInfo) {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
   allowPort: function(port, scheme) {
     return true;
   }
 };
 
 function TestProtocolHandlerFactory() {
--- a/toolkit/components/mozprotocol/MozProtocolHandler.jsm
+++ b/toolkit/components/mozprotocol/MozProtocolHandler.jsm
@@ -23,24 +23,20 @@ MozProtocolHandler.prototype = {
     if (base) {
       mutator.setSpec(base.resolve(spec));
     } else {
       mutator.setSpec(spec);
     }
     return mutator.finalize();
   },
 
-  newChannel2(uri, loadInfo) {
+  newChannel(uri, loadInfo) {
     const kCanada = "https://www.mozilla.org/contact/communities/canada/";
     let realURL = NetUtil.newURI((uri && uri.spec == "moz://eh") ? kCanada : this.urlToLoad);
     let channel = Services.io.newChannelFromURIWithLoadInfo(realURL, loadInfo);
     loadInfo.resultPrincipalURI = realURL;
     return channel;
   },
 
-  newChannel(uri) {
-    return this.newChannel2(uri, null);
-  },
-
   QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolHandler]),
 };
 
 var EXPORTED_SYMBOLS = ["MozProtocolHandler"];
--- a/toolkit/components/places/PageIconProtocolHandler.jsm
+++ b/toolkit/components/places/PageIconProtocolHandler.jsm
@@ -71,17 +71,17 @@ PageIconProtocolHandler.prototype = {
 
   newURI(spec, originCharset, baseURI) {
     return Cc["@mozilla.org/network/simple-uri-mutator;1"]
              .createInstance(Ci.nsIURIMutator)
              .setSpec(spec)
              .finalize();
   },
 
-  newChannel2(uri, loadInfo) {
+  newChannel(uri, loadInfo) {
     try {
       // Create a pipe that will give us an output stream that we can use once
       // we got all the favicon data.
       let pipe = Cc["@mozilla.org/pipe;1"]
                    .createInstance(Ci.nsIPipe);
       pipe.init(true, true, 0, Ci.nsIFaviconService.MAX_FAVICON_BUFFER_SIZE);
 
       // Create our channel.
@@ -109,20 +109,16 @@ PageIconProtocolHandler.prototype = {
       }, preferredSize);
 
       return channel;
     } catch (ex) {
       return makeDefaultFaviconChannel(uri, loadInfo);
     }
   },
 
-  newChannel(uri) {
-    return this.newChannel2(uri, null);
-  },
-
   allowPort(port, scheme) {
     return false;
   },
 
   classID: Components.ID("{60a1f7c6-4ff9-4a42-84d3-5a185faa6f32}"),
   QueryInterface: ChromeUtils.generateQI([
     Ci.nsIProtocolHandler,
     Ci.nsISupportsWeakReference,
--- a/toolkit/components/places/nsAnnoProtocolHandler.cpp
+++ b/toolkit/components/places/nsAnnoProtocolHandler.cpp
@@ -219,38 +219,33 @@ nsAnnoProtocolHandler::NewURI(const nsAC
       .SetSpec(aSpec)
       .Finalize(_retval);
 }
 
 // nsAnnoProtocolHandler::NewChannel
 //
 
 NS_IMETHODIMP
-nsAnnoProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
-                                   nsIChannel **_retval) {
+nsAnnoProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
+                                  nsIChannel **_retval) {
   NS_ENSURE_ARG_POINTER(aURI);
 
   // annotation info
   nsCOMPtr<nsIURI> annoURI;
   nsAutoCString annoName;
   nsresult rv = ParseAnnoURI(aURI, getter_AddRefs(annoURI), annoName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Only favicon annotation are supported.
   if (!annoName.EqualsLiteral(FAVICON_ANNOTATION_NAME))
     return NS_ERROR_INVALID_ARG;
 
   return NewFaviconChannel(aURI, annoURI, aLoadInfo, _retval);
 }
 
-NS_IMETHODIMP
-nsAnnoProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval) {
-  return NewChannel2(aURI, nullptr, _retval);
-}
-
 // nsAnnoProtocolHandler::AllowPort
 //
 //    Don't override any bans on bad ports.
 
 NS_IMETHODIMP
 nsAnnoProtocolHandler::AllowPort(int32_t port, const char *scheme,
                                  bool *_retval) {
   *_retval = false;
--- a/toolkit/components/places/nsFaviconService.cpp
+++ b/toolkit/components/places/nsFaviconService.cpp
@@ -514,17 +514,17 @@ nsFaviconService::ReplaceFaviconDataFrom
       loadingPrincipal,
       nullptr,  // aTriggeringPrincipal
       nullptr,  // aLoadingNode
       nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS |
           nsILoadInfo::SEC_ALLOW_CHROME | nsILoadInfo::SEC_DISALLOW_SCRIPT,
       nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON);
 
   nsCOMPtr<nsIChannel> channel;
-  rv = protocolHandler->NewChannel2(dataURI, loadInfo, getter_AddRefs(channel));
+  rv = protocolHandler->NewChannel(dataURI, loadInfo, getter_AddRefs(channel));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Blocking stream is OK for data URIs.
   nsCOMPtr<nsIInputStream> stream;
   rv = channel->Open(getter_AddRefs(stream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint64_t available64;
--- a/toolkit/components/thumbnails/PageThumbsProtocol.cpp
+++ b/toolkit/components/thumbnails/PageThumbsProtocol.cpp
@@ -57,18 +57,18 @@ PageThumbsProtocol::NewURI(const nsACStr
   return NS_MutateURI(NS_SIMPLEURIMUTATOR_CONTRACTID)
       .SetSpec(aSpec)
       .Finalize(_retval);
 }
 
 // PageThumbsProtocol::NewChannel
 
 NS_IMETHODIMP
-PageThumbsProtocol::NewChannel2(nsIURI* aURI, nsILoadInfo* aLoadInfo,
-                                nsIChannel** _retval) {
+PageThumbsProtocol::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
+                               nsIChannel** _retval) {
   // Get the file path for the URL
   nsCOMPtr<nsIFile> filePath;
   nsresult rv = GetFilePathForURL(aURI, getter_AddRefs(filePath));
   if (NS_WARN_IF(NS_FAILED(rv))) return rv;
 
   // Get a file URI from the local file path
   nsCOMPtr<nsIURI> fileURI;
   rv = NS_NewFileURI(getter_AddRefs(fileURI), filePath);
@@ -81,21 +81,16 @@ PageThumbsProtocol::NewChannel2(nsIURI* 
                                           getter_AddRefs(channel));
   if (NS_WARN_IF(NS_FAILED(rv))) return rv;
 
   channel->SetOriginalURI(aURI);
   channel.forget(_retval);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-PageThumbsProtocol::NewChannel(nsIURI* aURI, nsIChannel** _retval) {
-  return NewChannel2(aURI, nullptr, _retval);
-}
-
 // PageThumbsProtocol::AllowPort
 
 NS_IMETHODIMP
 PageThumbsProtocol::AllowPort(int32_t aPort, const char* aScheme,
                               bool* _retval) {
   *_retval = false;
   return NS_OK;
 }
--- a/toolkit/components/thumbnails/test/test_thumbnails_interfaces.js
+++ b/toolkit/components/thumbnails/test/test_thumbnails_interfaces.js
@@ -1,26 +1,32 @@
 "use strict";
 
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 
 // need profile so that PageThumbsStorageService can resolve the path to the underlying file
 do_get_profile();
 
 function run_test() {
   // check the protocol handler implements the correct interface
   let handler = Services.io.getProtocolHandler("moz-page-thumb");
   ok(handler instanceof Ci.nsIProtocolHandler,
      "moz-page-thumb handler provides a protocol handler interface");
 
+  // create a dummy loadinfo which we can hand to newChannel.
+  let dummyURI = Services.io.newURI("https://www.example.com/1");
+  let dummyChannel = NetUtil.newChannel({uri: dummyURI, loadUsingSystemPrincipal: true});
+  let dummyLoadInfo = dummyChannel.loadInfo;
+
   // and check that the error cases work as specified
   let badhost = Services.io.newURI("moz-page-thumb://wronghost/?url=http%3A%2F%2Fwww.mozilla.org%2F");
-  Assert.throws(() => handler.newChannel(badhost), /NS_ERROR_NOT_AVAILABLE/i,
+  Assert.throws(() => handler.newChannel(badhost, dummyLoadInfo), /NS_ERROR_NOT_AVAILABLE/i,
       "moz-page-thumb object with wrong host must not resolve to a file path");
 
   let badQuery = Services.io.newURI("moz-page-thumb://thumbnail/http%3A%2F%2Fwww.mozilla.org%2F");
-  Assert.throws(() => handler.newChannel(badQuery), /NS_ERROR_MALFORMED_URI/i,
+  Assert.throws(() => handler.newChannel(badQuery, dummyLoadInfo), /NS_ERROR_MALFORMED_URI/i,
       "moz-page-thumb object with malformed query parameters must not resolve to a file path");
 
   let noURL = Services.io.newURI("moz-page-thumb://thumbnail/?badStuff");
-  Assert.throws(() => handler.newChannel(noURL), /NS_ERROR_NOT_AVAILABLE/i,
+  Assert.throws(() => handler.newChannel(noURL, dummyLoadInfo), /NS_ERROR_NOT_AVAILABLE/i,
       "moz-page-thumb object without a URL parameter must not resolve to a file path");
 }
--- a/uriloader/exthandler/nsExternalProtocolHandler.cpp
+++ b/uriloader/exthandler/nsExternalProtocolHandler.cpp
@@ -510,39 +510,34 @@ NS_IMETHODIMP nsExternalProtocolHandler:
     const char *aCharset,  // ignore charset info
     nsIURI *aBaseURI, nsIURI **_retval) {
   return NS_MutateURI(NS_SIMPLEURIMUTATOR_CONTRACTID)
       .SetSpec(aSpec)
       .Finalize(_retval);
 }
 
 NS_IMETHODIMP
-nsExternalProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
-                                       nsIChannel **aRetval) {
+nsExternalProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
+                                      nsIChannel **aRetval) {
   NS_ENSURE_TRUE(aURI, NS_ERROR_UNKNOWN_PROTOCOL);
   NS_ENSURE_TRUE(aRetval, NS_ERROR_UNKNOWN_PROTOCOL);
 
   // Only try to return a channel if we have a protocol handler for the url.
   // nsOSHelperAppService::LoadUriInternal relies on this to check trustedness
   // for some platforms at least.  (win uses ::ShellExecute and unix uses
   // gnome_url_show.)
   if (!HaveExternalProtocolHandler(aURI)) {
     return NS_ERROR_UNKNOWN_PROTOCOL;
   }
 
   nsCOMPtr<nsIChannel> channel = new nsExtProtocolChannel(aURI, aLoadInfo);
   channel.forget(aRetval);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsExternalProtocolHandler::NewChannel(nsIURI *aURI,
-                                                    nsIChannel **_retval) {
-  return NewChannel2(aURI, nullptr, _retval);
-}
-
 ///////////////////////////////////////////////////////////////////////
 // External protocol handler interface implementation
 //////////////////////////////////////////////////////////////////////
 NS_IMETHODIMP nsExternalProtocolHandler::ExternalAppExistsForScheme(
     const nsACString &aScheme, bool *_retval) {
   nsCOMPtr<nsIExternalProtocolService> extProtSvc(
       do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID));
   if (extProtSvc)
--- a/widget/android/nsAndroidProtocolHandler.cpp
+++ b/widget/android/nsAndroidProtocolHandler.cpp
@@ -136,25 +136,20 @@ nsAndroidProtocolHandler::NewURI(const n
   return NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID)
       .Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
                               nsIStandardURL::URLTYPE_STANDARD, -1,
                               nsCString(aSpec), aCharset, base, nullptr))
       .Finalize(result);
 }
 
 NS_IMETHODIMP
-nsAndroidProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
-                                      nsIChannel **aResult) {
+nsAndroidProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
+                                     nsIChannel **aResult) {
   nsCOMPtr<nsIChannel> channel = AndroidChannel::CreateChannel(aURI);
   if (!channel) return NS_ERROR_FAILURE;
 
   // set the loadInfo on the new channel
   nsresult rv = channel->SetLoadInfo(aLoadInfo);
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ADDREF(*aResult = channel);
   return NS_OK;
 }
-
-NS_IMETHODIMP
-nsAndroidProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult) {
-  return NewChannel2(aURI, nullptr, aResult);
-}