Bug 1641496 - P7: Allow to use SSLTokensCache in parent process with socket process enabled r=dragana
☠☠ backed out by e2a3fb3559d0 ☠ ☠
authorKershaw Chang <kershaw@mozilla.com>
Thu, 04 Jun 2020 11:51:13 +0000
changeset 534009 1c927e612ddacfdb8150dd92465075aa1b8b4b9a
parent 534008 0f1ba77e39423d02691c62b4bddafd4c90ac66b9
child 534010 44c03736a07abaafbd87fbc8b0e4cb34d797f923
push id37481
push userncsoregi@mozilla.com
push dateFri, 05 Jun 2020 04:39:26 +0000
treeherdermozilla-central@fecffba489bd [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);