Bug 1559340 - Make sure NetworkConnectivityService::Init() only gets called once r=michal
authorValentin Gosu <valentin.gosu@gmail.com>
Mon, 24 Jun 2019 21:56:50 +0000
changeset 542814 65f73e2c491b96b6bd2b4725b034487f622c0b7e
parent 542813 2f565c4f68f73e09a6ee863aba3ea2ac913f16c2
child 542815 1d5517788ccb535a9d6573e4db1c81417386af2a
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal
bugs1559340
milestone69.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 1559340 - Make sure NetworkConnectivityService::Init() only gets called once r=michal Differential Revision: https://phabricator.services.mozilla.com/D35000
netwerk/base/NetworkConnectivityService.h
netwerk/base/nsIOService.cpp
--- a/netwerk/base/NetworkConnectivityService.h
+++ b/netwerk/base/NetworkConnectivityService.h
@@ -20,23 +20,23 @@ class NetworkConnectivityService : publi
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSINETWORKCONNECTIVITYSERVICE
   NS_DECL_NSIOBSERVER
   NS_DECL_NSIDNSLISTENER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIREQUESTOBSERVER
 
-  nsresult Init();
   static already_AddRefed<NetworkConnectivityService> GetSingleton();
 
  private:
   NetworkConnectivityService() = default;
   virtual ~NetworkConnectivityService() = default;
 
+  nsresult Init();
   // Calls all the check methods
   void PerformChecks();
 
   // Will be set to OK if the DNS request returned in IP of this type,
   //                NOT_AVAILABLE if that type of resolution is not available
   //                UNKNOWN if the check wasn't performed
   ConnectivityState mDNSv4 = nsINetworkConnectivityService::UNKNOWN;
   ConnectivityState mDNSv6 = nsINetworkConnectivityService::UNKNOWN;
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -294,19 +294,19 @@ nsresult nsIOService::InitializeCaptiveP
   }
 
   mCaptivePortalService = do_GetService(NS_CAPTIVEPORTAL_CID);
   if (mCaptivePortalService) {
     return static_cast<CaptivePortalService*>(mCaptivePortalService.get())
         ->Initialize();
   }
 
+  // Instantiate and initialize the service
   RefPtr<NetworkConnectivityService> ncs =
       NetworkConnectivityService::GetSingleton();
-  ncs->Init();
 
   return NS_OK;
 }
 
 nsresult nsIOService::InitializeSocketTransportService() {
   nsresult rv = NS_OK;
 
   if (!mSocketTransportService) {