Bug 1406280 - Restyle modules/libpref/*.h. r=erahm.
authorNicholas Nethercote <nnethercote@mozilla.com>
Sun, 08 Oct 2017 07:46:07 +1100
changeset 385272 014f84dbd970d28beb9ee89e385a764b814916e4
parent 385271 638f6196f028bfd16fb3318a2c1fe10f95d848e8
child 385273 d16958d3126b9dea70ee9849779fd4afc41ff0ac
push id32650
push userarchaeopteryx@coole-files.de
push dateTue, 10 Oct 2017 09:13:16 +0000
treeherdermozilla-central@77a4c52e9987 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1406280
milestone58.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 1406280 - Restyle modules/libpref/*.h. r=erahm. This is a mixture of clang-format and manual restyling. MozReview-Commit-ID: 6S6yUDXQJtE
modules/libpref/Preferences.cpp
modules/libpref/Preferences.h
modules/libpref/nsPrefBranch.cpp
modules/libpref/nsPrefBranch.h
modules/libpref/prefapi.cpp
modules/libpref/prefapi.h
modules/libpref/prefapi_private_data.h
modules/libpref/prefread.cpp
modules/libpref/prefread.h
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -561,17 +561,17 @@ PreferenceServiceReporter::CollectReport
   size_t numWeakDead = 0;
   nsTArray<nsCString> suspectPreferences;
   // Count of the number of referents for each preference.
   nsDataHashtable<nsCStringHashKey, uint32_t> prefCounter;
 
   for (auto iter = rootBranch->mObservers.Iter(); !iter.Done(); iter.Next()) {
     nsAutoPtr<PrefCallback>& callback = iter.Data();
     nsPrefBranch* prefBranch = callback->GetPrefBranch();
-    const auto& pref = prefBranch->getPrefName(callback->GetDomain().get());
+    const auto& pref = prefBranch->GetPrefName(callback->GetDomain().get());
 
     if (callback->IsWeak()) {
       nsCOMPtr<nsIObserver> callbackRef = do_QueryReferent(callback->mWeakRef);
       if (callbackRef) {
         numWeakAlive++;
       } else {
         numWeakDead++;
       }
--- a/modules/libpref/Preferences.h
+++ b/modules/libpref/Preferences.h
@@ -1,128 +1,117 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef mozilla_Preferences_h
 #define mozilla_Preferences_h
 
 #ifndef MOZILLA_INTERNAL_API
 #error "This header is only usable from within libxul (MOZILLA_INTERNAL_API)."
 #endif
 
-#include "nsIPrefService.h"
+#include "mozilla/Atomics.h"
+#include "mozilla/MemoryReporting.h"
+#include "nsCOMPtr.h"
+#include "nsIObserver.h"
 #include "nsIPrefBranch.h"
-#include "nsIObserver.h"
-#include "nsCOMPtr.h"
+#include "nsIPrefService.h"
 #include "nsTArray.h"
 #include "nsWeakReference.h"
-#include "mozilla/Atomics.h"
-#include "mozilla/MemoryReporting.h"
 
 class nsIFile;
 
 #ifndef have_PrefChangedFunc_typedef
-typedef void (*PrefChangedFunc)(const char *, void *);
+typedef void (*PrefChangedFunc)(const char*, void*);
 #define have_PrefChangedFunc_typedef
 #endif
 
 #ifdef DEBUG
-enum pref_initPhase {
+enum pref_initPhase
+{
   START,
   BEGIN_INIT_PREFS,
   END_INIT_PREFS,
   BEGIN_ALL_PREFS,
   END_ALL_PREFS
 };
-
 #define SET_PREF_PHASE(p) Preferences::SetInitPhase(p)
 #else
-#define SET_PREF_PHASE(p) do { } while (0)
+#define SET_PREF_PHASE(p)                                                      \
+  do {                                                                         \
+  } while (0)
 #endif
 
 namespace mozilla {
+
 struct Ok;
-template <typename V, typename E> class Result;
+
+template<typename V, typename E>
+class Result;
+
 namespace dom {
 class PrefSetting;
 } // namespace dom
 
-class Preferences final : public nsIPrefService,
-                          public nsIObserver,
-                          public nsIPrefBranch,
-                          public nsSupportsWeakReference
+class Preferences final
+  : public nsIPrefService
+  , public nsIObserver
+  , public nsIPrefBranch
+  , public nsSupportsWeakReference
 {
 public:
   typedef mozilla::dom::PrefSetting PrefSetting;
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIPREFSERVICE
   NS_FORWARD_NSIPREFBRANCH(sRootBranch->)
   NS_DECL_NSIOBSERVER
 
   Preferences();
 
   mozilla::Result<Ok, const char*> Init();
 
-  /**
-   * Returns true if the Preferences service is available, false otherwise.
-   */
+  // Returns true if the Preferences service is available, false otherwise.
   static bool IsServiceAvailable();
 
-  /**
-   * Initialize user prefs from prefs.js/user.js
-   */
+  // Initialize user prefs from prefs.js/user.js
   static void InitializeUserPrefs();
 
-  /**
-   * Returns the singleton instance which is addreffed.
-   */
+  // Returns the singleton instance which is addreffed.
   static Preferences* GetInstanceForService();
 
-  /**
-   * Finallizes global members.
-   */
+  // Finallizes global members.
   static void Shutdown();
 
-  /**
-   * Returns shared pref service instance
-   * NOTE: not addreffed.
-   */
+  // Returns shared pref service instance NOTE: not addreffed.
   static nsIPrefService* GetService()
   {
     NS_ENSURE_TRUE(InitStaticMembers(), nullptr);
     return sPreferences;
   }
 
-  /**
-   * Returns shared pref branch instance.
-   * NOTE: not addreffed.
-   */
+  // Returns shared pref branch instance. NOTE: not addreffed.
   static nsIPrefBranch* GetRootBranch()
   {
     NS_ENSURE_TRUE(InitStaticMembers(), nullptr);
     return sRootBranch;
   }
 
-  /**
-   * Returns shared default pref branch instance.
-   * NOTE: not addreffed.
-   */
+  // Returns shared default pref branch instance. NOTE: not addreffed.
   static nsIPrefBranch* GetDefaultRootBranch()
   {
     NS_ENSURE_TRUE(InitStaticMembers(), nullptr);
     return sDefaultRootBranch;
   }
 
-  /**
-   * Gets int or bool type pref value with default value if failed to get
-   * the pref.
-   */
+  // Gets int or bool type pref value with default value if failed to get the
+  // pref.
   static bool GetBool(const char* aPref, bool aDefault = false)
   {
     bool result = aDefault;
     GetBool(aPref, &result);
     return result;
   }
 
   static int32_t GetInt(const char* aPref, int32_t aDefault = 0)
@@ -141,300 +130,259 @@ public:
 
   static float GetFloat(const char* aPref, float aDefault = 0)
   {
     float result = aDefault;
     GetFloat(aPref, &result);
     return result;
   }
 
-  /**
-   * Gets int, float, or bool type pref value with raw return value of
-   * nsIPrefBranch.
-   *
-   * @param aPref       A pref name.
-   * @param aResult     Must not be nullptr.  The value is never modified
-   *                    when these methods fail.
-   */
+  // Gets int, float, or bool type pref value with raw return value of
+  // nsIPrefBranch.
+  //
+  // |aResult| must not be nullptr; its contents are never modified when these
+  // methods fail.
   static nsresult GetBool(const char* aPref, bool* aResult);
   static nsresult GetInt(const char* aPref, int32_t* aResult);
   static nsresult GetFloat(const char* aPref, float* aResult);
   static nsresult GetUint(const char* aPref, uint32_t* aResult)
   {
     int32_t result;
     nsresult rv = GetInt(aPref, &result);
     if (NS_SUCCEEDED(rv)) {
       *aResult = static_cast<uint32_t>(result);
     }
     return rv;
   }
 
-  /**
-   * Gets string type pref value with raw return value of nsIPrefBranch.
-   *
-   * @param aPref       A pref name.
-   * @param aResult     The value is never modified when these methods fail.
-   */
+  // Gets string type pref value with raw return value of nsIPrefBranch.
+  // |aResult| is never modified when these methods fail.
   static nsresult GetCString(const char* aPref, nsACString& aResult);
   static nsresult GetString(const char* aPref, nsAString& aResult);
   static nsresult GetLocalizedCString(const char* aPref, nsACString& aResult);
   static nsresult GetLocalizedString(const char* aPref, nsAString& aResult);
 
-  static nsresult GetComplex(const char* aPref, const nsIID &aType,
+  static nsresult GetComplex(const char* aPref,
+                             const nsIID& aType,
                              void** aResult);
 
-  /**
-   * Sets various type pref values.
-   */
+  // Sets various type pref values.
   static nsresult SetBool(const char* aPref, bool aValue);
   static nsresult SetInt(const char* aPref, int32_t aValue);
   static nsresult SetUint(const char* aPref, uint32_t aValue)
   {
     return SetInt(aPref, static_cast<int32_t>(aValue));
   }
   static nsresult SetFloat(const char* aPref, float aValue);
   static nsresult SetCString(const char* aPref, const char* aValue);
-  static nsresult SetCString(const char* aPref, const nsACString &aValue);
+  static nsresult SetCString(const char* aPref, const nsACString& aValue);
   static nsresult SetString(const char* aPref, const char16ptr_t aValue);
-  static nsresult SetString(const char* aPref, const nsAString &aValue);
+  static nsresult SetString(const char* aPref, const nsAString& aValue);
 
-  static nsresult SetComplex(const char* aPref, const nsIID &aType,
+  static nsresult SetComplex(const char* aPref,
+                             const nsIID& aType,
                              nsISupports* aValue);
 
-  /**
-   * Clears user set pref.
-   */
+  // Clears user set pref.
   static nsresult ClearUser(const char* aPref);
 
-  /**
-   * Whether the pref has a user value or not.
-   */
+  // Whether the pref has a user value or not.
   static bool HasUserValue(const char* aPref);
 
-  /**
-   * Gets the type of the pref.
-   */
+  // Gets the type of the pref.
   static int32_t GetType(const char* aPref);
 
-  /**
-   * Adds/Removes the observer for the root pref branch.
-   * The observer is referenced strongly if AddStrongObserver is used.  On the
-   * other hand, it is referenced weakly, if AddWeakObserver is used.
-   * See nsIPrefBranch.idl for details.
-   */
+  // Adds/Removes the observer for the root pref branch. See nsIPrefBranch.idl
+  // for details.
   static nsresult AddStrongObserver(nsIObserver* aObserver, const char* aPref);
   static nsresult AddWeakObserver(nsIObserver* aObserver, const char* aPref);
   static nsresult RemoveObserver(nsIObserver* aObserver, const char* aPref);
 
-  /**
-   * Adds/Removes two or more observers for the root pref branch.
-   * Pass to aPrefs an array of const char* whose last item is nullptr.
-   */
+  // Adds/Removes two or more observers for the root pref branch. Pass to
+  // aPrefs an array of const char* whose last item is nullptr.
   static nsresult AddStrongObservers(nsIObserver* aObserver,
                                      const char** aPrefs);
-  static nsresult AddWeakObservers(nsIObserver* aObserver,
-                                   const char** aPrefs);
-  static nsresult RemoveObservers(nsIObserver* aObserver,
-                                  const char** aPrefs);
+  static nsresult AddWeakObservers(nsIObserver* aObserver, const char** aPrefs);
+  static nsresult RemoveObservers(nsIObserver* aObserver, const char** aPrefs);
 
-  /**
-   * Registers/Unregisters the callback function for the aPref.
-   */
+  // Registers/Unregisters the callback function for the aPref.
   static nsresult RegisterCallback(PrefChangedFunc aCallback,
                                    const char* aPref,
                                    void* aClosure = nullptr)
   {
     return RegisterCallback(aCallback, aPref, aClosure, ExactMatch);
   }
+
   static nsresult UnregisterCallback(PrefChangedFunc aCallback,
                                      const char* aPref,
                                      void* aClosure = nullptr)
   {
     return UnregisterCallback(aCallback, aPref, aClosure, ExactMatch);
   }
+
   // Like RegisterCallback, but also calls the callback immediately for
   // initialization.
   static nsresult RegisterCallbackAndCall(PrefChangedFunc aCallback,
                                           const char* aPref,
                                           void* aClosure = nullptr)
   {
     return RegisterCallbackAndCall(aCallback, aPref, aClosure, ExactMatch);
   }
 
-  /**
-   * Like RegisterCallback, but registers a callback for a prefix of multiple
-   * pref names, not a single pref name.
-   */
+  // Like RegisterCallback, but registers a callback for a prefix of multiple
+  // pref names, not a single pref name.
   static nsresult RegisterPrefixCallback(PrefChangedFunc aCallback,
                                          const char* aPref,
                                          void* aClosure = nullptr)
   {
     return RegisterCallback(aCallback, aPref, aClosure, PrefixMatch);
   }
 
-  /**
-   * Like RegisterPrefixCallback, but also calls the callback immediately for
-   * initialization.
-   */
+  // Like RegisterPrefixCallback, but also calls the callback immediately for
+  // initialization.
   static nsresult RegisterPrefixCallbackAndCall(PrefChangedFunc aCallback,
                                                 const char* aPref,
                                                 void* aClosure = nullptr)
   {
     return RegisterCallbackAndCall(aCallback, aPref, aClosure, PrefixMatch);
   }
 
-  /**
-   * Unregister a callback registered with RegisterPrefixCallback or
-   * RegisterPrefixCallbackAndCall.
-   */
+  // Unregister a callback registered with RegisterPrefixCallback or
+  // RegisterPrefixCallbackAndCall.
   static nsresult UnregisterPrefixCallback(PrefChangedFunc aCallback,
                                            const char* aPref,
                                            void* aClosure = nullptr)
   {
     return UnregisterCallback(aCallback, aPref, aClosure, PrefixMatch);
   }
 
-  /**
-   * Adds the aVariable to cache table.  aVariable must be a pointer for a
-   * static variable.  The value will be modified when the pref value is
-   * changed but note that even if you modified it, the value isn't assigned to
-   * the pref.
-   */
+  // Adds the aVariable to cache table. |aVariable| must be a pointer for a
+  // static variable. The value will be modified when the pref value is changed
+  // but note that even if you modified it, the value isn't assigned to the
+  // pref.
   static nsresult AddBoolVarCache(bool* aVariable,
                                   const char* aPref,
                                   bool aDefault = false);
   static nsresult AddIntVarCache(int32_t* aVariable,
                                  const char* aPref,
                                  int32_t aDefault = 0);
   static nsresult AddUintVarCache(uint32_t* aVariable,
                                   const char* aPref,
                                   uint32_t aDefault = 0);
-  template <MemoryOrdering Order>
+  template<MemoryOrdering Order>
   static nsresult AddAtomicUintVarCache(Atomic<uint32_t, Order>* aVariable,
                                         const char* aPref,
                                         uint32_t aDefault = 0);
   static nsresult AddFloatVarCache(float* aVariable,
                                    const char* aPref,
                                    float aDefault = 0.0f);
 
-  /**
-   * Gets the default bool, int or uint value of the pref.
-   * The result is raw result of nsIPrefBranch::Get*Pref().
-   * If the pref could have any value, you needed to use these methods.
-   * If not so, you could use below methods.
-   */
+  // Gets the default bool, int or uint value of the pref. The result is raw
+  // result of nsIPrefBranch::Get*Pref(). If the pref could have any value, you
+  // need to use these methods. If not so, you could use the methods below.
   static nsresult GetDefaultBool(const char* aPref, bool* aResult);
   static nsresult GetDefaultInt(const char* aPref, int32_t* aResult);
   static nsresult GetDefaultUint(const char* aPref, uint32_t* aResult)
   {
     return GetDefaultInt(aPref, reinterpret_cast<int32_t*>(aResult));
   }
 
-  /**
-   * Gets the default bool, int or uint value of the pref directly.
-   * You can set an invalid value of the pref to aFailedResult.  If these
-   * methods failed to get the default value, they would return the
-   * aFailedResult value.
-   */
+  // Gets the default bool, int or uint value of the pref directly. You can set
+  // an invalid value of the pref to |aFailedResult|. If these methods fail to
+  // get the default value, they return |aFailedResult|.
   static bool GetDefaultBool(const char* aPref, bool aFailedResult)
   {
     bool result;
-    return NS_SUCCEEDED(GetDefaultBool(aPref, &result)) ? result :
-                                                          aFailedResult;
+    return NS_SUCCEEDED(GetDefaultBool(aPref, &result)) ? result
+                                                        : aFailedResult;
   }
   static int32_t GetDefaultInt(const char* aPref, int32_t aFailedResult)
   {
     int32_t result;
     return NS_SUCCEEDED(GetDefaultInt(aPref, &result)) ? result : aFailedResult;
   }
   static uint32_t GetDefaultUint(const char* aPref, uint32_t aFailedResult)
   {
-   return static_cast<uint32_t>(
-     GetDefaultInt(aPref, static_cast<int32_t>(aFailedResult)));
+    return static_cast<uint32_t>(
+      GetDefaultInt(aPref, static_cast<int32_t>(aFailedResult)));
   }
 
-  /**
-   * Gets the default value of the char type pref.
-   */
+  // Gets the default value of the char type pref.
   static nsresult GetDefaultCString(const char* aPref, nsACString& aResult);
   static nsresult GetDefaultString(const char* aPref, nsAString& aResult);
   static nsresult GetDefaultLocalizedCString(const char* aPref,
                                              nsACString& aResult);
   static nsresult GetDefaultLocalizedString(const char* aPref,
                                             nsAString& aResult);
 
-  static nsresult GetDefaultComplex(const char* aPref, const nsIID &aType,
+  static nsresult GetDefaultComplex(const char* aPref,
+                                    const nsIID& aType,
                                     void** aResult);
 
-  /**
-   * Gets the type of the pref.
-   */
+  // Gets the type of the pref.
   static int32_t GetDefaultType(const char* aPref);
 
   // Used to synchronise preferences between chrome and content processes.
   static void GetPreferences(InfallibleTArray<PrefSetting>* aPrefs);
   static void GetPreference(PrefSetting* aPref);
   static void SetPreference(const PrefSetting& aPref);
 
   static void SetInitPreferences(nsTArray<PrefSetting>* aPrefs);
 
 #ifdef DEBUG
   static void SetInitPhase(pref_initPhase phase);
   static pref_initPhase InitPhase();
 #endif
 
-  static int64_t SizeOfIncludingThisAndOtherStuff(mozilla::MallocSizeOf aMallocSizeOf);
+  static int64_t SizeOfIncludingThisAndOtherStuff(
+    mozilla::MallocSizeOf aMallocSizeOf);
 
   static void DirtyCallback();
 
-  // Explicitly choosing synchronous or asynchronous (if allowed)
-  // preferences file write.  Only for the default file.  The guarantee
-  // for the "blocking" is that when it returns, the file on disk
-  // reflect the current state of preferences.
+  // Explicitly choosing synchronous or asynchronous (if allowed) preferences
+  // file write. Only for the default file.  The guarantee for the "blocking"
+  // is that when it returns, the file on disk reflect the current state of
+  // preferences.
   nsresult SavePrefFileBlocking();
   nsresult SavePrefFileAsynchronous();
 
 protected:
   virtual ~Preferences();
 
-  nsresult NotifyServiceObservers(const char *aSubject);
-  /**
-   * Loads the prefs.js file from the profile, or creates a new one.
-   *
-   * @return the prefs file if successful, or nullptr on failure.
-   */
+  nsresult NotifyServiceObservers(const char* aSubject);
+
+  // Loads the prefs.js file from the profile, or creates a new one. Returns
+  // the prefs file if successful, or nullptr on failure.
   already_AddRefed<nsIFile> ReadSavedPrefs();
 
-  /**
-   * Loads the user.js file from the profile if present.
-   */
+  // Loads the user.js file from the profile if present.
   void ReadUserOverridePrefs();
 
-  nsresult MakeBackupPrefFile(nsIFile *aFile);
+  nsresult MakeBackupPrefFile(nsIFile* aFile);
 
   // Default pref file save can be blocking or not.
-  enum class SaveMethod {
+  enum class SaveMethod
+  {
     Blocking,
     Asynchronous
   };
 
-  // Off main thread is only respected for the default aFile value (nullptr)
+  // Off main thread is only respected for the default aFile value (nullptr).
   nsresult SavePrefFileInternal(nsIFile* aFile, SaveMethod aSaveMethod);
   nsresult WritePrefFile(nsIFile* aFile, SaveMethod aSaveMethod);
 
   // If this is false, only blocking writes, on main thread are allowed.
   bool AllowOffMainThreadSave();
 
-  /**
-   * Helpers for implementing
-   * Register(Prefix)Callback/Unregister(Prefix)Callback.
-   */
+  // Helpers for implementing
+  // Register(Prefix)Callback/Unregister(Prefix)Callback.
 public:
   // Public so the ValueObserver classes can use it.
-  enum MatchKind {
+  enum MatchKind
+  {
     PrefixMatch,
     ExactMatch,
   };
 
 protected:
   static nsresult RegisterCallback(PrefChangedFunc aCallback,
                                    const char* aPref,
                                    void* aClosure,
@@ -444,29 +392,27 @@ protected:
                                      void* aClosure,
                                      MatchKind aMatchKind);
   static nsresult RegisterCallbackAndCall(PrefChangedFunc aCallback,
                                           const char* aPref,
                                           void* aClosure,
                                           MatchKind aMatchKind);
 
 private:
-  nsCOMPtr<nsIFile>        mCurrentFile;
-  bool                     mDirty = false;
-  bool                     mProfileShutdown = false;
-  // we wait a bit after prefs are dirty before writing them. In this
-  // period, mDirty and mSavePending will both be true.
-  bool                     mSavePending = false;
+  nsCOMPtr<nsIFile> mCurrentFile;
+  bool mDirty = false;
+  bool mProfileShutdown = false;
+  // We wait a bit after prefs are dirty before writing them. In this period,
+  // mDirty and mSavePending will both be true.
+  bool mSavePending = false;
 
-  static Preferences*      sPreferences;
-  static nsIPrefBranch*    sRootBranch;
-  static nsIPrefBranch*    sDefaultRootBranch;
-  static bool              sShutdown;
+  static Preferences* sPreferences;
+  static nsIPrefBranch* sRootBranch;
+  static nsIPrefBranch* sDefaultRootBranch;
+  static bool sShutdown;
 
-  /**
-   * Init static members.  TRUE if it succeeded.  Otherwise, FALSE.
-   */
+  // Init static members. Returns true on success.
   static bool InitStaticMembers();
 };
 
 } // namespace mozilla
 
 #endif // mozilla_Preferences_h
--- a/modules/libpref/nsPrefBranch.cpp
+++ b/modules/libpref/nsPrefBranch.cpp
@@ -76,17 +76,17 @@ nsPrefBranch::nsPrefBranch(const char* a
     // Add weakly so we don't have to clean up at shutdown.
     observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
     --mRefCnt;
   }
 }
 
 nsPrefBranch::~nsPrefBranch()
 {
-  freeObserverList();
+  FreeObserverList();
 
   nsCOMPtr<nsIObserverService> observerService =
     mozilla::services::GetObserverService();
   if (observerService) {
     observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
   }
 }
 
@@ -116,17 +116,17 @@ nsPrefBranch::GetRoot(char** aRoot)
   *aRoot = ToNewCString(mPrefRoot);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrefBranch::GetPrefType(const char* aPrefName, int32_t* aRetVal)
 {
   NS_ENSURE_ARG(aPrefName);
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   switch (PREF_GetPrefType(pref.get())) {
     case PrefType::String:
       *aRetVal = PREF_STRING;
       break;
 
     case PrefType::Int:
       *aRetVal = PREF_INT;
       break;
@@ -158,27 +158,27 @@ nsPrefBranch::GetBoolPrefWithDefault(con
   return rv;
 }
 
 NS_IMETHODIMP
 nsPrefBranch::GetBoolPref(const char* aPrefName, bool* aRetVal)
 {
   NS_ENSURE_ARG(aPrefName);
 
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   return PREF_GetBoolPref(pref.get(), aRetVal, mIsDefault);
 }
 
 NS_IMETHODIMP
 nsPrefBranch::SetBoolPref(const char* aPrefName, bool aValue)
 {
   ENSURE_MAIN_PROCESS("Cannot SetBoolPref from content process:", aPrefName);
   NS_ENSURE_ARG(aPrefName);
 
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   return PREF_SetBoolPref(pref.get(), aValue, mIsDefault);
 }
 
 NS_IMETHODIMP
 nsPrefBranch::GetFloatPrefWithDefault(const char* aPrefName,
                                       float aDefaultValue,
                                       uint8_t aArgc,
                                       float* aRetVal)
@@ -223,17 +223,17 @@ nsPrefBranch::GetCharPrefWithDefault(con
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsPrefBranch::GetCharPref(const char* aPrefName, char** aRetVal)
 {
   NS_ENSURE_ARG(aPrefName);
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   return PREF_CopyCharPref(pref.get(), aRetVal, mIsDefault);
 }
 
 NS_IMETHODIMP
 nsPrefBranch::SetCharPref(const char* aPrefName, const char* aValue)
 {
   nsresult rv = CheckSanityOfStringLength(aPrefName, aValue);
   if (NS_FAILED(rv)) {
@@ -245,17 +245,17 @@ nsPrefBranch::SetCharPref(const char* aP
 nsresult
 nsPrefBranch::SetCharPrefInternal(const char* aPrefName, const char* aValue)
 
 {
   ENSURE_MAIN_PROCESS("Cannot SetCharPref from content process:", aPrefName);
   NS_ENSURE_ARG(aPrefName);
   NS_ENSURE_ARG(aValue);
 
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   return PREF_SetCharPref(pref.get(), aValue, mIsDefault);
 }
 
 NS_IMETHODIMP
 nsPrefBranch::GetStringPref(const char* aPrefName,
                             const nsACString& aDefaultValue,
                             uint8_t aArgc,
                             nsACString& aRetVal)
@@ -301,26 +301,26 @@ nsPrefBranch::GetIntPrefWithDefault(cons
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsPrefBranch::GetIntPref(const char* aPrefName, int32_t* aRetVal)
 {
   NS_ENSURE_ARG(aPrefName);
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   return PREF_GetIntPref(pref.get(), aRetVal, mIsDefault);
 }
 
 NS_IMETHODIMP
 nsPrefBranch::SetIntPref(const char* aPrefName, int32_t aValue)
 {
   ENSURE_MAIN_PROCESS("Cannot SetIntPref from content process:", aPrefName);
   NS_ENSURE_ARG(aPrefName);
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   return PREF_SetIntPref(pref.get(), aValue, mIsDefault);
 }
 
 NS_IMETHODIMP
 nsPrefBranch::GetComplexValue(const char* aPrefName,
                               const nsIID& aType,
                               void** aRetVal)
 {
@@ -332,17 +332,17 @@ nsPrefBranch::GetComplexValue(const char
   // we have to do this one first because it's different than all the rest
   if (aType.Equals(NS_GET_IID(nsIPrefLocalizedString))) {
     nsCOMPtr<nsIPrefLocalizedString> theString(
       do_CreateInstance(NS_PREFLOCALIZEDSTRING_CONTRACTID, &rv));
     if (NS_FAILED(rv)) {
       return rv;
     }
 
-    const PrefName& pref = getPrefName(aPrefName);
+    const PrefName& pref = GetPrefName(aPrefName);
     bool bNeedDefault = false;
 
     if (mIsDefault) {
       bNeedDefault = true;
     } else {
       // if there is no user (or locked) value
       if (!PREF_HasUserPref(pref.get()) && !PREF_PrefIsLocked(pref.get())) {
         bNeedDefault = true;
@@ -525,17 +525,17 @@ nsPrefBranch::CheckSanityOfStringLength(
   }
 
   nsAutoCString message(nsPrintfCString(
     "Warning: attempting to write %d bytes to preference %s. This is bad "
     "for general performance and memory usage. Such an amount of data "
     "should rather be written to an external file. This preference will "
     "not be sent to any content processes.",
     aLength,
-    getPrefName(aPrefName).get()));
+    GetPrefName(aPrefName).get()));
 
   rv = console->LogStringMessage(NS_ConvertUTF8toUTF16(message).get());
   if (NS_FAILED(rv)) {
     return rv;
   }
   return NS_OK;
 }
 
@@ -664,77 +664,77 @@ nsPrefBranch::SetComplexValue(const char
 }
 
 NS_IMETHODIMP
 nsPrefBranch::ClearUserPref(const char* aPrefName)
 {
   ENSURE_MAIN_PROCESS("Cannot ClearUserPref from content process:", aPrefName);
   NS_ENSURE_ARG(aPrefName);
 
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   return PREF_ClearUserPref(pref.get());
 }
 
 NS_IMETHODIMP
 nsPrefBranch::PrefHasUserValue(const char* aPrefName, bool* aRetVal)
 {
   NS_ENSURE_ARG_POINTER(aRetVal);
   NS_ENSURE_ARG(aPrefName);
 
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   *aRetVal = PREF_HasUserPref(pref.get());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrefBranch::LockPref(const char* aPrefName)
 {
   ENSURE_MAIN_PROCESS("Cannot LockPref from content process:", aPrefName);
   NS_ENSURE_ARG(aPrefName);
 
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   return PREF_LockPref(pref.get(), true);
 }
 
 NS_IMETHODIMP
 nsPrefBranch::PrefIsLocked(const char* aPrefName, bool* aRetVal)
 {
   ENSURE_MAIN_PROCESS("Cannot check PrefIsLocked from content process:",
                       aPrefName);
   NS_ENSURE_ARG_POINTER(aRetVal);
   NS_ENSURE_ARG(aPrefName);
 
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   *aRetVal = PREF_PrefIsLocked(pref.get());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrefBranch::UnlockPref(const char* aPrefName)
 {
   ENSURE_MAIN_PROCESS("Cannot UnlockPref from content process:", aPrefName);
   NS_ENSURE_ARG(aPrefName);
 
-  const PrefName& pref = getPrefName(aPrefName);
+  const PrefName& pref = GetPrefName(aPrefName);
   return PREF_LockPref(pref.get(), false);
 }
 
 NS_IMETHODIMP
 nsPrefBranch::ResetBranch(const char* aStartingAt)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsPrefBranch::DeleteBranch(const char* aStartingAt)
 {
   ENSURE_MAIN_PROCESS("Cannot DeleteBranch from content process:", aStartingAt);
   NS_ENSURE_ARG(aStartingAt);
 
-  const PrefName& pref = getPrefName(aStartingAt);
+  const PrefName& pref = GetPrefName(aStartingAt);
   return PREF_DeleteBranch(pref.get());
 }
 
 NS_IMETHODIMP
 nsPrefBranch::GetChildList(const char* aStartingAt,
                            uint32_t* aCount,
                            char*** aChildArray)
 {
@@ -748,22 +748,22 @@ nsPrefBranch::GetChildList(const char* a
   NS_ENSURE_ARG_POINTER(aChildArray);
 
   *aChildArray = nullptr;
   *aCount = 0;
 
   // This will contain a list of all the pref name strings. Allocated on the
   // stack for speed.
 
-  const PrefName& parent = getPrefName(aStartingAt);
+  const PrefName& parent = GetPrefName(aStartingAt);
   size_t parentLen = parent.Length();
   for (auto iter = gHashTable->Iter(); !iter.Done(); iter.Next()) {
     auto entry = static_cast<PrefHashEntry*>(iter.Get());
-    if (strncmp(entry->key, parent.get(), parentLen) == 0) {
-      prefArray.AppendElement(entry->key);
+    if (strncmp(entry->mKey, parent.get(), parentLen) == 0) {
+      prefArray.AppendElement(entry->mKey);
     }
   }
 
   // Now that we've built up the list, run the callback on all the matching
   // elements.
   numPrefs = prefArray.Length();
 
   if (numPrefs) {
@@ -828,64 +828,64 @@ nsPrefBranch::AddObserver(const char* aD
     return NS_OK;
   }
 
   p.OrInsert([&pCallback]() { return pCallback; });
 
   // We must pass a fully qualified preference name to the callback
   // aDomain == nullptr is the only possible failure, and we trapped it with
   // NS_ENSURE_ARG above.
-  const PrefName& pref = getPrefName(aDomain);
+  const PrefName& pref = GetPrefName(aDomain);
   PREF_RegisterCallback(pref.get(), NotifyObserver, pCallback);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrefBranch::RemoveObserver(const char* aDomain, nsIObserver* aObserver)
 {
   NS_ENSURE_ARG(aDomain);
   NS_ENSURE_ARG(aObserver);
 
   nsresult rv = NS_OK;
 
-  // If we're in the middle of a call to freeObserverList, don't process this
+  // If we're in the middle of a call to FreeObserverList, don't process this
   // RemoveObserver call -- the observer in question will be removed soon, if
   // it hasn't been already.
   //
   // It's important that we don't touch mObservers in any way -- even a Get()
   // which returns null might cause the hashtable to resize itself, which will
-  // break the iteration in freeObserverList.
+  // break the iteration in FreeObserverList.
   if (mFreeingObserverList) {
     return NS_OK;
   }
 
   // Remove the relevant PrefCallback from mObservers and get an owning pointer
   // to it. Unregister the callback first, and then let the owning pointer go
   // out of scope and destroy the callback.
   PrefCallback key(aDomain, aObserver, this);
   nsAutoPtr<PrefCallback> pCallback;
   mObservers.Remove(&key, &pCallback);
   if (pCallback) {
     // aDomain == nullptr is the only possible failure, trapped above.
-    const PrefName& pref = getPrefName(aDomain);
+    const PrefName& pref = GetPrefName(aDomain);
     rv = PREF_UnregisterCallback(pref.get(), NotifyObserver, pCallback);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsPrefBranch::Observe(nsISupports* aSubject,
                       const char* aTopic,
                       const char16_t* aData)
 {
   // Watch for xpcom shutdown and free our observers to eliminate any cyclic
   // references.
   if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
-    freeObserverList();
+    FreeObserverList();
   }
   return NS_OK;
 }
 
 /* static */ void
 nsPrefBranch::NotifyObserver(const char* aNewPref, void* aData)
 {
   PrefCallback* pCallback = (PrefCallback*)aData;
@@ -912,27 +912,27 @@ nsPrefBranch::SizeOfIncludingThis(mozill
 {
   size_t n = aMallocSizeOf(this);
   n += mPrefRoot.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
   n += mObservers.ShallowSizeOfExcludingThis(aMallocSizeOf);
   return n;
 }
 
 void
-nsPrefBranch::freeObserverList()
+nsPrefBranch::FreeObserverList()
 {
   // We need to prevent anyone from modifying mObservers while we're iterating
   // over it. In particular, some clients will call RemoveObserver() when
   // they're removed and destructed via the iterator; we set
   // mFreeingObserverList to keep those calls from touching mObservers.
   mFreeingObserverList = true;
   for (auto iter = mObservers.Iter(); !iter.Done(); iter.Next()) {
     nsAutoPtr<PrefCallback>& callback = iter.Data();
     nsPrefBranch* prefBranch = callback->GetPrefBranch();
-    const PrefName& pref = prefBranch->getPrefName(callback->GetDomain().get());
+    const PrefName& pref = prefBranch->GetPrefName(callback->GetDomain().get());
     PREF_UnregisterCallback(pref.get(), nsPrefBranch::NotifyObserver, callback);
     iter.Remove();
   }
   mFreeingObserverList = false;
 }
 
 void
 nsPrefBranch::RemoveExpiredCallback(PrefCallback* aCallback)
@@ -966,17 +966,17 @@ nsPrefBranch::GetDefaultFromPropertiesFi
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   return bundle->GetStringFromName(aPrefName, aReturn);
 }
 
 nsPrefBranch::PrefName
-nsPrefBranch::getPrefName(const char* aPrefName) const
+nsPrefBranch::GetPrefName(const char* aPrefName) const
 {
   NS_ASSERTION(aPrefName, "null pref name!");
 
   // For speed, avoid strcpy if we can.
   if (mPrefRoot.IsEmpty()) {
     return PrefName(aPrefName);
   }
 
--- a/modules/libpref/nsPrefBranch.h
+++ b/modules/libpref/nsPrefBranch.h
@@ -1,294 +1,299 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsPrefBranch_h
 #define nsPrefBranch_h
 
+#include "mozilla/HashFunctions.h"
+#include "mozilla/MemoryReporting.h"
+#include "mozilla/Variant.h"
+#include "nsClassHashtable.h"
 #include "nsCOMPtr.h"
+#include "nsCRT.h"
+#include "nsIFile.h"
 #include "nsIObserver.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefLocalizedString.h"
-#include "nsXPCOM.h"
+#include "nsIRelativeFilePref.h"
+#include "nsISupportsImpl.h"
 #include "nsISupportsPrimitives.h"
-#include "nsIRelativeFilePref.h"
-#include "nsIFile.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsWeakReference.h"
-#include "nsClassHashtable.h"
-#include "nsCRT.h"
-#include "nsISupportsImpl.h"
-#include "mozilla/HashFunctions.h"
-#include "mozilla/MemoryReporting.h"
-#include "mozilla/Variant.h"
+#include "nsXPCOM.h"
 
 namespace mozilla {
 class PreferenceServiceReporter;
 } // namespace mozilla
 
 class nsPrefBranch;
 
-class PrefCallback : public PLDHashEntryHdr {
+class PrefCallback : public PLDHashEntryHdr
+{
   friend class mozilla::PreferenceServiceReporter;
 
-  public:
-    typedef PrefCallback* KeyType;
-    typedef const PrefCallback* KeyTypePointer;
+public:
+  typedef PrefCallback* KeyType;
+  typedef const PrefCallback* KeyTypePointer;
+
+  static const PrefCallback* KeyToPointer(PrefCallback* aKey) { return aKey; }
+
+  static PLDHashNumber HashKey(const PrefCallback* aKey)
+  {
+    uint32_t hash = mozilla::HashString(aKey->mDomain);
+    return mozilla::AddToHash(hash, aKey->mCanonical);
+  }
 
-    static const PrefCallback* KeyToPointer(PrefCallback *aKey)
-    {
-      return aKey;
-    }
-
-    static PLDHashNumber HashKey(const PrefCallback *aKey)
-    {
-      uint32_t hash = mozilla::HashString(aKey->mDomain);
-      return mozilla::AddToHash(hash, aKey->mCanonical);
-    }
-
+public:
+  // Create a PrefCallback with a strong reference to its observer.
+  PrefCallback(const char* aDomain,
+               nsIObserver* aObserver,
+               nsPrefBranch* aBranch)
+    : mDomain(aDomain)
+    , mBranch(aBranch)
+    , mWeakRef(nullptr)
+    , mStrongRef(aObserver)
+  {
+    MOZ_COUNT_CTOR(PrefCallback);
+    nsCOMPtr<nsISupports> canonical = do_QueryInterface(aObserver);
+    mCanonical = canonical;
+  }
 
-  public:
-    // Create a PrefCallback with a strong reference to its observer.
-    PrefCallback(const char *aDomain, nsIObserver *aObserver,
-                 nsPrefBranch *aBranch)
-      : mDomain(aDomain),
-        mBranch(aBranch),
-        mWeakRef(nullptr),
-        mStrongRef(aObserver)
-    {
-      MOZ_COUNT_CTOR(PrefCallback);
-      nsCOMPtr<nsISupports> canonical = do_QueryInterface(aObserver);
-      mCanonical = canonical;
-    }
+  // Create a PrefCallback with a weak reference to its observer.
+  PrefCallback(const char* aDomain,
+               nsISupportsWeakReference* aObserver,
+               nsPrefBranch* aBranch)
+    : mDomain(aDomain)
+    , mBranch(aBranch)
+    , mWeakRef(do_GetWeakReference(aObserver))
+    , mStrongRef(nullptr)
+  {
+    MOZ_COUNT_CTOR(PrefCallback);
+    nsCOMPtr<nsISupports> canonical = do_QueryInterface(aObserver);
+    mCanonical = canonical;
+  }
 
-    // Create a PrefCallback with a weak reference to its observer.
-    PrefCallback(const char *aDomain,
-                 nsISupportsWeakReference *aObserver,
-                 nsPrefBranch *aBranch)
-      : mDomain(aDomain),
-        mBranch(aBranch),
-        mWeakRef(do_GetWeakReference(aObserver)),
-        mStrongRef(nullptr)
-    {
-      MOZ_COUNT_CTOR(PrefCallback);
-      nsCOMPtr<nsISupports> canonical = do_QueryInterface(aObserver);
-      mCanonical = canonical;
-    }
+  // Copy constructor needs to be explicit or the linker complains.
+  explicit PrefCallback(const PrefCallback*& aCopy)
+    : mDomain(aCopy->mDomain)
+    , mBranch(aCopy->mBranch)
+    , mWeakRef(aCopy->mWeakRef)
+    , mStrongRef(aCopy->mStrongRef)
+    , mCanonical(aCopy->mCanonical)
+  {
+    MOZ_COUNT_CTOR(PrefCallback);
+  }
+
+  ~PrefCallback() { MOZ_COUNT_DTOR(PrefCallback); }
 
-    // Copy constructor needs to be explicit or the linker complains.
-    explicit PrefCallback(const PrefCallback *&aCopy)
-      : mDomain(aCopy->mDomain),
-        mBranch(aCopy->mBranch),
-        mWeakRef(aCopy->mWeakRef),
-        mStrongRef(aCopy->mStrongRef),
-        mCanonical(aCopy->mCanonical)
-    {
-      MOZ_COUNT_CTOR(PrefCallback);
-    }
+  bool KeyEquals(const PrefCallback* aKey) const
+  {
+    // We want to be able to look up a weakly-referencing PrefCallback after
+    // its observer has died so we can remove it from the table. Once the
+    // callback's observer dies, its canonical pointer is stale -- in
+    // particular, we may have allocated a new observer in the same spot in
+    // memory! So we can't just compare canonical pointers to determine whether
+    // aKey refers to the same observer as this.
+    //
+    // Our workaround is based on the way we use this hashtable: When we ask
+    // the hashtable to remove a PrefCallback whose weak reference has expired,
+    // we use as the key for removal the same object as was inserted into the
+    // hashtable. Thus we can say that if one of the keys' weak references has
+    // expired, the two keys are equal iff they're the same object.
 
-    ~PrefCallback()
-    {
-      MOZ_COUNT_DTOR(PrefCallback);
+    if (IsExpired() || aKey->IsExpired()) {
+      return this == aKey;
     }
 
-    bool KeyEquals(const PrefCallback *aKey) const
-    {
-      // We want to be able to look up a weakly-referencing PrefCallback after
-      // its observer has died so we can remove it from the table.  Once the
-      // callback's observer dies, its canonical pointer is stale -- in
-      // particular, we may have allocated a new observer in the same spot in
-      // memory!  So we can't just compare canonical pointers to determine
-      // whether aKey refers to the same observer as this.
-      //
-      // Our workaround is based on the way we use this hashtable: When we ask
-      // the hashtable to remove a PrefCallback whose weak reference has
-      // expired, we use as the key for removal the same object as was inserted
-      // into the hashtable.  Thus we can say that if one of the keys' weak
-      // references has expired, the two keys are equal iff they're the same
-      // object.
-
-      if (IsExpired() || aKey->IsExpired())
-        return this == aKey;
-
-      if (mCanonical != aKey->mCanonical)
-        return false;
-
-      return mDomain.Equals(aKey->mDomain);
+    if (mCanonical != aKey->mCanonical) {
+      return false;
     }
 
-    PrefCallback *GetKey() const
-    {
-      return const_cast<PrefCallback*>(this);
-    }
+    return mDomain.Equals(aKey->mDomain);
+  }
+
+  PrefCallback* GetKey() const { return const_cast<PrefCallback*>(this); }
 
-    // Get a reference to the callback's observer, or null if the observer was
-    // weakly referenced and has been destroyed.
-    already_AddRefed<nsIObserver> GetObserver() const
-    {
-      if (!IsWeak()) {
-        nsCOMPtr<nsIObserver> copy = mStrongRef;
-        return copy.forget();
-      }
-
-      nsCOMPtr<nsIObserver> observer = do_QueryReferent(mWeakRef);
-      return observer.forget();
+  // Get a reference to the callback's observer, or null if the observer was
+  // weakly referenced and has been destroyed.
+  already_AddRefed<nsIObserver> GetObserver() const
+  {
+    if (!IsWeak()) {
+      nsCOMPtr<nsIObserver> copy = mStrongRef;
+      return copy.forget();
     }
 
-    const nsCString& GetDomain() const
-    {
-      return mDomain;
-    }
+    nsCOMPtr<nsIObserver> observer = do_QueryReferent(mWeakRef);
+    return observer.forget();
+  }
+
+  const nsCString& GetDomain() const { return mDomain; }
+
+  nsPrefBranch* GetPrefBranch() const { return mBranch; }
 
-    nsPrefBranch* GetPrefBranch() const
-    {
-      return mBranch;
-    }
+  // Has this callback's weak reference died?
+  bool IsExpired() const
+  {
+    if (!IsWeak())
+      return false;
 
-    // Has this callback's weak reference died?
-    bool IsExpired() const
-    {
-      if (!IsWeak())
-        return false;
+    nsCOMPtr<nsIObserver> observer(do_QueryReferent(mWeakRef));
+    return !observer;
+  }
 
-      nsCOMPtr<nsIObserver> observer(do_QueryReferent(mWeakRef));
-      return !observer;
-    }
+  enum
+  {
+    ALLOW_MEMMOVE = true
+  };
 
-    enum { ALLOW_MEMMOVE = true };
-
-  private:
-    nsCString             mDomain;
-    nsPrefBranch         *mBranch;
+private:
+  nsCString mDomain;
+  nsPrefBranch* mBranch;
 
-    // Exactly one of mWeakRef and mStrongRef should be non-null.
-    nsWeakPtr             mWeakRef;
-    nsCOMPtr<nsIObserver> mStrongRef;
+  // Exactly one of mWeakRef and mStrongRef should be non-null.
+  nsWeakPtr mWeakRef;
+  nsCOMPtr<nsIObserver> mStrongRef;
 
-    // We need a canonical nsISupports pointer, per bug 578392.
-    nsISupports          *mCanonical;
+  // We need a canonical nsISupports pointer, per bug 578392.
+  nsISupports* mCanonical;
 
-    bool IsWeak() const
-    {
-      return !!mWeakRef;
-    }
+  bool IsWeak() const { return !!mWeakRef; }
 };
 
-class nsPrefBranch final : public nsIPrefBranch,
-                           public nsIObserver,
-                           public nsSupportsWeakReference
+class nsPrefBranch final
+  : public nsIPrefBranch
+  , public nsIObserver
+  , public nsSupportsWeakReference
 {
   friend class mozilla::PreferenceServiceReporter;
+
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPREFBRANCH
   NS_DECL_NSIOBSERVER
 
-  nsPrefBranch(const char *aPrefRoot, bool aDefaultBranch);
+  nsPrefBranch(const char* aPrefRoot, bool aDefaultBranch);
   nsPrefBranch() = delete;
 
   int32_t GetRootLength() const { return mPrefRoot.Length(); }
 
-  nsresult RemoveObserverFromMap(const char *aDomain, nsISupports *aObserver);
+  nsresult RemoveObserverFromMap(const char* aDomain, nsISupports* aObserver);
 
-  static void NotifyObserver(const char *newpref, void *data);
+  static void NotifyObserver(const char* aNewpref, void* aData);
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
 
   static void ReportToConsole(const nsAString& aMessage);
 
 protected:
-  /**
-   * Helper class for either returning a raw cstring or nsCString.
-   */
+  // Helper class for either returning a raw cstring or nsCString.
   typedef mozilla::Variant<const char*, const nsCString> PrefNameBase;
   class PrefName : public PrefNameBase
   {
   public:
-    explicit PrefName(const char* aName) : PrefNameBase(aName) {}
-    explicit PrefName(const nsCString& aName) : PrefNameBase(aName) {}
+    explicit PrefName(const char* aName)
+      : PrefNameBase(aName)
+    {
+    }
+    explicit PrefName(const nsCString& aName)
+      : PrefNameBase(aName)
+    {
+    }
 
-    /**
-     * Use default move constructors, disallow copy constructors.
-     */
+    // Use default move constructors, disallow copy constructors.
     PrefName(PrefName&& aOther) = default;
     PrefName& operator=(PrefName&& aOther) = default;
     PrefName(const PrefName&) = delete;
     PrefName& operator=(const PrefName&) = delete;
 
-    struct PtrMatcher {
+    struct PtrMatcher
+    {
       static const char* match(const char* aVal) { return aVal; }
       static const char* match(const nsCString& aVal) { return aVal.get(); }
     };
 
-    struct LenMatcher {
+    struct LenMatcher
+    {
       static size_t match(const char* aVal) { return strlen(aVal); }
       static size_t match(const nsCString& aVal) { return aVal.Length(); }
     };
 
-    const char* get() const {
+    const char* get() const
+    {
       static PtrMatcher m;
       return match(m);
     }
 
-    size_t Length() const {
+    size_t Length() const
+    {
       static LenMatcher m;
       return match(m);
     }
   };
 
   virtual ~nsPrefBranch();
 
-  nsresult   GetDefaultFromPropertiesFile(const char *aPrefName, nsAString& aReturn);
-  // As SetCharPref, but without any check on the length of |aValue|
-  nsresult   SetCharPrefInternal(const char *aPrefName, const char *aValue);
-  // Reject strings that are more than 1Mb, warn if strings are more than 16kb
-  nsresult   CheckSanityOfStringLength(const char* aPrefName, const nsAString& aValue);
-  nsresult   CheckSanityOfStringLength(const char* aPrefName, const nsACString& aValue);
-  nsresult   CheckSanityOfStringLength(const char* aPrefName, const char* aValue);
-  nsresult   CheckSanityOfStringLength(const char* aPrefName, const uint32_t aLength);
-  void RemoveExpiredCallback(PrefCallback *aCallback);
-  PrefName getPrefName(const char *aPrefName) const;
-  void       freeObserverList(void);
+  nsresult GetDefaultFromPropertiesFile(const char* aPrefName,
+                                        nsAString& aReturn);
+
+  // As SetCharPref, but without any check on the length of |aValue|.
+  nsresult SetCharPrefInternal(const char* aPrefName, const char* aValue);
+
+  // Reject strings that are more than 1Mb, warn if strings are more than 16kb.
+  nsresult CheckSanityOfStringLength(const char* aPrefName,
+                                     const nsAString& aValue);
+  nsresult CheckSanityOfStringLength(const char* aPrefName,
+                                     const nsACString& aValue);
+  nsresult CheckSanityOfStringLength(const char* aPrefName, const char* aValue);
+  nsresult CheckSanityOfStringLength(const char* aPrefName,
+                                     const uint32_t aLength);
+
+  void RemoveExpiredCallback(PrefCallback* aCallback);
+
+  PrefName GetPrefName(const char* aPrefName) const;
+
+  void FreeObserverList(void);
 
 private:
   const nsCString mPrefRoot;
-  bool                  mIsDefault;
+  bool mIsDefault;
 
-  bool                  mFreeingObserverList;
+  bool mFreeingObserverList;
   nsClassHashtable<PrefCallback, PrefCallback> mObservers;
 };
 
-
-class nsPrefLocalizedString final : public nsIPrefLocalizedString,
-                                    public nsISupportsString
+class nsPrefLocalizedString final
+  : public nsIPrefLocalizedString
+  , public nsISupportsString
 {
 public:
   nsPrefLocalizedString();
 
   NS_DECL_ISUPPORTS
   NS_FORWARD_NSISUPPORTSSTRING(mUnicodeString->)
   NS_FORWARD_NSISUPPORTSPRIMITIVE(mUnicodeString->)
 
   nsresult Init();
 
 private:
   virtual ~nsPrefLocalizedString();
 
   NS_IMETHOD GetData(char16_t**) override;
   NS_IMETHOD SetData(const char16_t* aData) override;
-  NS_IMETHOD SetDataWithLength(uint32_t aLength, const char16_t *aData) override;
+  NS_IMETHOD SetDataWithLength(uint32_t aLength,
+                               const char16_t* aData) override;
 
   nsCOMPtr<nsISupportsString> mUnicodeString;
 };
 
-
 class nsRelativeFilePref : public nsIRelativeFilePref
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIRELATIVEFILEPREF
 
   nsRelativeFilePref();
 
--- a/modules/libpref/prefapi.cpp
+++ b/modules/libpref/prefapi.cpp
@@ -33,46 +33,46 @@
 #endif
 
 using namespace mozilla;
 
 static void
 ClearPrefEntry(PLDHashTable* aTable, PLDHashEntryHdr* aEntry)
 {
   auto pref = static_cast<PrefHashEntry*>(aEntry);
-  if (pref->prefFlags.IsTypeString()) {
-    if (pref->defaultPref.stringVal) {
-      PL_strfree(pref->defaultPref.stringVal);
+  if (pref->mPrefFlags.IsTypeString()) {
+    if (pref->mDefaultPref.mStringVal) {
+      PL_strfree(pref->mDefaultPref.mStringVal);
     }
-    if (pref->userPref.stringVal) {
-      PL_strfree(pref->userPref.stringVal);
+    if (pref->mUserPref.mStringVal) {
+      PL_strfree(pref->mUserPref.mStringVal);
     }
   }
 
   // Don't need to free this because it's allocated in memory owned by
   // gPrefNameArena.
-  pref->key = nullptr;
+  pref->mKey = nullptr;
   memset(aEntry, 0, aTable->EntrySize());
 }
 
 static bool
 MatchPrefEntry(const PLDHashEntryHdr* aEntry, const void* aKey)
 {
   auto prefEntry = static_cast<const PrefHashEntry*>(aEntry);
 
-  if (prefEntry->key == aKey) {
+  if (prefEntry->mKey == aKey) {
     return true;
   }
 
-  if (!prefEntry->key || !aKey) {
+  if (!prefEntry->mKey || !aKey) {
     return false;
   }
 
   auto otherKey = static_cast<const char*>(aKey);
-  return (strcmp(prefEntry->key, otherKey) == 0);
+  return (strcmp(prefEntry->mKey, otherKey) == 0);
 }
 
 struct CallbackNode
 {
   char* mDomain;
 
   // If someone attempts to remove the node from the callback list while
   // pref_DoCallback is running, |func| is set to nullptr. Such nodes will
@@ -254,37 +254,37 @@ StrEscape(const char* aOriginal, nsCStri
 nsresult
 PREF_SetCharPref(const char* aPrefName, const char* aValue, bool aSetDefault)
 {
   if (strlen(aValue) > MAX_PREF_LENGTH) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   PrefValue pref;
-  pref.stringVal = const_cast<char*>(aValue);
+  pref.mStringVal = const_cast<char*>(aValue);
 
   return pref_HashPref(
     aPrefName, pref, PrefType::String, aSetDefault ? kPrefSetDefault : 0);
 }
 
 nsresult
 PREF_SetIntPref(const char* aPrefName, int32_t aValue, bool aSetDefault)
 {
   PrefValue pref;
-  pref.intVal = aValue;
+  pref.mIntVal = aValue;
 
   return pref_HashPref(
     aPrefName, pref, PrefType::Int, aSetDefault ? kPrefSetDefault : 0);
 }
 
 nsresult
 PREF_SetBoolPref(const char* aPrefName, bool aValue, bool aSetDefault)
 {
   PrefValue pref;
-  pref.boolVal = aValue;
+  pref.mBoolVal = aValue;
 
   return pref_HashPref(
     aPrefName, pref, PrefType::Bool, aSetDefault ? kPrefSetDefault : 0);
 }
 
 enum WhichValue
 {
   DEFAULT_VALUE,
@@ -351,119 +351,121 @@ pref_savePrefs(PLDHashTable* aTable)
 
     nsAutoCString prefValue;
     nsAutoCString prefPrefix;
     prefPrefix.AssignLiteral("user_pref(\"");
 
     // where we're getting our pref from
     PrefValue* sourcePref;
 
-    if (pref->prefFlags.HasUserValue() &&
-        (pref_ValueChanged(
-           pref->defaultPref, pref->userPref, pref->prefFlags.GetPrefType()) ||
-         !pref->prefFlags.HasDefault() || pref->prefFlags.HasStickyDefault())) {
-      sourcePref = &pref->userPref;
+    if (pref->mPrefFlags.HasUserValue() &&
+        (pref_ValueChanged(pref->mDefaultPref,
+                           pref->mUserPref,
+                           pref->mPrefFlags.GetPrefType()) ||
+         !pref->mPrefFlags.HasDefault() ||
+         pref->mPrefFlags.HasStickyDefault())) {
+      sourcePref = &pref->mUserPref;
     } else {
       // do not save default prefs that haven't changed
       continue;
     }
 
     // strings are in quotes!
-    if (pref->prefFlags.IsTypeString()) {
+    if (pref->mPrefFlags.IsTypeString()) {
       prefValue = '\"';
-      StrEscape(sourcePref->stringVal, prefValue);
+      StrEscape(sourcePref->mStringVal, prefValue);
       prefValue += '\"';
 
-    } else if (pref->prefFlags.IsTypeInt()) {
-      prefValue.AppendInt(sourcePref->intVal);
+    } else if (pref->mPrefFlags.IsTypeInt()) {
+      prefValue.AppendInt(sourcePref->mIntVal);
 
-    } else if (pref->prefFlags.IsTypeBool()) {
-      prefValue = (sourcePref->boolVal) ? "true" : "false";
+    } else if (pref->mPrefFlags.IsTypeBool()) {
+      prefValue = (sourcePref->mBoolVal) ? "true" : "false";
     }
 
     nsAutoCString prefName;
-    StrEscape(pref->key, prefName);
+    StrEscape(pref->mKey, prefName);
 
     savedPrefs.AppendElement()->reset(
       ToNewCString(prefPrefix + prefName + NS_LITERAL_CSTRING("\", ") +
                    prefValue + NS_LITERAL_CSTRING(");")));
   }
 
   return savedPrefs;
 }
 
 bool
 pref_EntryHasAdvisablySizedValues(PrefHashEntry* aHashEntry)
 {
-  if (aHashEntry->prefFlags.GetPrefType() != PrefType::String) {
+  if (aHashEntry->mPrefFlags.GetPrefType() != PrefType::String) {
     return true;
   }
 
   char* stringVal;
-  if (aHashEntry->prefFlags.HasDefault()) {
-    stringVal = aHashEntry->defaultPref.stringVal;
+  if (aHashEntry->mPrefFlags.HasDefault()) {
+    stringVal = aHashEntry->mDefaultPref.mStringVal;
     if (strlen(stringVal) > MAX_ADVISABLE_PREF_LENGTH) {
       return false;
     }
   }
 
-  if (aHashEntry->prefFlags.HasUserValue()) {
-    stringVal = aHashEntry->userPref.stringVal;
+  if (aHashEntry->mPrefFlags.HasUserValue()) {
+    stringVal = aHashEntry->mUserPref.mStringVal;
     if (strlen(stringVal) > MAX_ADVISABLE_PREF_LENGTH) {
       return false;
     }
   }
 
   return true;
 }
 
 static void
 GetPrefValueFromEntry(PrefHashEntry* aHashEntry,
                       dom::PrefSetting* aPref,
                       WhichValue aWhich)
 {
   PrefValue* value;
   dom::PrefValue* settingValue;
   if (aWhich == USER_VALUE) {
-    value = &aHashEntry->userPref;
+    value = &aHashEntry->mUserPref;
     aPref->userValue() = dom::PrefValue();
     settingValue = &aPref->userValue().get_PrefValue();
   } else {
-    value = &aHashEntry->defaultPref;
+    value = &aHashEntry->mDefaultPref;
     aPref->defaultValue() = dom::PrefValue();
     settingValue = &aPref->defaultValue().get_PrefValue();
   }
 
-  switch (aHashEntry->prefFlags.GetPrefType()) {
+  switch (aHashEntry->mPrefFlags.GetPrefType()) {
     case PrefType::String:
-      *settingValue = nsDependentCString(value->stringVal);
+      *settingValue = nsDependentCString(value->mStringVal);
       return;
     case PrefType::Int:
-      *settingValue = value->intVal;
+      *settingValue = value->mIntVal;
       return;
     case PrefType::Bool:
-      *settingValue = !!value->boolVal;
+      *settingValue = !!value->mBoolVal;
       return;
     default:
       MOZ_CRASH();
   }
 }
 
 void
 pref_GetPrefFromEntry(PrefHashEntry* aHashEntry, dom::PrefSetting* aPref)
 {
-  aPref->name() = aHashEntry->key;
+  aPref->name() = aHashEntry->mKey;
 
-  if (aHashEntry->prefFlags.HasDefault()) {
+  if (aHashEntry->mPrefFlags.HasDefault()) {
     GetPrefValueFromEntry(aHashEntry, aPref, DEFAULT_VALUE);
   } else {
     aPref->defaultValue() = null_t();
   }
 
-  if (aHashEntry->prefFlags.HasUserValue()) {
+  if (aHashEntry->mPrefFlags.HasUserValue()) {
     GetPrefValueFromEntry(aHashEntry, aPref, USER_VALUE);
   } else {
     aPref->userValue() = null_t();
   }
 
   MOZ_ASSERT(aPref->defaultValue().type() == dom::MaybePrefValue::Tnull_t ||
              aPref->userValue().type() == dom::MaybePrefValue::Tnull_t ||
              (aPref->defaultValue().get_PrefValue().type() ==
@@ -473,36 +475,36 @@ pref_GetPrefFromEntry(PrefHashEntry* aHa
 bool
 PREF_HasUserPref(const char* aPrefName)
 {
   if (!gHashTable) {
     return false;
   }
 
   PrefHashEntry* pref = pref_HashTableLookup(aPrefName);
-  return pref && pref->prefFlags.HasUserValue();
+  return pref && pref->mPrefFlags.HasUserValue();
 }
 
 nsresult
 PREF_CopyCharPref(const char* aPrefName, char** aValueOut, bool aGetDefault)
 {
   if (!gHashTable) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   nsresult rv = NS_ERROR_UNEXPECTED;
   char* stringVal;
   PrefHashEntry* pref = pref_HashTableLookup(aPrefName);
 
-  if (pref && pref->prefFlags.IsTypeString()) {
-    if (aGetDefault || pref->prefFlags.IsLocked() ||
-        !pref->prefFlags.HasUserValue()) {
-      stringVal = pref->defaultPref.stringVal;
+  if (pref && pref->mPrefFlags.IsTypeString()) {
+    if (aGetDefault || pref->mPrefFlags.IsLocked() ||
+        !pref->mPrefFlags.HasUserValue()) {
+      stringVal = pref->mDefaultPref.mStringVal;
     } else {
-      stringVal = pref->userPref.stringVal;
+      stringVal = pref->mUserPref.mStringVal;
     }
 
     if (stringVal) {
       *aValueOut = NS_strdup(stringVal);
       rv = NS_OK;
     }
   }
 
@@ -513,28 +515,28 @@ nsresult
 PREF_GetIntPref(const char* aPrefName, int32_t* aValueOut, bool aGetDefault)
 {
   if (!gHashTable) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   nsresult rv = NS_ERROR_UNEXPECTED;
   PrefHashEntry* pref = pref_HashTableLookup(aPrefName);
-  if (pref && pref->prefFlags.IsTypeInt()) {
-    if (aGetDefault || pref->prefFlags.IsLocked() ||
-        !pref->prefFlags.HasUserValue()) {
-      int32_t tempInt = pref->defaultPref.intVal;
+  if (pref && pref->mPrefFlags.IsTypeInt()) {
+    if (aGetDefault || pref->mPrefFlags.IsLocked() ||
+        !pref->mPrefFlags.HasUserValue()) {
+      int32_t tempInt = pref->mDefaultPref.mIntVal;
 
       // Check to see if we even had a default.
-      if (!pref->prefFlags.HasDefault()) {
+      if (!pref->mPrefFlags.HasDefault()) {
         return NS_ERROR_UNEXPECTED;
       }
       *aValueOut = tempInt;
     } else {
-      *aValueOut = pref->userPref.intVal;
+      *aValueOut = pref->mUserPref.mIntVal;
     }
     rv = NS_OK;
   }
 
   return rv;
 }
 
 nsresult
@@ -542,28 +544,28 @@ PREF_GetBoolPref(const char* aPrefName, 
 {
   if (!gHashTable) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   nsresult rv = NS_ERROR_UNEXPECTED;
   PrefHashEntry* pref = pref_HashTableLookup(aPrefName);
   //NS_ASSERTION(pref, aPrefName);
-  if (pref && pref->prefFlags.IsTypeBool()) {
-    if (aGetDefault || pref->prefFlags.IsLocked() ||
-        !pref->prefFlags.HasUserValue()) {
-      bool tempBool = pref->defaultPref.boolVal;
+  if (pref && pref->mPrefFlags.IsTypeBool()) {
+    if (aGetDefault || pref->mPrefFlags.IsLocked() ||
+        !pref->mPrefFlags.HasUserValue()) {
+      bool tempBool = pref->mDefaultPref.mBoolVal;
 
       // Check to see if we even had a default.
-      if (pref->prefFlags.HasDefault()) {
+      if (pref->mPrefFlags.HasDefault()) {
         *aValueOut = tempBool;
         rv = NS_OK;
       }
     } else {
-      *aValueOut = pref->userPref.boolVal;
+      *aValueOut = pref->mUserPref.mBoolVal;
       rv = NS_OK;
     }
   }
 
   return rv;
 }
 
 nsresult
@@ -591,39 +593,39 @@ PREF_DeleteBranch(const char* aBranchNam
   const char* to_delete = branch_dot.get();
   MOZ_ASSERT(to_delete);
   len = strlen(to_delete);
   for (auto iter = gHashTable->Iter(); !iter.Done(); iter.Next()) {
     auto entry = static_cast<PrefHashEntry*>(iter.Get());
 
     // Note: if we're deleting "ldap" then we want to delete "ldap.xxx" and
     // "ldap" (if such a leaf node exists) but not "ldap_1.xxx".
-    if (PL_strncmp(entry->key, to_delete, len) == 0 ||
-        (len - 1 == strlen(entry->key) &&
-         PL_strncmp(entry->key, to_delete, len - 1) == 0)) {
+    if (PL_strncmp(entry->mKey, to_delete, len) == 0 ||
+        (len - 1 == strlen(entry->mKey) &&
+         PL_strncmp(entry->mKey, to_delete, len - 1) == 0)) {
       iter.Remove();
     }
   }
 
   MakeDirtyCallback();
   return NS_OK;
 }
 
 nsresult
 PREF_ClearUserPref(const char* aPrefName)
 {
   if (!gHashTable) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   PrefHashEntry* pref = pref_HashTableLookup(aPrefName);
-  if (pref && pref->prefFlags.HasUserValue()) {
-    pref->prefFlags.SetHasUserValue(false);
+  if (pref && pref->mPrefFlags.HasUserValue()) {
+    pref->mPrefFlags.SetHasUserValue(false);
 
-    if (!pref->prefFlags.HasDefault()) {
+    if (!pref->mPrefFlags.HasDefault()) {
       gHashTable->RemoveEntry(pref);
     }
 
     pref_DoCallback(aPrefName);
     MakeDirtyCallback();
   }
   return NS_OK;
 }
@@ -636,21 +638,21 @@ PREF_ClearAllUserPrefs()
   if (!gHashTable) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   std::vector<std::string> prefStrings;
   for (auto iter = gHashTable->Iter(); !iter.Done(); iter.Next()) {
     auto pref = static_cast<PrefHashEntry*>(iter.Get());
 
-    if (pref->prefFlags.HasUserValue()) {
-      prefStrings.push_back(std::string(pref->key));
+    if (pref->mPrefFlags.HasUserValue()) {
+      prefStrings.push_back(std::string(pref->mKey));
 
-      pref->prefFlags.SetHasUserValue(false);
-      if (!pref->prefFlags.HasDefault()) {
+      pref->mPrefFlags.SetHasUserValue(false);
+      if (!pref->mPrefFlags.HasDefault()) {
         iter.Remove();
       }
     }
   }
 
   for (std::string& prefString : prefStrings) {
     pref_DoCallback(prefString.c_str());
   }
@@ -667,50 +669,50 @@ PREF_LockPref(const char* aKey, bool aLo
   }
 
   PrefHashEntry* pref = pref_HashTableLookup(aKey);
   if (!pref) {
     return NS_ERROR_UNEXPECTED;
   }
 
   if (aLockIt) {
-    if (!pref->prefFlags.IsLocked()) {
-      pref->prefFlags.SetLocked(true);
+    if (!pref->mPrefFlags.IsLocked()) {
+      pref->mPrefFlags.SetLocked(true);
       gIsAnyPrefLocked = true;
       pref_DoCallback(aKey);
     }
-  } else if (pref->prefFlags.IsLocked()) {
-    pref->prefFlags.SetLocked(false);
+  } else if (pref->mPrefFlags.IsLocked()) {
+    pref->mPrefFlags.SetLocked(false);
     pref_DoCallback(aKey);
   }
 
   return NS_OK;
 }
 
 //
 // Hash table functions
 //
 
 static bool
 pref_ValueChanged(PrefValue aOldValue, PrefValue aNewValue, PrefType aType)
 {
   bool changed = true;
   switch (aType) {
     case PrefType::String:
-      if (aOldValue.stringVal && aNewValue.stringVal) {
-        changed = (strcmp(aOldValue.stringVal, aNewValue.stringVal) != 0);
+      if (aOldValue.mStringVal && aNewValue.mStringVal) {
+        changed = (strcmp(aOldValue.mStringVal, aNewValue.mStringVal) != 0);
       }
       break;
 
     case PrefType::Int:
-      changed = aOldValue.intVal != aNewValue.intVal;
+      changed = aOldValue.mIntVal != aNewValue.mIntVal;
       break;
 
     case PrefType::Bool:
-      changed = aOldValue.boolVal != aNewValue.boolVal;
+      changed = aOldValue.mBoolVal != aNewValue.mBoolVal;
       break;
 
     case PrefType::Invalid:
     default:
       changed = false;
       break;
   }
 
@@ -721,25 +723,25 @@ pref_ValueChanged(PrefValue aOldValue, P
 // that they are not changing the type of a preference that has a default
 // value.
 static PrefTypeFlags
 pref_SetValue(PrefValue* aExistingValue,
               PrefTypeFlags aFlags,
               PrefValue aNewValue,
               PrefType aNewType)
 {
-  if (aFlags.IsTypeString() && aExistingValue->stringVal) {
-    PL_strfree(aExistingValue->stringVal);
+  if (aFlags.IsTypeString() && aExistingValue->mStringVal) {
+    PL_strfree(aExistingValue->mStringVal);
   }
 
   aFlags.SetPrefType(aNewType);
   if (aFlags.IsTypeString()) {
-    MOZ_ASSERT(aNewValue.stringVal);
-    aExistingValue->stringVal =
-      aNewValue.stringVal ? PL_strdup(aNewValue.stringVal) : nullptr;
+    MOZ_ASSERT(aNewValue.mStringVal);
+    aExistingValue->mStringVal =
+      aNewValue.mStringVal ? PL_strdup(aNewValue.mStringVal) : nullptr;
   } else {
     *aExistingValue = aNewValue;
   }
 
   return aFlags;
 }
 
 #ifdef DEBUG
@@ -755,19 +757,19 @@ pref_SetInitPhase(pref_initPhase aPhase)
 
 pref_initPhase
 pref_GetInitPhase()
 {
   return gPhase;
 }
 
 void
-pref_SetWatchingPref(bool watching)
+pref_SetWatchingPref(bool aWatching)
 {
-  gWatchingPref = watching;
+  gWatchingPref = aWatching;
 }
 
 struct StringComparator
 {
   const char* mKey;
   explicit StringComparator(const char* aKey)
     : mKey(aKey)
   {
@@ -819,76 +821,76 @@ pref_HashPref(const char* aKey,
   }
 
   auto pref = static_cast<PrefHashEntry*>(gHashTable->Add(aKey, fallible));
   if (!pref) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   // New entry, need to initialize.
-  if (!pref->key) {
+  if (!pref->mKey) {
     // Initialize the pref entry.
-    pref->prefFlags.Reset().SetPrefType(aType);
-    pref->key = ArenaStrdup(aKey, gPrefNameArena);
-    memset(&pref->defaultPref, 0, sizeof(pref->defaultPref));
-    memset(&pref->userPref, 0, sizeof(pref->userPref));
+    pref->mPrefFlags.Reset().SetPrefType(aType);
+    pref->mKey = ArenaStrdup(aKey, gPrefNameArena);
+    memset(&pref->mDefaultPref, 0, sizeof(pref->mDefaultPref));
+    memset(&pref->mUserPref, 0, sizeof(pref->mUserPref));
 
-  } else if (pref->prefFlags.HasDefault() &&
-             !pref->prefFlags.IsPrefType(aType)) {
+  } else if (pref->mPrefFlags.HasDefault() &&
+             !pref->mPrefFlags.IsPrefType(aType)) {
     NS_WARNING(
       nsPrintfCString(
         "Trying to overwrite value of default pref %s with the wrong type!",
         aKey)
         .get());
 
     return NS_ERROR_UNEXPECTED;
   }
 
   bool valueChanged = false;
   if (aFlags & kPrefSetDefault) {
-    if (!pref->prefFlags.IsLocked()) {
+    if (!pref->mPrefFlags.IsLocked()) {
       // ?? change of semantics?
-      if (pref_ValueChanged(pref->defaultPref, aValue, aType) ||
-          !pref->prefFlags.HasDefault()) {
-        pref->prefFlags =
-          pref_SetValue(&pref->defaultPref, pref->prefFlags, aValue, aType)
+      if (pref_ValueChanged(pref->mDefaultPref, aValue, aType) ||
+          !pref->mPrefFlags.HasDefault()) {
+        pref->mPrefFlags =
+          pref_SetValue(&pref->mDefaultPref, pref->mPrefFlags, aValue, aType)
             .SetHasDefault(true);
         if (aFlags & kPrefStickyDefault) {
-          pref->prefFlags.SetHasStickyDefault(true);
+          pref->mPrefFlags.SetHasStickyDefault(true);
         }
-        if (!pref->prefFlags.HasUserValue()) {
+        if (!pref->mPrefFlags.HasUserValue()) {
           valueChanged = true;
         }
       }
       // What if we change the default to be the same as the user value?
       // Should we clear the user value?
     }
   } else {
     // If new value is same as the default value and it's not a "sticky" pref,
     // then un-set the user value. Otherwise, set the user value only if it has
     // changed.
-    if ((pref->prefFlags.HasDefault()) &&
-        !(pref->prefFlags.HasStickyDefault()) &&
-        !pref_ValueChanged(pref->defaultPref, aValue, aType) &&
+    if ((pref->mPrefFlags.HasDefault()) &&
+        !(pref->mPrefFlags.HasStickyDefault()) &&
+        !pref_ValueChanged(pref->mDefaultPref, aValue, aType) &&
         !(aFlags & kPrefForceSet)) {
-      if (pref->prefFlags.HasUserValue()) {
+      if (pref->mPrefFlags.HasUserValue()) {
         // XXX should we free a user-set string value if there is one?
-        pref->prefFlags.SetHasUserValue(false);
-        if (!pref->prefFlags.IsLocked()) {
+        pref->mPrefFlags.SetHasUserValue(false);
+        if (!pref->mPrefFlags.IsLocked()) {
           MakeDirtyCallback();
           valueChanged = true;
         }
       }
-    } else if (!pref->prefFlags.HasUserValue() ||
-               !pref->prefFlags.IsPrefType(aType) ||
-               pref_ValueChanged(pref->userPref, aValue, aType)) {
-      pref->prefFlags =
-        pref_SetValue(&pref->userPref, pref->prefFlags, aValue, aType)
+    } else if (!pref->mPrefFlags.HasUserValue() ||
+               !pref->mPrefFlags.IsPrefType(aType) ||
+               pref_ValueChanged(pref->mUserPref, aValue, aType)) {
+      pref->mPrefFlags =
+        pref_SetValue(&pref->mUserPref, pref->mPrefFlags, aValue, aType)
           .SetHasUserValue(true);
-      if (!pref->prefFlags.IsLocked()) {
+      if (!pref->mPrefFlags.IsLocked()) {
         MakeDirtyCallback();
         valueChanged = true;
       }
     }
   }
 
   if (valueChanged) {
     return pref_DoCallback(aKey);
@@ -909,29 +911,29 @@ pref_SizeOfPrivateData(MallocSizeOf aMal
 }
 
 PrefType
 PREF_GetPrefType(const char* aPrefName)
 {
   if (gHashTable) {
     PrefHashEntry* pref = pref_HashTableLookup(aPrefName);
     if (pref) {
-      return pref->prefFlags.GetPrefType();
+      return pref->mPrefFlags.GetPrefType();
     }
   }
   return PrefType::Invalid;
 }
 
 bool
 PREF_PrefIsLocked(const char* aPrefName)
 {
   bool result = false;
   if (gIsAnyPrefLocked && gHashTable) {
     PrefHashEntry* pref = pref_HashTableLookup(aPrefName);
-    if (pref && pref->prefFlags.IsLocked()) {
+    if (pref && pref->mPrefFlags.IsLocked()) {
       result = true;
     }
   }
 
   return result;
 }
 
 // Adds a node to the beginning of the callback list.
--- a/modules/libpref/prefapi.h
+++ b/modules/libpref/prefapi.h
@@ -1,261 +1,264 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
-/*
-// <pre>
-*/
-#ifndef PREFAPI_H
-#define PREFAPI_H
+#ifndef prefapi_h
+#define prefapi_h
 
 #include "nscore.h"
 #include "PLDHashTable.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 // 1 MB should be enough for everyone.
 static const uint32_t MAX_PREF_LENGTH = 1 * 1024 * 1024;
 // Actually, 4kb should be enough for everyone.
 static const uint32_t MAX_ADVISABLE_PREF_LENGTH = 4 * 1024;
 
-typedef union
-{
-    char*       stringVal;
-    int32_t     intVal;
-    bool        boolVal;
+typedef union {
+  char* mStringVal;
+  int32_t mIntVal;
+  bool mBoolVal;
 } PrefValue;
 
-/*
-// <font color=blue>
-// The Init function initializes the preference context and creates
-// the preference hashtable.
-// </font>
-*/
-void        PREF_Init();
+// The Init function initializes the preference context and creates the
+// preference hashtable.
+void
+PREF_Init();
 
-/*
-// Cleanup should be called at program exit to free the
-// list of registered callbacks.
-*/
-void        PREF_Cleanup();
-void        PREF_CleanupPrefs();
+// Cleanup should be called at program exit to free the list of registered
+// callbacks.
+void
+PREF_Cleanup();
+void
+PREF_CleanupPrefs();
 
-/*
-// <font color=blue>
-// Preference flags, including the native type of the preference. Changing any of these
-// values will require modifying the code inside of PrefTypeFlags class.
-// </font>
-*/
-
-enum class PrefType {
+// Preference flags, including the native type of the preference. Changing any
+// of these values will require modifying the code inside of PrefTypeFlags
+// class.
+enum class PrefType
+{
   Invalid = 0,
   String = 1,
   Int = 2,
   Bool = 3,
 };
 
 // Keep the type of the preference, as well as the flags guiding its behaviour.
 class PrefTypeFlags
 {
 public:
-  PrefTypeFlags() : mValue(AsInt(PrefType::Invalid)) {}
-  explicit PrefTypeFlags(PrefType aType) : mValue(AsInt(aType)) {}
-  PrefTypeFlags& Reset() { mValue = AsInt(PrefType::Invalid); return *this; }
+  PrefTypeFlags()
+    : mValue(AsInt(PrefType::Invalid))
+  {
+  }
+
+  explicit PrefTypeFlags(PrefType aType)
+    : mValue(AsInt(aType))
+  {
+  }
+
+  PrefTypeFlags& Reset()
+  {
+    mValue = AsInt(PrefType::Invalid);
+    return *this;
+  }
 
   bool IsTypeValid() const { return !IsPrefType(PrefType::Invalid); }
   bool IsTypeString() const { return IsPrefType(PrefType::String); }
   bool IsTypeInt() const { return IsPrefType(PrefType::Int); }
   bool IsTypeBool() const { return IsPrefType(PrefType::Bool); }
   bool IsPrefType(PrefType type) const { return GetPrefType() == type; }
 
-  PrefTypeFlags& SetPrefType(PrefType aType) {
+  PrefTypeFlags& SetPrefType(PrefType aType)
+  {
     mValue = mValue - AsInt(GetPrefType()) + AsInt(aType);
     return *this;
   }
-  PrefType GetPrefType() const {
-    return (PrefType)(mValue & (AsInt(PrefType::String) |
-                                AsInt(PrefType::Int) |
+
+  PrefType GetPrefType() const
+  {
+    return (PrefType)(mValue & (AsInt(PrefType::String) | AsInt(PrefType::Int) |
                                 AsInt(PrefType::Bool)));
   }
 
   bool HasDefault() const { return mValue & PREF_FLAG_HAS_DEFAULT; }
-  PrefTypeFlags& SetHasDefault(bool aSetOrUnset) { return SetFlag(PREF_FLAG_HAS_DEFAULT, aSetOrUnset); }
+
+  PrefTypeFlags& SetHasDefault(bool aSetOrUnset)
+  {
+    return SetFlag(PREF_FLAG_HAS_DEFAULT, aSetOrUnset);
+  }
 
   bool HasStickyDefault() const { return mValue & PREF_FLAG_STICKY_DEFAULT; }
-  PrefTypeFlags& SetHasStickyDefault(bool aSetOrUnset) { return SetFlag(PREF_FLAG_STICKY_DEFAULT, aSetOrUnset); }
+
+  PrefTypeFlags& SetHasStickyDefault(bool aSetOrUnset)
+  {
+    return SetFlag(PREF_FLAG_STICKY_DEFAULT, aSetOrUnset);
+  }
 
   bool IsLocked() const { return mValue & PREF_FLAG_LOCKED; }
-  PrefTypeFlags& SetLocked(bool aSetOrUnset) { return SetFlag(PREF_FLAG_LOCKED, aSetOrUnset); }
+
+  PrefTypeFlags& SetLocked(bool aSetOrUnset)
+  {
+    return SetFlag(PREF_FLAG_LOCKED, aSetOrUnset);
+  }
 
   bool HasUserValue() const { return mValue & PREF_FLAG_USERSET; }
-  PrefTypeFlags& SetHasUserValue(bool aSetOrUnset) { return SetFlag(PREF_FLAG_USERSET, aSetOrUnset); }
+
+  PrefTypeFlags& SetHasUserValue(bool aSetOrUnset)
+  {
+    return SetFlag(PREF_FLAG_USERSET, aSetOrUnset);
+  }
 
 private:
   static uint16_t AsInt(PrefType aType) { return (uint16_t)aType; }
 
-  PrefTypeFlags& SetFlag(uint16_t aFlag, bool aSetOrUnset) {
+  PrefTypeFlags& SetFlag(uint16_t aFlag, bool aSetOrUnset)
+  {
     mValue = aSetOrUnset ? mValue | aFlag : mValue & ~aFlag;
     return *this;
   }
 
-  // Pack both the value of type (PrefType) and flags into the same int.  This is why
-  // the flag enum starts at 4, as PrefType occupies the bottom two bits.
-  enum {
+  // We pack both the value of type (PrefType) and flags into the same int. The
+  // flag enum starts at 4 so that the PrefType can occupy the bottom two bits.
+  enum
+  {
     PREF_FLAG_LOCKED = 4,
     PREF_FLAG_USERSET = 8,
     PREF_FLAG_CONFIG = 16,
     PREF_FLAG_REMOTE = 32,
     PREF_FLAG_LILOCAL = 64,
     PREF_FLAG_HAS_DEFAULT = 128,
     PREF_FLAG_STICKY_DEFAULT = 256,
   };
   uint16_t mValue;
 };
 
 struct PrefHashEntry : PLDHashEntryHdr
 {
-    PrefTypeFlags prefFlags; // This field goes first to minimize struct size on 64-bit.
-    const char *key;
-    PrefValue defaultPref;
-    PrefValue userPref;
+  PrefTypeFlags mPrefFlags; // this field first to minimize 64-bit struct size
+  const char* mKey;
+  PrefValue mDefaultPref;
+  PrefValue mUserPref;
 };
 
-/*
-// <font color=blue>
-// Set the various types of preferences.  These functions take a dotted
-// notation of the preference name (e.g. "browser.startup.homepage").
-// Note that this will cause the preference to be saved to the file if
-// it is different from the default.  In other words, these are used
-// to set the _user_ preferences.
+// Set the various types of preferences. These functions take a dotted notation
+// of the preference name (e.g. "browser.startup.homepage"). Note that this
+// will cause the preference to be saved to the file if it is different from
+// the default. In other words, these are used to set the _user_ preferences.
 //
-// If set_default is set to true however, it sets the default value.
-// This will only affect the program behavior if the user does not have a value
-// saved over it for the particular preference.  In addition, these will never
-// be saved out to disk.
+// If aSetDefault is set to true however, it sets the default value. This will
+// only affect the program behavior if the user does not have a value saved
+// over it for the particular preference. In addition, these will never be
+// saved out to disk.
 //
-// Each set returns PREF_VALUECHANGED if the user value changed
-// (triggering a callback), or PREF_NOERROR if the value was unchanged.
-// </font>
-*/
-nsresult PREF_SetCharPref(const char *pref,const char* value, bool set_default = false);
-nsresult PREF_SetIntPref(const char *pref,int32_t value, bool set_default = false);
-nsresult PREF_SetBoolPref(const char *pref,bool value, bool set_default = false);
+// Each set returns PREF_VALUECHANGED if the user value changed (triggering a
+// callback), or PREF_NOERROR if the value was unchanged.
+nsresult
+PREF_SetCharPref(const char* aPref, const char* aVal, bool aSetDefault = false);
+nsresult
+PREF_SetIntPref(const char* aPref, int32_t aVal, bool aSetDefault = false);
+nsresult
+PREF_SetBoolPref(const char* aPref, bool aVal, bool aSetDefault = false);
 
-bool     PREF_HasUserPref(const char* pref_name);
+bool
+PREF_HasUserPref(const char* aPrefName);
 
-/*
-// <font color=blue>
-// Get the various types of preferences.  These functions take a dotted
+// Get the various types of preferences. These functions take a dotted
 // notation of the preference name (e.g. "browser.startup.homepage")
 //
 // They also take a pointer to fill in with the return value and return an
-// error value.  At the moment, this is simply an int but it may
+// error value. At the moment, this is simply an int but it may
 // be converted to an enum once the global error strategy is worked out.
 //
 // They will perform conversion if the type doesn't match what was requested.
 // (if it is reasonably possible)
-// </font>
-*/
-nsresult PREF_GetIntPref(const char *pref,
-                           int32_t * return_int, bool get_default);
-nsresult PREF_GetBoolPref(const char *pref, bool * return_val, bool get_default);
-/*
-// <font color=blue>
+nsresult
+PREF_GetIntPref(const char* aPref, int32_t* aValueOut, bool aGetDefault);
+nsresult
+PREF_GetBoolPref(const char* aPref, bool* aValueOut, bool aGetDefault);
+
 // These functions are similar to the above "Get" version with the significant
-// difference that the preference module will alloc the memory (e.g. XP_STRDUP) and
-// the caller will need to be responsible for freeing it...
-// </font>
-*/
-nsresult PREF_CopyCharPref(const char *pref, char ** return_buf, bool get_default);
-/*
-// <font color=blue>
-// bool function that returns whether or not the preference is locked and therefore
-// cannot be changed.
-// </font>
-*/
-bool PREF_PrefIsLocked(const char *pref_name);
+// difference that the preference module will alloc the memory (e.g. XP_STRDUP)
+// and the caller will need to be responsible for freeing it...
+nsresult
+PREF_CopyCharPref(const char* aPref, char** aValueOut, bool aGetDefault);
 
-/*
-// <font color=blue>
+// Bool function that returns whether or not the preference is locked and
+// therefore cannot be changed.
+bool
+PREF_PrefIsLocked(const char* aPrefName);
+
 // Function that sets whether or not the preference is locked and therefore
 // cannot be changed.
-// </font>
-*/
-nsresult PREF_LockPref(const char *key, bool lockIt);
+nsresult
+PREF_LockPref(const char* aKey, bool aLockIt);
 
-PrefType PREF_GetPrefType(const char *pref_name);
+PrefType
+PREF_GetPrefType(const char* aPrefName);
 
-/*
- * Delete a branch of the tree
- */
-nsresult PREF_DeleteBranch(const char *branch_name);
+// Delete a branch of the tree.
+nsresult
+PREF_DeleteBranch(const char* aBranchName);
 
-/*
- * Clears the given pref (reverts it to its default value)
- */
-nsresult PREF_ClearUserPref(const char *pref_name);
+// Clears the given pref (reverts it to its default value).
+nsresult
+PREF_ClearUserPref(const char* aPrefName);
 
-/*
- * Clears all user prefs
- */
-nsresult PREF_ClearAllUserPrefs();
+// Clears all user prefs.
+nsresult
+PREF_ClearAllUserPrefs();
 
-
-/*
-// <font color=blue>
 // The callback function will get passed the pref_node which triggered the call
-// and the void * instance_data which was passed to the register callback function.
-// Return a non-zero result (nsresult) to pass an error up to the caller.
-// </font>
-*/
-/* Temporarily conditionally compile PrefChangedFunc typedef.
-** During migration from old libpref to nsIPref we need it in
-** both header files.  Eventually prefapi.h will become a private
-** file.  The two types need to be in sync for now.  Certain
-** compilers were having problems with multiple definitions.
-*/
+// and the void* instance_data which was passed to the registered callback
+// function. Return a non-zero result (nsresult) to pass an error up to the
+// caller.
+//
+// Temporarily conditionally compile PrefChangedFunc typedef. During migration
+// from old libpref to nsIPref we need it in both header files. Eventually
+// prefapi.h will become a private file. The two types need to be in sync for
+// now. Certain compilers were having problems with multiple definitions.
 #ifndef have_PrefChangedFunc_typedef
-typedef void (*PrefChangedFunc) (const char *, void *);
+typedef void (*PrefChangedFunc)(const char*, void*);
 #define have_PrefChangedFunc_typedef
 #endif
 
-/*
-// <font color=blue>
-// Register a callback.  This takes a node in the preference tree and will
-// call the callback function if anything below that node is modified.
-// Unregister returns PREF_NOERROR if a callback was found that
-// matched all the parameters; otherwise it returns PREF_ERROR.
-// </font>
-*/
-void PREF_RegisterPriorityCallback(const char* domain,
-                                   PrefChangedFunc callback,
-                                   void* instance_data );
-void PREF_RegisterCallback(const char* domain,
-                           PrefChangedFunc callback, void* instance_data );
-nsresult PREF_UnregisterCallback(const char* domain,
-                                 PrefChangedFunc callback, void* instance_data );
+// Register a callback. This takes a node in the preference tree and will call
+// the callback function if anything below that node is modified. Unregister
+// returns PREF_NOERROR if a callback was found that matched all the
+// parameters; otherwise it returns PREF_ERROR.
+void
+PREF_RegisterPriorityCallback(const char* aPrefNode,
+                              PrefChangedFunc aCallback,
+                              void* aData);
+void
+PREF_RegisterCallback(const char* aPrefNode,
+                      PrefChangedFunc aCallback,
+                      void* aData);
+nsresult
+PREF_UnregisterCallback(const char* aPrefNode,
+                        PrefChangedFunc aCallback,
+                        void* aData);
 
-/*
- * Used by nsPrefService as the callback function of the 'pref' parser
- */
-void PREF_ReaderCallback( void *closure,
-                          const char *pref,
-                          PrefValue   value,
-                          PrefType    type,
-                          bool        isDefault,
-                          bool        isStickyDefault);
+// Used by nsPrefService as the callback function of the prefs parser.
+void
+PREF_ReaderCallback(void* aClosure,
+                    const char* aPref,
+                    PrefValue aValue,
+                    PrefType aType,
+                    bool aIsDefault,
+                    bool aIsStickyDefault);
 
-
-/*
- * Callback whenever we change a preference
- */
-typedef void (*PrefsDirtyFunc) ();
+// Callback for whenever we change a preference.
+typedef void (*PrefsDirtyFunc)();
 void PREF_SetDirtyCallback(PrefsDirtyFunc);
 
 #ifdef __cplusplus
 }
 #endif
-#endif
+
+#endif // prefapi_h
--- a/modules/libpref/prefapi_private_data.h
+++ b/modules/libpref/prefapi_private_data.h
@@ -1,54 +1,56 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
-/* Data shared between prefapi.c and nsPref.cpp */
+// Data shared between prefapi.c and nsPref.cpp.
 
 #ifndef prefapi_private_data_h
 #define prefapi_private_data_h
 
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/UniquePtr.h"
 #include "Preferences.h"
 
 extern PLDHashTable* gHashTable;
 
 namespace mozilla {
 namespace dom {
 class PrefSetting;
 } // namespace dom
 } // namespace mozilla
 
-
-typedef nsTArray<mozilla::UniqueFreePtr<char> > PrefSaveData;
+typedef nsTArray<mozilla::UniqueFreePtr<char>> PrefSaveData;
 
 PrefSaveData
 pref_savePrefs(PLDHashTable* aTable);
 
 nsresult
 pref_SetPref(const mozilla::dom::PrefSetting& aPref);
 
 #ifdef DEBUG
 void
-pref_SetInitPhase(pref_initPhase phase);
+pref_SetInitPhase(pref_initPhase aPhase);
 
 pref_initPhase
 pref_GetInitPhase();
 
 void
-pref_SetWatchingPref(bool watching);
+pref_SetWatchingPref(bool aWatching);
 #endif
 
-PrefHashEntry* pref_HashTableLookup(const char *key);
+PrefHashEntry*
+pref_HashTableLookup(const char* aKey);
 
 bool
 pref_EntryHasAdvisablySizedValues(PrefHashEntry* aHashEntry);
 
-void pref_GetPrefFromEntry(PrefHashEntry *aHashEntry,
-                           mozilla::dom::PrefSetting* aPref);
+void
+pref_GetPrefFromEntry(PrefHashEntry* aHashEntry,
+                      mozilla::dom::PrefSetting* aPref);
 
 size_t
 pref_SizeOfPrivateData(mozilla::MallocSizeOf aMallocSizeOf);
 
 #endif
--- a/modules/libpref/prefread.cpp
+++ b/modules/libpref/prefread.cpp
@@ -50,68 +50,68 @@ static const char kUserPref[] = "user_pr
 static const char kPref[] = "pref";
 static const char kPrefSticky[] = "sticky_pref";
 static const char kTrue[] = "true";
 static const char kFalse[] = "false";
 
 // This function will increase the size of the buffer owned by the given pref
 // parse state. We currently use a simple doubling algorithm, but the only hard
 // requirement is that it increase the buffer by at least the size of the
-// aPS->esctmp buffer used for escape processing (currently 6 bytes).
+// aPS->mEscTmp buffer used for escape processing (currently 6 bytes).
 //
 // The buffer is used to store partial pref lines. It is freed when the parse
 // state is destroyed.
 //
 // @param aPS
 //        parse state instance
 //
-// This function updates all pointers that reference an address within lb since
-// realloc may relocate the buffer.
+// This function updates all pointers that reference an address within mLb
+// since realloc may relocate the buffer.
 //
 // @return false if insufficient memory.
 static bool
 pref_GrowBuf(PrefParseState* aPS)
 {
   int bufLen, curPos, valPos;
 
-  bufLen = aPS->lbend - aPS->lb;
-  curPos = aPS->lbcur - aPS->lb;
-  valPos = aPS->vb - aPS->lb;
+  bufLen = aPS->mLbEnd - aPS->mLb;
+  curPos = aPS->mLbCur - aPS->mLb;
+  valPos = aPS->mVb - aPS->mLb;
 
   if (bufLen == 0) {
     bufLen = 128; // default buffer size
   } else {
     bufLen <<= 1; // double buffer size
   }
 
 #ifdef TEST_PREFREAD
   fprintf(stderr, ">>> realloc(%d)\n", bufLen);
 #endif
 
-  aPS->lb = (char*)realloc(aPS->lb, bufLen);
-  if (!aPS->lb) {
+  aPS->mLb = (char*)realloc(aPS->mLb, bufLen);
+  if (!aPS->mLb) {
     return false;
   }
 
-  aPS->lbcur = aPS->lb + curPos;
-  aPS->lbend = aPS->lb + bufLen;
-  aPS->vb = aPS->lb + valPos;
+  aPS->mLbCur = aPS->mLb + curPos;
+  aPS->mLbEnd = aPS->mLb + bufLen;
+  aPS->mVb = aPS->mLb + valPos;
 
   return true;
 }
 
 // Report an error or a warning. If not specified, just dump to stderr.
 static void
 pref_ReportParseProblem(PrefParseState& aPS,
                         const char* aMessage,
                         int aLine,
                         bool aError)
 {
-  if (aPS.reporter) {
-    aPS.reporter(aMessage, aLine, aError);
+  if (aPS.mReporter) {
+    aPS.mReporter(aMessage, aLine, aError);
   } else {
     printf_stderr("**** Preference parsing %s (line %d) = %s **\n",
                   (aError ? "error" : "warning"),
                   aLine,
                   aMessage);
   }
 }
 
@@ -122,64 +122,64 @@ pref_ReportParseProblem(PrefParseState& 
 //        parse state instance
 //
 // @return false to indicate a fatal error.
 static bool
 pref_DoCallback(PrefParseState* aPS)
 {
   PrefValue value;
 
-  switch (aPS->vtype) {
+  switch (aPS->mVtype) {
     case PrefType::String:
-      value.stringVal = aPS->vb;
+      value.mStringVal = aPS->mVb;
       break;
 
     case PrefType::Int:
-      if ((aPS->vb[0] == '-' || aPS->vb[0] == '+') && aPS->vb[1] == '\0') {
+      if ((aPS->mVb[0] == '-' || aPS->mVb[0] == '+') && aPS->mVb[1] == '\0') {
         pref_ReportParseProblem(*aPS, "invalid integer value", 0, true);
         NS_WARNING("malformed integer value");
         return false;
       }
-      value.intVal = atoi(aPS->vb);
+      value.mIntVal = atoi(aPS->mVb);
       break;
 
     case PrefType::Bool:
-      value.boolVal = (aPS->vb == kTrue);
+      value.mBoolVal = (aPS->mVb == kTrue);
       break;
 
     default:
       break;
   }
 
-  (*aPS->reader)(aPS->closure,
-                 aPS->lb,
-                 value,
-                 aPS->vtype,
-                 aPS->fdefault,
-                 aPS->fstickydefault);
+  (*aPS->mReader)(aPS->mClosure,
+                  aPS->mLb,
+                  value,
+                  aPS->mVtype,
+                  aPS->mIsDefault,
+                  aPS->mIsStickyDefault);
   return true;
 }
 
 void
 PREF_InitParseState(PrefParseState* aPS,
                     PrefReader aReader,
                     PrefParseErrorReporter aReporter,
                     void* aClosure)
 {
   memset(aPS, 0, sizeof(*aPS));
-  aPS->reader = aReader;
-  aPS->closure = aClosure;
-  aPS->reporter = aReporter;
+  aPS->mReader = aReader;
+  aPS->mClosure = aClosure;
+  aPS->mReporter = aReporter;
 }
 
 void
 PREF_FinalizeParseState(PrefParseState* aPS)
 {
-  if (aPS->lb) {
-    free(aPS->lb);
+  if (aPS->mLb) {
+    free(aPS->mLb);
   }
 }
 
 // Pseudo-BNF
 // ----------
 // function      = LJUNK function-name JUNK function-args
 // function-name = "user_pref" | "pref" | "sticky_pref"
 // function-args = "(" JUNK pref-name JUNK "," JUNK pref-value JUNK ")" JUNK ";"
@@ -204,174 +204,175 @@ PREF_ParseBuf(PrefParseState* aPS, const
   const char* end;
   char c;
   char udigit;
   int state;
 
   // The line number is currently only used for the error/warning reporting.
   int lineNum = 0;
 
-  state = aPS->state;
+  state = aPS->mState;
   for (end = aBuf + aBufLen; aBuf != end; ++aBuf) {
     c = *aBuf;
     if (c == '\r' || c == '\n' || c == 0x1A) {
       lineNum++;
     }
 
     switch (state) {
       // initial state
       case PREF_PARSE_INIT:
-        if (aPS->lbcur != aPS->lb) { // reset state
-          aPS->lbcur = aPS->lb;
-          aPS->vb = nullptr;
-          aPS->vtype = PrefType::Invalid;
-          aPS->fdefault = false;
-          aPS->fstickydefault = false;
+        if (aPS->mLbCur != aPS->mLb) { // reset state
+          aPS->mLbCur = aPS->mLb;
+          aPS->mVb = nullptr;
+          aPS->mVtype = PrefType::Invalid;
+          aPS->mIsDefault = false;
+          aPS->mIsStickyDefault = false;
         }
         switch (c) {
           case '/': // begin comment block or line?
             state = PREF_PARSE_COMMENT_MAYBE_START;
             break;
           case '#': // accept shell style comments
             state = PREF_PARSE_UNTIL_EOL;
             break;
           case 'u': // indicating user_pref
           case 's': // indicating sticky_pref
           case 'p': // indicating pref
             if (c == 'u') {
-              aPS->smatch = kUserPref;
+              aPS->mStrMatch = kUserPref;
             } else if (c == 's') {
-              aPS->smatch = kPrefSticky;
+              aPS->mStrMatch = kPrefSticky;
             } else {
-              aPS->smatch = kPref;
+              aPS->mStrMatch = kPref;
             }
-            aPS->sindex = 1;
-            aPS->nextstate = PREF_PARSE_UNTIL_OPEN_PAREN;
+            aPS->mStrIndex = 1;
+            aPS->mNextState = PREF_PARSE_UNTIL_OPEN_PAREN;
             state = PREF_PARSE_MATCH_STRING;
             break;
             // else skip char
         }
         break;
 
       // string matching
       case PREF_PARSE_MATCH_STRING:
-        if (c == aPS->smatch[aPS->sindex++]) {
+        if (c == aPS->mStrMatch[aPS->mStrIndex++]) {
           // If we've matched all characters, then move to next state.
-          if (aPS->smatch[aPS->sindex] == '\0') {
-            state = aPS->nextstate;
-            aPS->nextstate = PREF_PARSE_INIT; // reset next state
+          if (aPS->mStrMatch[aPS->mStrIndex] == '\0') {
+            state = aPS->mNextState;
+            aPS->mNextState = PREF_PARSE_INIT; // reset next state
           }
           // else wait for next char
         } else {
           pref_ReportParseProblem(*aPS, "non-matching string", lineNum, true);
           NS_WARNING("malformed pref file");
           return false;
         }
         break;
 
       // quoted string parsing
       case PREF_PARSE_QUOTED_STRING:
         // we assume that the initial quote has already been consumed
-        if (aPS->lbcur == aPS->lbend && !pref_GrowBuf(aPS)) {
+        if (aPS->mLbCur == aPS->mLbEnd && !pref_GrowBuf(aPS)) {
           return false; // out of memory
         }
         if (c == '\\') {
           state = PREF_PARSE_ESC_SEQUENCE;
-        } else if (c == aPS->quotechar) {
-          *aPS->lbcur++ = '\0';
-          state = aPS->nextstate;
-          aPS->nextstate = PREF_PARSE_INIT; // reset next state
+        } else if (c == aPS->mQuoteChar) {
+          *aPS->mLbCur++ = '\0';
+          state = aPS->mNextState;
+          aPS->mNextState = PREF_PARSE_INIT; // reset next state
         } else {
-          *aPS->lbcur++ = c;
+          *aPS->mLbCur++ = c;
         }
         break;
 
       // name parsing
       case PREF_PARSE_UNTIL_NAME:
         if (c == '\"' || c == '\'') {
-          aPS->fdefault = (aPS->smatch == kPref || aPS->smatch == kPrefSticky);
-          aPS->fstickydefault = (aPS->smatch == kPrefSticky);
-          aPS->quotechar = c;
-          aPS->nextstate = PREF_PARSE_UNTIL_COMMA; // return here when done
+          aPS->mIsDefault =
+            (aPS->mStrMatch == kPref || aPS->mStrMatch == kPrefSticky);
+          aPS->mIsStickyDefault = (aPS->mStrMatch == kPrefSticky);
+          aPS->mQuoteChar = c;
+          aPS->mNextState = PREF_PARSE_UNTIL_COMMA; // return here when done
           state = PREF_PARSE_QUOTED_STRING;
-        } else if (c == '/') {    // allow embedded comment
-          aPS->nextstate = state; // return here when done with comment
+        } else if (c == '/') {     // allow embedded comment
+          aPS->mNextState = state; // return here when done with comment
           state = PREF_PARSE_COMMENT_MAYBE_START;
         } else if (!isspace(c)) {
           pref_ReportParseProblem(
             *aPS, "need space, comment or quote", lineNum, true);
           NS_WARNING("malformed pref file");
           return false;
         }
         break;
 
       // parse until we find a comma separating name and value
       case PREF_PARSE_UNTIL_COMMA:
         if (c == ',') {
-          aPS->vb = aPS->lbcur;
+          aPS->mVb = aPS->mLbCur;
           state = PREF_PARSE_UNTIL_VALUE;
-        } else if (c == '/') {    // allow embedded comment
-          aPS->nextstate = state; // return here when done with comment
+        } else if (c == '/') {     // allow embedded comment
+          aPS->mNextState = state; // return here when done with comment
           state = PREF_PARSE_COMMENT_MAYBE_START;
         } else if (!isspace(c)) {
           pref_ReportParseProblem(
             *aPS, "need space, comment or comma", lineNum, true);
           NS_WARNING("malformed pref file");
           return false;
         }
         break;
 
       // value parsing
       case PREF_PARSE_UNTIL_VALUE:
         // The pref value type is unknown. So, we scan for the first character
         // of the value, and determine the type from that.
         if (c == '\"' || c == '\'') {
-          aPS->vtype = PrefType::String;
-          aPS->quotechar = c;
-          aPS->nextstate = PREF_PARSE_UNTIL_CLOSE_PAREN;
+          aPS->mVtype = PrefType::String;
+          aPS->mQuoteChar = c;
+          aPS->mNextState = PREF_PARSE_UNTIL_CLOSE_PAREN;
           state = PREF_PARSE_QUOTED_STRING;
         } else if (c == 't' || c == 'f') {
-          aPS->vb = (char*)(c == 't' ? kTrue : kFalse);
-          aPS->vtype = PrefType::Bool;
-          aPS->smatch = aPS->vb;
-          aPS->sindex = 1;
-          aPS->nextstate = PREF_PARSE_UNTIL_CLOSE_PAREN;
+          aPS->mVb = (char*)(c == 't' ? kTrue : kFalse);
+          aPS->mVtype = PrefType::Bool;
+          aPS->mStrMatch = aPS->mVb;
+          aPS->mStrIndex = 1;
+          aPS->mNextState = PREF_PARSE_UNTIL_CLOSE_PAREN;
           state = PREF_PARSE_MATCH_STRING;
         } else if (isdigit(c) || (c == '-') || (c == '+')) {
-          aPS->vtype = PrefType::Int;
+          aPS->mVtype = PrefType::Int;
           // write c to line buffer...
-          if (aPS->lbcur == aPS->lbend && !pref_GrowBuf(aPS)) {
+          if (aPS->mLbCur == aPS->mLbEnd && !pref_GrowBuf(aPS)) {
             return false; // out of memory
           }
-          *aPS->lbcur++ = c;
+          *aPS->mLbCur++ = c;
           state = PREF_PARSE_INT_VALUE;
-        } else if (c == '/') {    // allow embedded comment
-          aPS->nextstate = state; // return here when done with comment
+        } else if (c == '/') {     // allow embedded comment
+          aPS->mNextState = state; // return here when done with comment
           state = PREF_PARSE_COMMENT_MAYBE_START;
         } else if (!isspace(c)) {
           pref_ReportParseProblem(
             *aPS, "need value, comment or space", lineNum, true);
           NS_WARNING("malformed pref file");
           return false;
         }
         break;
 
       case PREF_PARSE_INT_VALUE:
         // grow line buffer if necessary...
-        if (aPS->lbcur == aPS->lbend && !pref_GrowBuf(aPS)) {
+        if (aPS->mLbCur == aPS->mLbEnd && !pref_GrowBuf(aPS)) {
           return false; // out of memory
         }
         if (isdigit(c)) {
-          *aPS->lbcur++ = c;
+          *aPS->mLbCur++ = c;
         } else {
-          *aPS->lbcur++ = '\0'; // stomp null terminator; we are done.
+          *aPS->mLbCur++ = '\0'; // stomp null terminator; we are done.
           if (c == ')') {
             state = PREF_PARSE_UNTIL_SEMICOLON;
           } else if (c == '/') { // allow embedded comment
-            aPS->nextstate = PREF_PARSE_UNTIL_CLOSE_PAREN;
+            aPS->mNextState = PREF_PARSE_UNTIL_CLOSE_PAREN;
             state = PREF_PARSE_COMMENT_MAYBE_START;
           } else if (isspace(c)) {
             state = PREF_PARSE_UNTIL_CLOSE_PAREN;
           } else {
             pref_ReportParseProblem(
               *aPS, "while parsing integer", lineNum, true);
             NS_WARNING("malformed pref file");
             return false;
@@ -401,18 +402,18 @@ PREF_ParseBuf(PrefParseState* aPS, const
         if (c == '*') {
           state = PREF_PARSE_COMMENT_BLOCK_MAYBE_END;
         }
         break;
 
       case PREF_PARSE_COMMENT_BLOCK_MAYBE_END:
         switch (c) {
           case '/':
-            state = aPS->nextstate;
-            aPS->nextstate = PREF_PARSE_INIT;
+            state = aPS->mNextState;
+            aPS->mNextState = PREF_PARSE_INIT;
             break;
           case '*': // stay in this state
             break;
           default:
             state = PREF_PARSE_COMMENT_BLOCK;
             break;
         }
         break;
@@ -430,152 +431,153 @@ PREF_ParseBuf(PrefParseState* aPS, const
           case 'r':
             c = '\r';
             break;
           case 'n':
             c = '\n';
             break;
           case 'x': // hex escape -- always interpreted as Latin-1
           case 'u': // UTF16 escape
-            aPS->esctmp[0] = c;
-            aPS->esclen = 1;
-            aPS->utf16[0] = aPS->utf16[1] = 0;
-            aPS->sindex =
+            aPS->mEscTmp[0] = c;
+            aPS->mEscLen = 1;
+            aPS->mUtf16[0] = aPS->mUtf16[1] = 0;
+            aPS->mStrIndex =
               (c == 'x') ? HEX_ESC_NUM_DIGITS : UTF16_ESC_NUM_DIGITS;
             state = PREF_PARSE_HEX_ESCAPE;
             continue;
           default:
             pref_ReportParseProblem(
               *aPS, "preserving unexpected JS escape sequence", lineNum, false);
             NS_WARNING("preserving unexpected JS escape sequence");
             // Invalid escape sequence so we do have to write more than one
             // character. Grow line buffer if necessary...
-            if ((aPS->lbcur + 1) == aPS->lbend && !pref_GrowBuf(aPS)) {
+            if ((aPS->mLbCur + 1) == aPS->mLbEnd && !pref_GrowBuf(aPS)) {
               return false; // out of memory
             }
-            *aPS->lbcur++ = '\\'; // preserve the escape sequence
+            *aPS->mLbCur++ = '\\'; // preserve the escape sequence
             break;
         }
-        *aPS->lbcur++ = c;
+        *aPS->mLbCur++ = c;
         state = PREF_PARSE_QUOTED_STRING;
         break;
 
-      // parsing a hex (\xHH) or utf16 escape (\uHHHH)
+      // parsing a hex (\xHH) or mUtf16 escape (\uHHHH)
       case PREF_PARSE_HEX_ESCAPE:
         if (c >= '0' && c <= '9') {
           udigit = (c - '0');
         } else if (c >= 'A' && c <= 'F') {
           udigit = (c - 'A') + 10;
         } else if (c >= 'a' && c <= 'f') {
           udigit = (c - 'a') + 10;
         } else {
           // bad escape sequence found, write out broken escape as-is
           pref_ReportParseProblem(*aPS,
                                   "preserving invalid or incomplete hex escape",
                                   lineNum,
                                   false);
           NS_WARNING("preserving invalid or incomplete hex escape");
-          *aPS->lbcur++ = '\\'; // original escape slash
-          if ((aPS->lbcur + aPS->esclen) >= aPS->lbend && !pref_GrowBuf(aPS)) {
+          *aPS->mLbCur++ = '\\'; // original escape slash
+          if ((aPS->mLbCur + aPS->mEscLen) >= aPS->mLbEnd &&
+              !pref_GrowBuf(aPS)) {
             return false;
           }
-          for (int i = 0; i < aPS->esclen; ++i) {
-            *aPS->lbcur++ = aPS->esctmp[i];
+          for (int i = 0; i < aPS->mEscLen; ++i) {
+            *aPS->mLbCur++ = aPS->mEscTmp[i];
           }
 
           // Push the non-hex character back for re-parsing. (++aBuf at the top
           // of the loop keeps this safe.)
           --aBuf;
           state = PREF_PARSE_QUOTED_STRING;
           continue;
         }
 
         // have a digit
-        aPS->esctmp[aPS->esclen++] = c; // preserve it
-        aPS->utf16[1] <<= BITS_PER_HEX_DIGIT;
-        aPS->utf16[1] |= udigit;
-        aPS->sindex--;
-        if (aPS->sindex == 0) {
+        aPS->mEscTmp[aPS->mEscLen++] = c; // preserve it
+        aPS->mUtf16[1] <<= BITS_PER_HEX_DIGIT;
+        aPS->mUtf16[1] |= udigit;
+        aPS->mStrIndex--;
+        if (aPS->mStrIndex == 0) {
           // we have the full escape, convert to UTF8
           int utf16len = 0;
-          if (aPS->utf16[0]) {
+          if (aPS->mUtf16[0]) {
             // already have a high surrogate, this is a two char seq
             utf16len = 2;
-          } else if (0xD800 == (0xFC00 & aPS->utf16[1])) {
+          } else if (0xD800 == (0xFC00 & aPS->mUtf16[1])) {
             // a high surrogate, can't convert until we have the low
-            aPS->utf16[0] = aPS->utf16[1];
-            aPS->utf16[1] = 0;
+            aPS->mUtf16[0] = aPS->mUtf16[1];
+            aPS->mUtf16[1] = 0;
             state = PREF_PARSE_UTF16_LOW_SURROGATE;
             break;
           } else {
-            // a single utf16 character
-            aPS->utf16[0] = aPS->utf16[1];
+            // a single mUtf16 character
+            aPS->mUtf16[0] = aPS->mUtf16[1];
             utf16len = 1;
           }
 
           // The actual conversion.
           // Make sure there's room, 6 bytes is max utf8 len (in theory; 4
-          // bytes covers the actual utf16 range).
-          if (aPS->lbcur + 6 >= aPS->lbend && !pref_GrowBuf(aPS)) {
+          // bytes covers the actual mUtf16 range).
+          if (aPS->mLbCur + 6 >= aPS->mLbEnd && !pref_GrowBuf(aPS)) {
             return false;
           }
 
-          ConvertUTF16toUTF8 converter(aPS->lbcur);
-          converter.write(aPS->utf16, utf16len);
-          aPS->lbcur += converter.Size();
+          ConvertUTF16toUTF8 converter(aPS->mLbCur);
+          converter.write(aPS->mUtf16, utf16len);
+          aPS->mLbCur += converter.Size();
           state = PREF_PARSE_QUOTED_STRING;
         }
         break;
 
-      // looking for beginning of utf16 low surrogate
+      // looking for beginning of mUtf16 low surrogate
       case PREF_PARSE_UTF16_LOW_SURROGATE:
-        if (aPS->sindex == 0 && c == '\\') {
-          ++aPS->sindex;
-        } else if (aPS->sindex == 1 && c == 'u') {
+        if (aPS->mStrIndex == 0 && c == '\\') {
+          ++aPS->mStrIndex;
+        } else if (aPS->mStrIndex == 1 && c == 'u') {
           // escape sequence is correct, now parse hex
-          aPS->sindex = UTF16_ESC_NUM_DIGITS;
-          aPS->esctmp[0] = 'u';
-          aPS->esclen = 1;
+          aPS->mStrIndex = UTF16_ESC_NUM_DIGITS;
+          aPS->mEscTmp[0] = 'u';
+          aPS->mEscLen = 1;
           state = PREF_PARSE_HEX_ESCAPE;
         } else {
           // Didn't find expected low surrogate. Ignore high surrogate (it
           // would just get converted to nothing anyway) and start over with
           // this character.
           --aBuf;
-          if (aPS->sindex == 1) {
+          if (aPS->mStrIndex == 1) {
             state = PREF_PARSE_ESC_SEQUENCE;
           } else {
             state = PREF_PARSE_QUOTED_STRING;
           }
           continue;
         }
         break;
 
       // function open and close parsing
       case PREF_PARSE_UNTIL_OPEN_PAREN:
         // tolerate only whitespace and embedded comments
         if (c == '(') {
           state = PREF_PARSE_UNTIL_NAME;
         } else if (c == '/') {
-          aPS->nextstate = state; // return here when done with comment
+          aPS->mNextState = state; // return here when done with comment
           state = PREF_PARSE_COMMENT_MAYBE_START;
         } else if (!isspace(c)) {
           pref_ReportParseProblem(
             *aPS, "need space, comment or open parentheses", lineNum, true);
           NS_WARNING("malformed pref file");
           return false;
         }
         break;
 
       case PREF_PARSE_UNTIL_CLOSE_PAREN:
         // tolerate only whitespace and embedded comments
         if (c == ')') {
           state = PREF_PARSE_UNTIL_SEMICOLON;
         } else if (c == '/') {
-          aPS->nextstate = state; // return here when done with comment
+          aPS->mNextState = state; // return here when done with comment
           state = PREF_PARSE_COMMENT_MAYBE_START;
         } else if (!isspace(c)) {
           pref_ReportParseProblem(
             *aPS, "need space, comment or closing parentheses", lineNum, true);
           NS_WARNING("malformed pref file");
           return false;
         }
         break;
@@ -584,60 +586,60 @@ PREF_ParseBuf(PrefParseState* aPS, const
       case PREF_PARSE_UNTIL_SEMICOLON:
         // tolerate only whitespace and embedded comments
         if (c == ';') {
           if (!pref_DoCallback(aPS)) {
             return false;
           }
           state = PREF_PARSE_INIT;
         } else if (c == '/') {
-          aPS->nextstate = state; // return here when done with comment
+          aPS->mNextState = state; // return here when done with comment
           state = PREF_PARSE_COMMENT_MAYBE_START;
         } else if (!isspace(c)) {
           pref_ReportParseProblem(
             *aPS, "need space, comment or semicolon", lineNum, true);
           NS_WARNING("malformed pref file");
           return false;
         }
         break;
 
       // eol parsing
       case PREF_PARSE_UNTIL_EOL:
         // Need to handle mac, unix, or dos line endings. PREF_PARSE_INIT will
         // eat the next \n in case we have \r\n.
         if (c == '\r' || c == '\n' || c == 0x1A) {
-          state = aPS->nextstate;
-          aPS->nextstate = PREF_PARSE_INIT; // reset next state
+          state = aPS->mNextState;
+          aPS->mNextState = PREF_PARSE_INIT; // reset next state
         }
         break;
     }
   }
-  aPS->state = state;
+  aPS->mState = state;
   return true;
 }
 
 #ifdef TEST_PREFREAD
 
 static void
 pref_reader(void* aClosure,
             const char* aPref,
             PrefValue aVal,
             PrefType aType,
             bool aDefPref)
 {
   printf("%spref(\"%s\", ", aDefPref ? "" : "user_", aPref);
   switch (aType) {
     case PREF_STRING:
-      printf("\"%s\");\n", aVal.stringVal);
+      printf("\"%s\");\n", aVal.mStringVal);
       break;
     case PREF_INT:
-      printf("%i);\n", aVal.intVal);
+      printf("%i);\n", aVal.mIntVal);
       break;
     case PREF_BOOL:
-      printf("%s);\n", aVal.boolVal == false ? "false" : "true");
+      printf("%s);\n", aVal.mBoolVal == false ? "false" : "true");
       break;
   }
 }
 
 int
 main(int aArgc, char** aArgv)
 {
   PrefParseState aPS;
--- a/modules/libpref/prefread.h
+++ b/modules/libpref/prefread.h
@@ -1,118 +1,91 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef prefread_h__
 #define prefread_h__
 
 #include "prefapi.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/**
- * Callback function used to notify consumer of preference name value pairs.
- * The pref name and value must be copied by the implementor of the callback
- * if they are needed beyond the scope of the callback function.
- *
- * @param closure
- *        user data passed to PREF_InitParseState
- * @param pref
- *        preference name
- * @param val
- *        preference value
- * @param type
- *        preference type (PREF_STRING, PREF_INT, or PREF_BOOL)
- * @param defPref
- *        preference type (true: default, false: user preference)
- * @param stickyPref
- *        default preference marked as a "sticky" pref
- */
-typedef void (*PrefReader)(void       *closure,
-                           const char *pref,
-                           PrefValue   val,
-                           PrefType    type,
-                           bool        defPref,
-                           bool        stickyPref);
+// Callback function used to notify consumer of preference name value pairs.
+// The pref name and value must be copied by the implementor of the callback
+// if they are needed beyond the scope of the callback function.
+//
+// |aClosure| is user data passed to PREF_InitParseState.
+// |aPref| is the preference name.
+// |aValue| is the preference value.
+// |aType| is the preference type (PREF_STRING, PREF_INT, or PREF_BOOL).
+// |aIsDefault| indicates if it's a default preference.
+// |aIsStickyDefault| indicates if it's a sticky default preference.
+typedef void (*PrefReader)(void* aClosure,
+                           const char* aPref,
+                           PrefValue aValue,
+                           PrefType aType,
+                           bool aIsDefault,
+                           bool aIsStickyDefault);
+
+// Report any errors or warnings we encounter during parsing.
+typedef void (*PrefParseErrorReporter)(const char* aMessage,
+                                       int aLine,
+                                       bool aError);
 
-/**
- * Report any errors or warnings we encounter during parsing.
- */
-typedef void (*PrefParseErrorReporter)(const char* message, int line, bool error);
-
-/* structure fields are private */
-typedef struct PrefParseState {
-    PrefReader  reader;
-    PrefParseErrorReporter reporter;
-    void       *closure;
-    int         state;      /* PREF_PARSE_...                */
-    int         nextstate;  /* sometimes used...             */
-    const char *smatch;     /* string to match               */
-    int         sindex;     /* next char of smatch to check  */
-                            /* also, counter in \u parsing   */
-    char16_t   utf16[2];   /* parsing UTF16  (\u) escape    */
-    int         esclen;     /* length in esctmp              */
-    char        esctmp[6];  /* raw escape to put back if err */
-    char        quotechar;  /* char delimiter for quotations */
-    char       *lb;         /* line buffer (only allocation) */
-    char       *lbcur;      /* line buffer cursor            */
-    char       *lbend;      /* line buffer end               */
-    char       *vb;         /* value buffer (ptr into lb)    */
-    PrefType    vtype;      /* PREF_STRING,INT,BOOL          */
-    bool        fdefault;   /* true if (default) pref        */
-    bool        fstickydefault; /* true if (sticky) pref     */
+typedef struct PrefParseState
+{
+  PrefReader mReader;
+  PrefParseErrorReporter mReporter;
+  void* mClosure;
+  int mState;            // PREF_PARSE_...
+  int mNextState;        // sometimes used...
+  const char* mStrMatch; // string to match
+  int mStrIndex;         // next char of smatch to check;
+                         // also, counter in \u parsing
+  char16_t mUtf16[2];    // parsing UTF16 (\u) escape
+  int mEscLen;           // length in mEscTmp
+  char mEscTmp[6];       // raw escape to put back if err
+  char mQuoteChar;       // char delimiter for quotations
+  char* mLb;             // line buffer (only allocation)
+  char* mLbCur;          // line buffer cursor
+  char* mLbEnd;          // line buffer end
+  char* mVb;             // value buffer (ptr into mLb)
+  PrefType mVtype;       // PREF_{STRING,INT,BOOL}
+  bool mIsDefault;       // true if (default) pref
+  bool mIsStickyDefault; // true if (sticky) pref
 } PrefParseState;
 
-/**
- * PREF_InitParseState
- *
- * Called to initialize a PrefParseState instance.
- *
- * @param ps
- *        PrefParseState instance.
- * @param reader
- *        PrefReader callback function, which will be called once for each
- *        preference name value pair extracted.
- * @param reporter
- *        PrefParseErrorReporter callback function, which will be called if we
- *        encounter any errors (stop) or warnings (continue) during parsing.
- * @param closure
- *        PrefReader closure.
- */
-void PREF_InitParseState(PrefParseState *ps, PrefReader reader,
-			 PrefParseErrorReporter reporter, void *closure);
+// Initialize a PrefParseState instance.
+//
+// |aPS| is the PrefParseState instance.
+// |aReader| is the PrefReader callback function, which will be called once for
+// each preference name value pair extracted.
+// |aReporter| is the PrefParseErrorReporter callback function, which will be
+// called if we encounter any errors (stop) or warnings (continue) during
+// parsing.
+// |aClosure| is extra data passed to |aReader|.
+void
+PREF_InitParseState(PrefParseState* aPS,
+                    PrefReader aReader,
+                    PrefParseErrorReporter aReporter,
+                    void* aClosure);
 
-/**
- * PREF_FinalizeParseState
- *
- * Called to release any memory in use by the PrefParseState instance.
- *
- * @param ps
- *        PrefParseState instance.
- */
-void PREF_FinalizeParseState(PrefParseState *ps);
+// Release any memory in use by the PrefParseState instance.
+void
+PREF_FinalizeParseState(PrefParseState* aPS);
 
-/**
- * PREF_ParseBuf
- *
- * Called to parse a buffer containing some portion of a preference file.  This
- * function may be called repeatedly as new data is made available.  The
- * PrefReader callback function passed PREF_InitParseState will be called as
- * preference name value pairs are extracted from the data.
- *
- * @param ps
- *        PrefParseState instance.  Must have been initialized.
- * @param buf
- *        Raw buffer containing data to be parsed.
- * @param bufLen
- *        Length of buffer.
- *
- * @return false if buffer contains malformed content.
- */
-bool PREF_ParseBuf(PrefParseState *ps, const char *buf, int bufLen);
+// Parse a buffer containing some portion of a preference file.  This function
+// may be called repeatedly as new data is made available. The PrefReader
+// callback function passed PREF_InitParseState will be called as preference
+// name value pairs are extracted from the data. Returns false if buffer
+// contains malformed content.
+bool
+PREF_ParseBuf(PrefParseState* aPS, const char* aBuf, int aBufLen);
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* prefread_h__ */