Bug 1641496 - P7: Allow to use SSLTokensCache in parent process with socket process enabled r=dragana
authorKershaw Chang <kershaw@mozilla.com>
Fri, 05 Jun 2020 13:27:35 +0000
changeset 534144 8c83a611b548d44b8340dddd652190d3b351286f
parent 534143 19872bf14b2feae4e3d7ddfd478add8503af006d
child 534145 567513cee4895872b1e7fb53fbd2793593d11f97
push id37483
push userapavel@mozilla.com
push dateFri, 05 Jun 2020 21:40:11 +0000
treeherdermozilla-central@dadc7312128e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1641496
milestone79.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 1641496 - P7: Allow to use SSLTokensCache in parent process with socket process enabled r=dragana Differential Revision: https://phabricator.services.mozilla.com/D78228
netwerk/base/SSLTokensCache.cpp
--- a/netwerk/base/SSLTokensCache.cpp
+++ b/netwerk/base/SSLTokensCache.cpp
@@ -71,21 +71,22 @@ void SSLTokensCache::TokenCacheRecord::R
 }
 
 NS_IMPL_ISUPPORTS(SSLTokensCache, nsIMemoryReporter)
 
 // static
 nsresult SSLTokensCache::Init() {
   StaticMutexAutoLock lock(sLock);
 
-  if (nsIOService::UseSocketProcess()) {
-    if (!XRE_IsSocketProcess()) {
-      return NS_OK;
-    }
-  } else if (!XRE_IsParentProcess()) {
+  // SSLTokensCache should be only used in parent process and socket process.
+  // Ideally, parent process should not use this when socket process is enabled.
+  // However, some xpcsehll tests may need to create and use sockets directly,
+  // so we still allow to use this in parent process no matter socket process is
+  // enabled or not.
+  if (!(XRE_IsSocketProcess() || XRE_IsParentProcess())) {
     return NS_OK;
   }
 
   MOZ_ASSERT(!gInstance);
 
   gInstance = new SSLTokensCache();
 
   RegisterWeakMemoryReporter(gInstance);