Bug 1538207 - Don't call into the prefs service OMT. r=decoder
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 22 Mar 2019 16:29:27 +0000
changeset 465732 f23caf168c32b31b5bae01c15bf958dca5571a01
parent 465731 0e9f9d86014a1bf41badb6f9c8f25551a480d72c
child 465733 bbb45318486338a306aa31841e02f64d47d2d822
push id35746
push usershindli@mozilla.com
push dateSat, 23 Mar 2019 09:46:24 +0000
treeherdermozilla-central@02b7484f316b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdecoder
bugs1538207
milestone68.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 1538207 - Don't call into the prefs service OMT. r=decoder Use a VarCache instead. Differential Revision: https://phabricator.services.mozilla.com/D24514
modules/libpref/init/StaticPrefList.h
netwerk/base/nsSocketTransport2.cpp
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -94,16 +94,22 @@ VARCACHE_PREF(
 //---------------------------------------------------------------------------
 
 #ifdef FUZZING
 VARCACHE_PREF(
   "fuzzing.enabled",
    fuzzing_enabled,
   bool, false
 )
+
+VARCACHE_PREF(
+  "fuzzing.necko.enabled",
+   fuzzing_necko_enabled,
+  RelaxedAtomicBool, false
+)
 #endif
 
 //---------------------------------------------------------------------------
 // Clipboard prefs
 //---------------------------------------------------------------------------
 
 #if !defined(ANDROID) && !defined(XP_MACOSX) && defined(XP_UNIX)
 # define PREF_VALUE true
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -2,16 +2,17 @@
 /* vim:set ts=4 sw=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsSocketTransport2.h"
 
 #include "mozilla/Attributes.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "nsIOService.h"
 #include "nsStreamUtils.h"
 #include "nsNetSegmentUtils.h"
 #include "nsNetAddr.h"
 #include "nsTransportUtils.h"
 #include "nsProxyInfo.h"
 #include "nsNetCID.h"
@@ -1347,18 +1348,18 @@ nsresult nsSocketTransport::InitiateSock
     SOCKET_LOG(
         ("  BuildSocket failed [rv=%" PRIx32 "]\n", static_cast<uint32_t>(rv)));
     return rv;
   }
 
   // create proxy via IOActivityMonitor
   IOActivityMonitor::MonitorSocket(fd);
 
-#if defined(FUZZING)
-  if (Preferences::GetBool("fuzzing.necko.enabled")) {
+#ifdef FUZZING
+  if (StaticPrefs::fuzzing_necko_enabled()) {
     rv = AttachFuzzyIOLayer(fd);
     if (NS_FAILED(rv)) {
       SOCKET_LOG(("Failed to attach fuzzing IOLayer [rv=%" PRIx32 "].\n",
                   static_cast<uint32_t>(rv)));
       return rv;
     }
     SOCKET_LOG(("Successfully attached fuzzing IOLayer.\n"));
   }