Bug 1542037 - Only create nsDNSService on parent process r=dragana
authorKershaw Chang <kershaw@mozilla.com>
Wed, 14 Aug 2019 19:37:13 +0000
changeset 488217 e91774d533a9e195a183920fe208df5c25edcaea
parent 488216 b3a7ade91b6114da1cfccf7e8f75d71f0c717edb
child 488218 ae02140f6e0583da72e938e9fee243327ea34353
push id36437
push userncsoregi@mozilla.com
push dateThu, 15 Aug 2019 19:33:18 +0000
treeherdermozilla-central@44aac6fc3352 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1542037
milestone70.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 1542037 - Only create nsDNSService on parent process r=dragana Differential Revision: https://phabricator.services.mozilla.com/D41211
netwerk/dns/nsDNSService2.cpp
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -518,21 +518,25 @@ NS_IMPL_ISUPPORTS(nsDNSService, nsIDNSSe
 
 /******************************************************************************
  * nsDNSService impl:
  * singleton instance ctor/dtor methods
  ******************************************************************************/
 static StaticRefPtr<nsDNSService> gDNSService;
 
 already_AddRefed<nsIDNSService> nsDNSService::GetXPCOMSingleton() {
+  if (XRE_IsParentProcess()) {
+    return GetSingleton();
+  }
+
   if (XRE_IsContentProcess() || XRE_IsSocketProcess()) {
     return ChildDNSService::GetSingleton();
   }
 
-  return GetSingleton();
+  return nullptr;
 }
 
 already_AddRefed<nsDNSService> nsDNSService::GetSingleton() {
   NS_ASSERTION(XRE_IsParentProcess(), "not a parent process");
 
   if (!gDNSService) {
     gDNSService = new nsDNSService();
     if (NS_SUCCEEDED(gDNSService->Init())) {