Bug 1501404 - Part 2: Remove the XPCOM registration for nsRequestObserverProxy r=valentin
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 23 Oct 2018 20:07:19 +0000
changeset 491000 8711f0c4d51ee1d411eb273c0252417316707746
parent 490999 81f3d1e42395241f97ff12aa489ce7ee6153b5c5
child 491001 6af22b13b62acca7791fd61c41db34158128a6e0
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersvalentin
bugs1501404
milestone65.0a1
Bug 1501404 - Part 2: Remove the XPCOM registration for nsRequestObserverProxy r=valentin Depends on D9570 Differential Revision: https://phabricator.services.mozilla.com/D9571
netwerk/base/nsNetUtil.cpp
netwerk/build/nsNetCID.h
netwerk/build/nsNetModule.cpp
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -44,17 +44,17 @@
 #include "nsINode.h"
 #include "nsIObjectLoadingContent.h"
 #include "nsIOfflineCacheUpdate.h"
 #include "nsPersistentProperties.h"
 #include "nsIPrivateBrowsingChannel.h"
 #include "nsIPropertyBag2.h"
 #include "nsIProtocolProxyService.h"
 #include "mozilla/net/RedirectChannelRegistrar.h"
-#include "nsIRequestObserverProxy.h"
+#include "nsRequestObserverProxy.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsISensitiveInfoHiddenURI.h"
 #include "nsISimpleStreamListener.h"
 #include "nsISocketProvider.h"
 #include "nsISocketProviderService.h"
 #include "nsIStandardURL.h"
 #include "nsIStreamLoader.h"
 #include "nsIIncrementalStreamLoader.h"
@@ -1222,24 +1222,20 @@ NS_ImplementChannelOpen(nsIChannel      
     return NS_OK;
  }
 
 nsresult
 NS_NewRequestObserverProxy(nsIRequestObserver **result,
                            nsIRequestObserver  *observer,
                            nsISupports         *context)
 {
-    nsresult rv;
-    nsCOMPtr<nsIRequestObserverProxy> proxy =
-        do_CreateInstance(NS_REQUESTOBSERVERPROXY_CONTRACTID, &rv);
+    nsCOMPtr<nsIRequestObserverProxy> proxy = new nsRequestObserverProxy();
+    nsresult rv = proxy->Init(observer, context);
     if (NS_SUCCEEDED(rv)) {
-        rv = proxy->Init(observer, context);
-        if (NS_SUCCEEDED(rv)) {
-            proxy.forget(result);
-        }
+        proxy.forget(result);
     }
     return rv;
 }
 
 nsresult
 NS_NewSimpleStreamListener(nsIStreamListener **result,
                            nsIOutputStream    *sink,
                            nsIRequestObserver *observer /* = nullptr */)
--- a/netwerk/build/nsNetCID.h
+++ b/netwerk/build/nsNetCID.h
@@ -176,27 +176,16 @@
 #define NS_STDURLPARSER_CID                          \
 { /* ff41913b-546a-4bff-9201-dc9b2c032eba */         \
     0xff41913b,                                      \
     0x546a,                                          \
     0x4bff,                                          \
     {0x92, 0x01, 0xdc, 0x9b, 0x2c, 0x03, 0x2e, 0xba} \
 }
 
-// component implementing nsIRequestObserverProxy.
-#define NS_REQUESTOBSERVERPROXY_CONTRACTID \
-    "@mozilla.org/network/request-observer-proxy;1"
-#define NS_REQUESTOBSERVERPROXY_CID                  \
-{ /* 51fa28c7-74c0-4b85-9c46-d03faa7b696b */         \
-    0x51fa28c7,                                      \
-    0x74c0,                                          \
-    0x4b85,                                          \
-    {0x9c, 0x46, 0xd0, 0x3f, 0xaa, 0x7b, 0x69, 0x6b} \
-}
-
 // component implementing nsISimpleStreamListener.
 #define NS_SIMPLESTREAMLISTENER_CONTRACTID \
     "@mozilla.org/network/simple-stream-listener;1"
 #define NS_SIMPLESTREAMLISTENER_CID                  \
 { /* fb8cbf4e-4701-4ba1-b1d6-5388e041fb67 */         \
     0xfb8cbf4e,                                      \
     0x4701,                                          \
     0x4ba1,                                          \
--- a/netwerk/build/nsNetModule.cpp
+++ b/netwerk/build/nsNetModule.cpp
@@ -163,21 +163,18 @@ net_NewIncrementalDownload(nsISupports *
 
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "nsMIMEHeaderParamImpl.h"
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMIMEHeaderParamImpl)
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "nsRequestObserverProxy.h"
 #include "nsSimpleStreamListener.h"
 
-typedef mozilla::net::nsRequestObserverProxy nsRequestObserverProxy;
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsRequestObserverProxy)
 typedef mozilla::net::nsSimpleStreamListener nsSimpleStreamListener;
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleStreamListener)
 
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "nsStreamListenerTee.h"
 typedef mozilla::net::nsStreamListenerTee nsStreamListenerTee;
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsStreamListenerTee)
@@ -661,17 +658,16 @@ NS_DEFINE_NAMED_CID(NS_ASYNCSTREAMCOPIER
 NS_DEFINE_NAMED_CID(NS_INPUTSTREAMPUMP_CID);
 NS_DEFINE_NAMED_CID(NS_INPUTSTREAMCHANNEL_CID);
 NS_DEFINE_NAMED_CID(NS_STREAMLOADER_CID);
 NS_DEFINE_NAMED_CID(NS_INCREMENTALSTREAMLOADER_CID);
 NS_DEFINE_NAMED_CID(NS_DOWNLOADER_CID);
 NS_DEFINE_NAMED_CID(NS_BACKGROUNDFILESAVEROUTPUTSTREAM_CID);
 NS_DEFINE_NAMED_CID(NS_BACKGROUNDFILESAVERSTREAMLISTENER_CID);
 NS_DEFINE_NAMED_CID(NS_SYNCSTREAMLISTENER_CID);
-NS_DEFINE_NAMED_CID(NS_REQUESTOBSERVERPROXY_CID);
 NS_DEFINE_NAMED_CID(NS_SIMPLESTREAMLISTENER_CID);
 NS_DEFINE_NAMED_CID(NS_STREAMLISTENERTEE_CID);
 NS_DEFINE_NAMED_CID(NS_LOADGROUP_CID);
 NS_DEFINE_NAMED_CID(NS_LOCALFILEINPUTSTREAM_CID);
 NS_DEFINE_NAMED_CID(NS_LOCALFILEOUTPUTSTREAM_CID);
 NS_DEFINE_NAMED_CID(NS_ATOMICLOCALFILEOUTPUTSTREAM_CID);
 NS_DEFINE_NAMED_CID(NS_SAFELOCALFILEOUTPUTSTREAM_CID);
 NS_DEFINE_NAMED_CID(NS_INCREMENTALDOWNLOAD_CID);
@@ -776,17 +772,16 @@ static const mozilla::Module::CIDEntry k
     { &kNS_STREAMLOADER_CID, false, nullptr, mozilla::net::nsStreamLoader::Create },
     { &kNS_INCREMENTALSTREAMLOADER_CID, false, nullptr, nsIncrementalStreamLoader::Create },
     { &kNS_DOWNLOADER_CID, false, nullptr, nsDownloaderConstructor },
     { &kNS_BACKGROUNDFILESAVEROUTPUTSTREAM_CID, false, nullptr,
       mozilla::net::BackgroundFileSaverOutputStreamConstructor },
     { &kNS_BACKGROUNDFILESAVERSTREAMLISTENER_CID, false, nullptr,
       mozilla::net::BackgroundFileSaverStreamListenerConstructor },
     { &kNS_SYNCSTREAMLISTENER_CID, false, nullptr, nsSyncStreamListenerConstructor },
-    { &kNS_REQUESTOBSERVERPROXY_CID, false, nullptr, nsRequestObserverProxyConstructor },
     { &kNS_SIMPLESTREAMLISTENER_CID, false, nullptr, nsSimpleStreamListenerConstructor },
     { &kNS_STREAMLISTENERTEE_CID, false, nullptr, nsStreamListenerTeeConstructor },
     { &kNS_LOADGROUP_CID, false, nullptr, nsLoadGroupConstructor },
     { &kNS_LOCALFILEINPUTSTREAM_CID, false, nullptr, nsFileInputStream::Create },
     { &kNS_LOCALFILEOUTPUTSTREAM_CID, false, nullptr, nsFileOutputStream::Create },
     { &kNS_ATOMICLOCALFILEOUTPUTSTREAM_CID, false, nullptr, nsAtomicFileOutputStreamConstructor },
     { &kNS_SAFELOCALFILEOUTPUTSTREAM_CID, false, nullptr, nsSafeFileOutputStreamConstructor },
     { &kNS_INCREMENTALDOWNLOAD_CID, false, nullptr, net_NewIncrementalDownload },
@@ -892,17 +887,16 @@ static const mozilla::Module::ContractID
     { NS_INPUTSTREAMPUMP_CONTRACTID, &kNS_INPUTSTREAMPUMP_CID },
     { NS_INPUTSTREAMCHANNEL_CONTRACTID, &kNS_INPUTSTREAMCHANNEL_CID },
     { NS_STREAMLOADER_CONTRACTID, &kNS_STREAMLOADER_CID },
     { NS_INCREMENTALSTREAMLOADER_CONTRACTID, &kNS_INCREMENTALSTREAMLOADER_CID },
     { NS_DOWNLOADER_CONTRACTID, &kNS_DOWNLOADER_CID },
     { NS_BACKGROUNDFILESAVEROUTPUTSTREAM_CONTRACTID, &kNS_BACKGROUNDFILESAVEROUTPUTSTREAM_CID },
     { NS_BACKGROUNDFILESAVERSTREAMLISTENER_CONTRACTID, &kNS_BACKGROUNDFILESAVERSTREAMLISTENER_CID },
     { NS_SYNCSTREAMLISTENER_CONTRACTID, &kNS_SYNCSTREAMLISTENER_CID },
-    { NS_REQUESTOBSERVERPROXY_CONTRACTID, &kNS_REQUESTOBSERVERPROXY_CID },
     { NS_SIMPLESTREAMLISTENER_CONTRACTID, &kNS_SIMPLESTREAMLISTENER_CID },
     { NS_STREAMLISTENERTEE_CONTRACTID, &kNS_STREAMLISTENERTEE_CID },
     { NS_LOADGROUP_CONTRACTID, &kNS_LOADGROUP_CID },
     { NS_LOCALFILEINPUTSTREAM_CONTRACTID, &kNS_LOCALFILEINPUTSTREAM_CID },
     { NS_LOCALFILEOUTPUTSTREAM_CONTRACTID, &kNS_LOCALFILEOUTPUTSTREAM_CID },
     { NS_ATOMICLOCALFILEOUTPUTSTREAM_CONTRACTID, &kNS_ATOMICLOCALFILEOUTPUTSTREAM_CID },
     { NS_SAFELOCALFILEOUTPUTSTREAM_CONTRACTID, &kNS_SAFELOCALFILEOUTPUTSTREAM_CID },
     { NS_INCREMENTALDOWNLOAD_CONTRACTID, &kNS_INCREMENTALDOWNLOAD_CID },