Bug 1384835 (part 1) - Use nsA[C]String references instead of pointers for outparams of Get*String() pref functions. r=froydnj.
☠☠ backed out by b57e8e2ae846 ☠ ☠
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 25 Jul 2017 19:12:56 +1000
changeset 371599 07b534f447404246cce2c784ef9f0136d467b7a6
parent 371598 277525fcf8886becf6bd82fdefe73d7057a18c05
child 371600 5df4d877860281f66dc14b512de963539dc443b0
push id32250
push usercbook@mozilla.com
push dateFri, 28 Jul 2017 13:24:57 +0000
treeherdermozilla-central@16ffc1d05422 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1384835
milestone56.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 1384835 (part 1) - Use nsA[C]String references instead of pointers for outparams of Get*String() pref functions. r=froydnj. This is basically a cosmetic change; references are the normal way to do string outparams.
dom/base/nsDocument.cpp
dom/base/nsObjectLoadingContent.cpp
dom/canvas/WebGLContextState.cpp
editor/libeditor/CSSEditUtils.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPrefs.cpp
intl/locale/LocaleService.cpp
intl/uconv/nsTextToSubURI.cpp
media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
modules/libpref/Preferences.cpp
modules/libpref/Preferences.h
netwerk/protocol/http/nsHttpHandler.cpp
security/manager/ssl/nsNSSIOLayer.cpp
security/manager/ssl/nsNTLMAuthModule.cpp
toolkit/components/downloads/ApplicationReputation.cpp
toolkit/components/extensions/ExtensionPolicyService.cpp
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
toolkit/xre/nsXREDirProvider.cpp
uriloader/exthandler/unix/nsOSHelperAppService.cpp
widget/GfxInfoBase.cpp
widget/cocoa/nsPrintSettingsX.mm
widget/nsPrintOptionsImpl.cpp
widget/nsXPLookAndFeel.cpp
widget/windows/WinIMEHandler.cpp
xpcom/base/LogModulePrefWatcher.cpp
xpcom/base/nsDumpUtils.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -13284,34 +13284,34 @@ nsDocument::PrincipalFlashClassification
   if (!flashBlock) {
     return FlashClassification::Unknown;
   }
 
   nsAutoCString allowTables, allowExceptionsTables,
                 denyTables, denyExceptionsTables,
                 subDocDenyTables, subDocDenyExceptionsTables,
                 tables;
-  Preferences::GetCString("urlclassifier.flashAllowTable", &allowTables);
+  Preferences::GetCString("urlclassifier.flashAllowTable", allowTables);
   MaybeAddTableToTableList(allowTables, tables);
   Preferences::GetCString("urlclassifier.flashAllowExceptTable",
-                          &allowExceptionsTables);
+                          allowExceptionsTables);
   MaybeAddTableToTableList(allowExceptionsTables, tables);
-  Preferences::GetCString("urlclassifier.flashTable", &denyTables);
+  Preferences::GetCString("urlclassifier.flashTable", denyTables);
   MaybeAddTableToTableList(denyTables, tables);
   Preferences::GetCString("urlclassifier.flashExceptTable",
-                          &denyExceptionsTables);
+                          denyExceptionsTables);
   MaybeAddTableToTableList(denyExceptionsTables, tables);
 
   bool isThirdPartyDoc = IsThirdParty();
   if (isThirdPartyDoc) {
     Preferences::GetCString("urlclassifier.flashSubDocTable",
-                            &subDocDenyTables);
+                            subDocDenyTables);
     MaybeAddTableToTableList(subDocDenyTables, tables);
     Preferences::GetCString("urlclassifier.flashSubDocExceptTable",
-                            &subDocDenyExceptionsTables);
+                            subDocDenyExceptionsTables);
     MaybeAddTableToTableList(subDocDenyExceptionsTables, tables);
   }
 
   if (tables.IsEmpty()) {
     return FlashClassification::Unknown;
   }
 
   nsCOMPtr<nsIURIClassifier> uriClassifier =
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -3535,18 +3535,18 @@ nsObjectLoadingContent::ShouldPlay(Fallb
 }
 
 bool
 nsObjectLoadingContent::FavorFallbackMode(bool aIsPluginClickToPlay) {
   if (!IsFlashMIME(mContentType)) {
     return false;
   }
 
-  nsCString prefString;
-  if (NS_SUCCEEDED(Preferences::GetCString(kPrefFavorFallbackMode, &prefString))) {
+  nsAutoCString prefString;
+  if (NS_SUCCEEDED(Preferences::GetCString(kPrefFavorFallbackMode, prefString))) {
     if (aIsPluginClickToPlay &&
         prefString.EqualsLiteral("follow-ctp")) {
       return true;
     }
 
     if (prefString.EqualsLiteral("always")) {
       return true;
     }
@@ -3562,18 +3562,18 @@ nsObjectLoadingContent::HasGoodFallback(
   NS_ASSERTION(thisContent, "must be a content");
 
   if (!thisContent->IsHTMLElement(nsGkAtoms::object) ||
       mContentType.IsEmpty()) {
     return false;
   }
 
   nsTArray<nsCString> rulesList;
-  nsCString prefString;
-  if (NS_SUCCEEDED(Preferences::GetCString(kPrefFavorFallbackRules, &prefString))) {
+  nsAutoCString prefString;
+  if (NS_SUCCEEDED(Preferences::GetCString(kPrefFavorFallbackRules, prefString))) {
       ParseString(prefString, ',', rulesList);
   }
 
   for (uint32_t i = 0; i < rulesList.Length(); ++i) {
     // RULE "embed":
     // Don't use fallback content if the object contains an <embed> inside its
     // fallback content.
     if (rulesList[i].EqualsLiteral("embed")) {
--- a/dom/canvas/WebGLContextState.cpp
+++ b/dom/canvas/WebGLContextState.cpp
@@ -302,17 +302,17 @@ WebGLContext::GetParameter(JSContext* cx
                 default:
                     MOZ_CRASH("GFX: bad `pname`");
                 }
 
                 bool hasRetVal = false;
 
                 nsAutoString ret;
                 if (overridePref) {
-                    nsresult res = Preferences::GetString(overridePref, &ret);
+                    nsresult res = Preferences::GetString(overridePref, ret);
                     if (NS_SUCCEEDED(res) && ret.Length() > 0)
                         hasRetVal = true;
                 }
 
                 if (!hasRetVal) {
                     const char* chars = reinterpret_cast<const char*>(gl->fGetString(driverEnum));
                     ret = NS_ConvertASCIItoUTF16(chars);
                     hasRetVal = true;
--- a/editor/libeditor/CSSEditUtils.cpp
+++ b/editor/libeditor/CSSEditUtils.cpp
@@ -608,44 +608,44 @@ CSSEditUtils::IsCSSInvertible(nsIAtom& a
   return nsGkAtoms::b == &aProperty;
 }
 
 // Get the default browser background color if we need it for GetCSSBackgroundColorState
 void
 CSSEditUtils::GetDefaultBackgroundColor(nsAString& aColor)
 {
   if (Preferences::GetBool("editor.use_custom_colors", false)) {
-    nsresult rv = Preferences::GetString("editor.background_color", &aColor);
+    nsresult rv = Preferences::GetString("editor.background_color", aColor);
     // XXX Why don't you validate the pref value?
     if (NS_FAILED(rv)) {
       NS_WARNING("failed to get editor.background_color");
       aColor.AssignLiteral("#ffffff");  // Default to white
     }
     return;
   }
 
   if (Preferences::GetBool("browser.display.use_system_colors", false)) {
     return;
   }
 
   nsresult rv =
-    Preferences::GetString("browser.display.background_color", &aColor);
+    Preferences::GetString("browser.display.background_color", aColor);
   // XXX Why don't you validate the pref value?
   if (NS_FAILED(rv)) {
     NS_WARNING("failed to get browser.display.background_color");
     aColor.AssignLiteral("#ffffff");  // Default to white
   }
 }
 
 // Get the default length unit used for CSS Indent/Outdent
 void
 CSSEditUtils::GetDefaultLengthUnit(nsAString& aLengthUnit)
 {
   nsresult rv =
-    Preferences::GetString("editor.css.default_length_unit", &aLengthUnit);
+    Preferences::GetString("editor.css.default_length_unit", aLengthUnit);
   // XXX Why don't you validate the pref value?
   if (NS_FAILED(rv)) {
     aLengthUnit.AssignLiteral("px");
   }
 }
 
 // Unfortunately, CSSStyleDeclaration::GetPropertyCSSValue is not yet
 // implemented... We need then a way to determine the number part and the unit
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1820,18 +1820,18 @@ gfxPlatform::GetContentBackendPref(uint3
 {
     return GetBackendPref("gfx.content.azure.backends", aBackendBitmask);
 }
 
 /* static */ BackendType
 gfxPlatform::GetBackendPref(const char* aBackendPrefName, uint32_t &aBackendBitmask)
 {
     nsTArray<nsCString> backendList;
-    nsCString prefString;
-    if (NS_SUCCEEDED(Preferences::GetCString(aBackendPrefName, &prefString))) {
+    nsAutoCString prefString;
+    if (NS_SUCCEEDED(Preferences::GetCString(aBackendPrefName, prefString))) {
         ParseString(prefString, ',', backendList);
     }
 
     uint32_t allowedBackends = 0;
     BackendType result = BackendType::NONE;
     for (uint32_t i = 0; i < backendList.Length(); ++i) {
         BackendType type = BackendTypeForName(backendList[i]);
         if (BackendTypeBit(type) & aBackendBitmask) {
--- a/gfx/thebes/gfxPrefs.cpp
+++ b/gfx/thebes/gfxPrefs.cpp
@@ -193,17 +193,17 @@ float gfxPrefs::PrefGet(const char* aPre
   return Preferences::GetFloat(aPref, aDefault);
 }
 
 std::string gfxPrefs::PrefGet(const char* aPref, std::string aDefault)
 {
   MOZ_ASSERT(IsPrefsServiceAvailable());
 
   nsAdoptingCString result;
-  Preferences::GetCString(aPref, &result);
+  Preferences::GetCString(aPref, result);
 
   if (result.IsEmpty()) {
     return aDefault;
   }
 
   return result.get();
 }
 
--- a/intl/locale/LocaleService.cpp
+++ b/intl/locale/LocaleService.cpp
@@ -90,17 +90,17 @@ ReadRequestedLocales(nsTArray<nsCString>
     // If he has, we'll pick the locale from the system
     if (OSPreferences::GetInstance()->GetSystemLocales(aRetVal)) {
       // If we succeeded, return.
       return true;
     }
   }
 
   // Otherwise, we'll try to get the requested locale from the prefs.
-  if (!NS_SUCCEEDED(Preferences::GetCString(SELECTED_LOCALE_PREF, &locale))) {
+  if (!NS_SUCCEEDED(Preferences::GetCString(SELECTED_LOCALE_PREF, locale))) {
     return false;
   }
 
   // At the moment we just take a single locale, but in the future
   // we'll want to allow user to specify a list of requested locales.
   aRetVal.AppendElement(locale);
   return true;
 }
@@ -507,22 +507,22 @@ LocaleService::IsAppLocaleRTL()
   }
   return uloc_isRightToLeft(locale.get());
 #else
   // first check the intl.uidirection.<locale> preference, and if that is not
   // set, check the same preference but with just the first two characters of
   // the locale. If that isn't set, default to left-to-right.
   nsAutoCString prefString = NS_LITERAL_CSTRING("intl.uidirection.") + locale;
   nsAutoCString dir;
-  Preferences::GetCString(prefString.get(), &dir);
+  Preferences::GetCString(prefString.get(), dir);
   if (dir.IsEmpty()) {
     int32_t hyphen = prefString.FindChar('-');
     if (hyphen >= 1) {
       prefString.Truncate(hyphen);
-      Preferences::GetCString(prefString.get(), &dir);
+      Preferences::GetCString(prefString.get(), dir);
     }
   }
   return dir.EqualsLiteral("rtl");
 #endif
 }
 
 NS_IMETHODIMP
 LocaleService::Observe(nsISupports *aSubject, const char *aTopic,
--- a/intl/uconv/nsTextToSubURI.cpp
+++ b/intl/uconv/nsTextToSubURI.cpp
@@ -149,17 +149,17 @@ NS_IMETHODIMP  nsTextToSubURI::UnEscapeU
     // assume UTF-8 instead of ASCII  because hostname (IDN) may be in UTF-8
     CopyUTF8toUTF16(aURIFragment, _retval);
   }
 
   // If there are any characters that are unsafe for URIs, reescape those.
   if (mUnsafeChars.IsEmpty()) {
     nsAdoptingString blacklist;
     nsresult rv = mozilla::Preferences::GetString("network.IDN.blacklist_chars",
-                                                  &blacklist);
+                                                  blacklist);
     if (NS_SUCCEEDED(rv)) {
       // we allow SPACE and IDEOGRAPHIC SPACE in this method
       blacklist.StripChars(u" \u3000");
       mUnsafeChars.AppendElements(static_cast<const char16_t*>(blacklist.Data()),
                                   blacklist.Length());
     } else {
       NS_WARNING("Failed to get the 'network.IDN.blacklist_chars' preference");
     }
--- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
+++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
@@ -54,17 +54,19 @@ private:
   }
 };
 
 // For WEBRTC_TRACE()
 static WebRtcTraceCallback gWebRtcCallback;
 // For LOG()
 static mozilla::StaticAutoPtr<LogSinkImpl> sSink;
 
-void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, nsACString *aAECLogDir, bool *aMultiLog)
+void
+GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString& aLogFile,
+                  nsACString& aAECLogDir, bool *aMultiLog)
 {
   *aMultiLog = mozilla::Preferences::GetBool("media.webrtc.debug.multi_log");
   *aTraceMask = mozilla::Preferences::GetUint("media.webrtc.debug.trace_mask");
   mozilla::Preferences::GetCString("media.webrtc.debug.log_file", aLogFile);
   mozilla::Preferences::GetCString("media.webrtc.debug.aec_log_dir", aAECLogDir);
   webrtc::Trace::set_aec_debug_size(mozilla::Preferences::GetUint("media.webrtc.debug.aec_dump_max_size"));
 }
 
@@ -212,17 +214,17 @@ void StartWebRtcLog(uint32_t log_level)
     return;
   }
 
   uint32_t trace_mask = 0;
   bool multi_log = false;
   nsAutoCString log_file;
   nsAutoCString aec_log_dir;
 
-  GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
+  GetWebRtcLogPrefs(&trace_mask, log_file, aec_log_dir, &multi_log);
   mozilla::LogLevel level = CheckOverrides(&trace_mask, &log_file, &multi_log);
 
   if (trace_mask == 0) {
     trace_mask = log_level;
   }
 
   ConfigWebRtcLog(level, trace_mask, log_file, aec_log_dir, multi_log);
 
@@ -234,17 +236,17 @@ void EnableWebRtcLog()
     return;
   }
 
   uint32_t trace_mask = 0;
   bool multi_log = false;
   nsAutoCString log_file;
   nsAutoCString aec_log_dir;
 
-  GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
+  GetWebRtcLogPrefs(&trace_mask, log_file, aec_log_dir, &multi_log);
   mozilla::LogLevel level = CheckOverrides(&trace_mask, &log_file, &multi_log);
   ConfigWebRtcLog(level, trace_mask, log_file, aec_log_dir, multi_log);
 }
 
 // Called when we destroy the singletons from PeerConnectionCtx or if the
 // user changes logging in about:webrtc
 void StopWebRtcLog()
 {
@@ -290,17 +292,17 @@ void StartAecLog()
   if (webrtc::Trace::aec_debug()) {
     return;
   }
   uint32_t trace_mask = 0;
   bool multi_log = false;
   nsAutoCString log_file;
   nsAutoCString aec_log_dir;
 
-  GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
+  GetWebRtcLogPrefs(&trace_mask, log_file, aec_log_dir, &multi_log);
   CheckOverrides(&trace_mask, &log_file, &multi_log);
   ConfigAecLog(aec_log_dir);
 
   webrtc::Trace::set_aec_debug(true);
 }
 
 void StopAecLog()
 {
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -1674,92 +1674,88 @@ Preferences::GetCString(const char* aPre
   return result;
 }
 
 // static
 nsAdoptingString
 Preferences::GetString(const char* aPref)
 {
   nsAdoptingString result;
-  GetString(aPref, &result);
+  GetString(aPref, result);
   return result;
 }
 
 // static
 nsresult
-Preferences::GetCString(const char* aPref, nsACString* aResult)
+Preferences::GetCString(const char* aPref, nsACString& aResult)
 {
-  NS_PRECONDITION(aResult, "aResult must not be NULL");
   NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
   nsAutoCString result;
   nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), false);
   if (NS_SUCCEEDED(rv)) {
-    *aResult = result;
+    aResult = result;
   }
   return rv;
 }
 
 // static
 nsresult
-Preferences::GetString(const char* aPref, nsAString* aResult)
+Preferences::GetString(const char* aPref, nsAString& aResult)
 {
-  NS_PRECONDITION(aResult, "aResult must not be NULL");
   NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
   nsAutoCString result;
   nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), false);
   if (NS_SUCCEEDED(rv)) {
-    CopyUTF8toUTF16(result, *aResult);
+    CopyUTF8toUTF16(result, aResult);
   }
   return rv;
 }
 
 // static
 nsAdoptingCString
 Preferences::GetLocalizedCString(const char* aPref)
 {
   nsAdoptingCString result;
-  GetLocalizedCString(aPref, &result);
+  GetLocalizedCString(aPref, result);
   return result;
 }
 
 // static
 nsAdoptingString
 Preferences::GetLocalizedString(const char* aPref)
 {
   nsAdoptingString result;
-  GetLocalizedString(aPref, &result);
+  GetLocalizedString(aPref, result);
   return result;
 }
 
 // static
 nsresult
-Preferences::GetLocalizedCString(const char* aPref, nsACString* aResult)
+Preferences::GetLocalizedCString(const char* aPref, nsACString& aResult)
 {
-  NS_PRECONDITION(aResult, "aResult must not be NULL");
   nsAutoString result;
-  nsresult rv = GetLocalizedString(aPref, &result);
+  nsresult rv = GetLocalizedString(aPref, result);
   if (NS_SUCCEEDED(rv)) {
-    CopyUTF16toUTF8(result, *aResult);
+    CopyUTF16toUTF8(result, aResult);
   }
   return rv;
 }
 
 // static
 nsresult
-Preferences::GetLocalizedString(const char* aPref, nsAString* aResult)
+Preferences::GetLocalizedString(const char* aPref, nsAString& aResult)
 {
-  NS_PRECONDITION(aResult, "aResult must not be NULL");
   NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
   nsCOMPtr<nsIPrefLocalizedString> prefLocalString;
   nsresult rv = sRootBranch->GetComplexValue(aPref,
                                              NS_GET_IID(nsIPrefLocalizedString),
                                              getter_AddRefs(prefLocalString));
   if (NS_SUCCEEDED(rv)) {
     NS_ASSERTION(prefLocalString, "Succeeded but the result is NULL");
-    prefLocalString->GetData(getter_Copies(*aResult));
+    prefLocalString->GetData(getter_Copies(aResult));
   }
   return rv;
 }
 
 // static
 nsresult
 Preferences::GetComplex(const char* aPref, const nsIID &aType, void** aResult)
 {
@@ -2193,79 +2189,77 @@ Preferences::GetDefaultInt(const char* a
 {
   NS_PRECONDITION(aResult, "aResult must not be NULL");
   NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
   return PREF_GetIntPref(aPref, aResult, true);
 }
 
 // static
 nsresult
-Preferences::GetDefaultCString(const char* aPref, nsACString* aResult)
+Preferences::GetDefaultCString(const char* aPref, nsACString& aResult)
 {
-  NS_PRECONDITION(aResult, "aResult must not be NULL");
   NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
   nsAutoCString result;
   nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), true);
   if (NS_SUCCEEDED(rv)) {
-    *aResult = result;
+    aResult = result;
   }
   return rv;
 }
 
 // static
 nsresult
-Preferences::GetDefaultString(const char* aPref, nsAString* aResult)
+Preferences::GetDefaultString(const char* aPref, nsAString& aResult)
 {
-  NS_PRECONDITION(aResult, "aResult must not be NULL");
   NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
   nsAutoCString result;
   nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), true);
   if (NS_SUCCEEDED(rv)) {
-    CopyUTF8toUTF16(result, *aResult);
+    CopyUTF8toUTF16(result, aResult);
   }
   return rv;
 }
 
 // static
 nsresult
 Preferences::GetDefaultLocalizedCString(const char* aPref,
-                                        nsACString* aResult)
+                                        nsACString& aResult)
 {
   nsAutoString result;
-  nsresult rv = GetDefaultLocalizedString(aPref, &result);
+  nsresult rv = GetDefaultLocalizedString(aPref, result);
   if (NS_SUCCEEDED(rv)) {
-    CopyUTF16toUTF8(result, *aResult);
+    CopyUTF16toUTF8(result, aResult);
   }
   return rv;
 }
 
 // static
 nsresult
 Preferences::GetDefaultLocalizedString(const char* aPref,
-                                       nsAString* aResult)
+                                       nsAString& aResult)
 {
   NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
   nsCOMPtr<nsIPrefLocalizedString> prefLocalString;
   nsresult rv =
     sDefaultRootBranch->GetComplexValue(aPref,
                                         NS_GET_IID(nsIPrefLocalizedString),
                                         getter_AddRefs(prefLocalString));
   if (NS_SUCCEEDED(rv)) {
     NS_ASSERTION(prefLocalString, "Succeeded but the result is NULL");
-    prefLocalString->GetData(getter_Copies(*aResult));
+    prefLocalString->GetData(getter_Copies(aResult));
   }
   return rv;
 }
 
 // static
 nsAdoptingString
 Preferences::GetDefaultString(const char* aPref)
 {
   nsAdoptingString result;
-  GetDefaultString(aPref, &result);
+  GetDefaultString(aPref, result);
   return result;
 }
 
 // static
 nsAdoptingCString
 Preferences::GetDefaultCString(const char* aPref)
 {
   nsAdoptingCString result;
@@ -2273,26 +2267,26 @@ Preferences::GetDefaultCString(const cha
   return result;
 }
 
 // static
 nsAdoptingString
 Preferences::GetDefaultLocalizedString(const char* aPref)
 {
   nsAdoptingString result;
-  GetDefaultLocalizedString(aPref, &result);
+  GetDefaultLocalizedString(aPref, result);
   return result;
 }
 
 // static
 nsAdoptingCString
 Preferences::GetDefaultLocalizedCString(const char* aPref)
 {
   nsAdoptingCString result;
-  GetDefaultLocalizedCString(aPref, &result);
+  GetDefaultLocalizedCString(aPref, result);
   return result;
 }
 
 // static
 nsresult
 Preferences::GetDefaultComplex(const char* aPref, const nsIID &aType,
                                void** aResult)
 {
--- a/modules/libpref/Preferences.h
+++ b/modules/libpref/Preferences.h
@@ -194,23 +194,22 @@ public:
     }
     return rv;
   }
 
   /**
    * Gets string 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.
+   * @param aResult     The value 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 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,
                              void** aResult);
 
   /**
    * Sets various type pref values.
    */
   static nsresult SetBool(const char* aPref, bool aValue);
@@ -388,22 +387,22 @@ public:
    * See the comment at definition at GetString() and GetCString() for more
    * details of the result.
    */
   static nsAdoptingString GetDefaultString(const char* aPref);
   static nsAdoptingCString GetDefaultCString(const char* aPref);
   static nsAdoptingString GetDefaultLocalizedString(const char* aPref);
   static nsAdoptingCString GetDefaultLocalizedCString(const char* aPref);
 
-  static nsresult GetDefaultCString(const char* aPref, nsACString* aResult);
-  static nsresult GetDefaultString(const char* aPref, nsAString* aResult);
+  static nsresult GetDefaultCString(const char* aPref, nsACString& aResult);
+  static nsresult GetDefaultString(const char* aPref, nsAString& aResult);
   static nsresult GetDefaultLocalizedCString(const char* aPref,
-                                             nsACString* aResult);
+                                             nsACString& aResult);
   static nsresult GetDefaultLocalizedString(const char* aPref,
-                                            nsAString* aResult);
+                                            nsAString& aResult);
 
   static nsresult GetDefaultComplex(const char* aPref, const nsIID &aType,
                                     void** aResult);
 
   /**
    * Gets the type of the pref.
    */
   static int32_t GetDefaultType(const char* aPref);
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -147,17 +147,17 @@ GetDeviceModelId() {
     nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
     MOZ_ASSERT(infoService, "Could not find a system info service");
     nsAutoString androidDevice;
     nsresult rv = infoService->GetPropertyAsAString(NS_LITERAL_STRING("device"), androidDevice);
     if (NS_SUCCEEDED(rv)) {
         deviceModelId = NS_LossyConvertUTF16toASCII(androidDevice);
     }
     nsAutoCString deviceString;
-    rv = Preferences::GetCString(UA_PREF("device_string"), &deviceString);
+    rv = Preferences::GetCString(UA_PREF("device_string"), deviceString);
     if (NS_SUCCEEDED(rv)) {
         deviceString.Trim(" ", true, true);
         deviceString.ReplaceSubstring(NS_LITERAL_CSTRING("%DEVICEID%"), deviceModelId);
         return deviceString;
     }
     return deviceModelId;
 }
 #endif
@@ -982,18 +982,18 @@ nsHttpHandler::InitUserAgentComponents()
         mDeviceModelId = mozilla::net::GetDeviceModelId();
     }
 #endif // ANDROID
 
 #ifdef MOZ_MULET
     {
         // Add the `Mobile` or `Tablet` or `TV` token when running in the b2g
         // desktop simulator via preference.
-        nsCString deviceType;
-        nsresult rv = Preferences::GetCString("devtools.useragent.device_type", &deviceType);
+        nsAutoCString deviceType;
+        nsresult rv = Preferences::GetCString("devtools.useragent.device_type", deviceType);
         if (NS_SUCCEEDED(rv)) {
             mCompatDevice.Assign(deviceType);
         } else {
             mCompatDevice.AssignLiteral("Mobile");
         }
     }
 #endif // MOZ_MULET
 
--- a/security/manager/ssl/nsNSSIOLayer.cpp
+++ b/security/manager/ssl/nsNSSIOLayer.cpp
@@ -1709,19 +1709,19 @@ nsSSLIOLayerHelpers::setInsecureFallback
     }
   }
 }
 
 void
 nsSSLIOLayerHelpers::initInsecureFallbackSites()
 {
   MOZ_ASSERT(NS_IsMainThread());
-  nsCString insecureFallbackHosts;
+  nsAutoCString insecureFallbackHosts;
   Preferences::GetCString("security.tls.insecure_fallback_hosts",
-                          &insecureFallbackHosts);
+                          insecureFallbackHosts);
   setInsecureFallbackSites(insecureFallbackHosts);
 }
 
 bool
 nsSSLIOLayerHelpers::isPublic() const
 {
   return this == &PublicSSLState()->IOLayerHelpers();
 }
@@ -1737,18 +1737,18 @@ public:
 private:
   nsCString mHost;
 };
 
 NS_IMETHODIMP
 FallbackPrefRemover::Run()
 {
   MOZ_ASSERT(NS_IsMainThread());
-  nsCString oldValue;
-  Preferences::GetCString("security.tls.insecure_fallback_hosts", &oldValue);
+  nsAutoCString oldValue;
+  Preferences::GetCString("security.tls.insecure_fallback_hosts", oldValue);
   nsCCharSeparatedTokenizer toker(oldValue, ',');
   nsCString newValue;
   while (toker.hasMoreTokens()) {
     const nsACString& host = toker.nextToken();
     if (host.Equals(mHost)) {
       continue;
     }
     if (!newValue.IsEmpty()) {
@@ -1939,17 +1939,18 @@ enum class UserCertChoice {
 };
 
 // Returns the most appropriate user cert choice based on the value of the
 // security.default_personal_cert preference.
 UserCertChoice
 nsGetUserCertChoice()
 {
   nsAutoCString value;
-  nsresult rv = Preferences::GetCString("security.default_personal_cert", &value);
+  nsresult rv =
+    Preferences::GetCString("security.default_personal_cert", value);
   if (NS_FAILED(rv)) {
     return UserCertChoice::Ask;
   }
 
   // There are three cases for what the preference could be set to:
   //   1. "Select Automatically" -> Auto.
   //   2. "Ask Every Time" -> Ask.
   //   3. Something else -> Ask. This might be a nickname from a migrated cert,
--- a/security/manager/ssl/nsNTLMAuthModule.cpp
+++ b/security/manager/ssl/nsNTLMAuthModule.cpp
@@ -617,17 +617,17 @@ GenerateType3Msg(const nsString &domain,
     userLen = oemUserBuf.Length();
   }
 
   //
   // get workstation name
   // (do not use local machine's hostname after bug 1046421)
   //
   rv = mozilla::Preferences::GetCString("network.generic-ntlm-auth.workstation",
-                                        &hostBuf);
+                                        hostBuf);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   if (unicode)
   {
     ucsHostBuf = NS_ConvertUTF8toUTF16(hostBuf);
     hostPtr = ucsHostBuf.get();
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -330,48 +330,48 @@ PendingDBLookup::LookupSpecInternal(cons
   // blacklisted.
   LOG(("Checking DB service for principal %s [this = %p]", mSpec.get(), this));
   nsCOMPtr<nsIUrlClassifierDBService> dbService =
     do_GetService(NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString tables;
   nsAutoCString allowlist;
-  Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, &allowlist);
+  Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, allowlist);
   if (!allowlist.IsEmpty()) {
     tables.Append(allowlist);
   }
   nsAutoCString blocklist;
-  Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, &blocklist);
+  Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, blocklist);
   if (!mAllowlistOnly && !blocklist.IsEmpty()) {
     tables.Append(',');
     tables.Append(blocklist);
   }
   return dbService->Lookup(principal, tables, this);
 }
 
 NS_IMETHODIMP
 PendingDBLookup::HandleEvent(const nsACString& tables)
 {
   // HandleEvent is guaranteed to call either:
   // 1) PendingLookup::OnComplete if the URL matches the blocklist, or
   // 2) PendingLookup::LookupNext if the URL does not match the blocklist.
   // Blocklisting trumps allowlisting.
   nsAutoCString blockList;
-  Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, &blockList);
+  Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, blockList);
   if (!mAllowlistOnly && FindInReadable(blockList, tables)) {
     mPendingLookup->mBlocklistCount++;
     Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, BLOCK_LIST);
     LOG(("Found principal %s on blocklist [this = %p]", mSpec.get(), this));
     return mPendingLookup->OnComplete(true, NS_OK,
       nsIApplicationReputationService::VERDICT_DANGEROUS);
   }
 
   nsAutoCString allowList;
-  Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, &allowList);
+  Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, allowList);
   if (FindInReadable(allowList, tables)) {
     mPendingLookup->mAllowlistCount++;
     Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, ALLOW_LIST);
     LOG(("Found principal %s on allowlist [this = %p]", mSpec.get(), this));
     // Don't call onComplete, since blocklisting trumps allowlisting
   } else {
     LOG(("Didn't find principal %s on any list [this = %p]", mSpec.get(),
          this));
@@ -1250,40 +1250,40 @@ nsresult
 PendingLookup::SendRemoteQueryInternal()
 {
   // If we aren't supposed to do remote lookups, bail.
   if (!Preferences::GetBool(PREF_SB_DOWNLOADS_REMOTE_ENABLED, false)) {
     LOG(("Remote lookups are disabled [this = %p]", this));
     return NS_ERROR_NOT_AVAILABLE;
   }
   // If the remote lookup URL is empty or absent, bail.
-  nsCString serviceUrl;
-  NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_SB_APP_REP_URL, &serviceUrl),
+  nsAutoCString serviceUrl;
+  NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_SB_APP_REP_URL, serviceUrl),
                     NS_ERROR_NOT_AVAILABLE);
   if (serviceUrl.IsEmpty()) {
     LOG(("Remote lookup URL is empty [this = %p]", this));
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   // If the blocklist or allowlist is empty (so we couldn't do local lookups),
   // bail
   {
     nsAutoCString table;
     NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE,
-                                              &table),
+                                              table),
                       NS_ERROR_NOT_AVAILABLE);
     if (table.IsEmpty()) {
       LOG(("Blocklist is empty [this = %p]", this));
       return NS_ERROR_NOT_AVAILABLE;
     }
   }
   {
     nsAutoCString table;
     NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE,
-                                              &table),
+                                              table),
                       NS_ERROR_NOT_AVAILABLE);
     if (table.IsEmpty()) {
       LOG(("Allowlist is empty [this = %p]", this));
       return NS_ERROR_NOT_AVAILABLE;
     }
   }
 
   LOG(("Sending remote query for application reputation [this = %p]",
--- a/toolkit/components/extensions/ExtensionPolicyService.cpp
+++ b/toolkit/components/extensions/ExtensionPolicyService.cpp
@@ -143,28 +143,28 @@ ExtensionPolicyService::UnregisterExtens
 }
 
 
 void
 ExtensionPolicyService::BaseCSP(nsAString& aBaseCSP) const
 {
   nsresult rv;
 
-  rv = Preferences::GetString("extensions.webextensions.base-content-security-policy", &aBaseCSP);
+  rv = Preferences::GetString("extensions.webextensions.base-content-security-policy", aBaseCSP);
   if (NS_FAILED(rv)) {
     aBaseCSP.AssignLiteral(DEFAULT_BASE_CSP);
   }
 }
 
 void
 ExtensionPolicyService::DefaultCSP(nsAString& aDefaultCSP) const
 {
   nsresult rv;
 
-  rv = Preferences::GetString("extensions.webextensions.default-content-security-policy", &aDefaultCSP);
+  rv = Preferences::GetString("extensions.webextensions.default-content-security-policy", aDefaultCSP);
   if (NS_FAILED(rv)) {
     aDefaultCSP.AssignLiteral(DEFAULT_DEFAULT_CSP);
   }
 }
 
 
 /*****************************************************************************
  * Content script management
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -1527,56 +1527,56 @@ nsUrlClassifierDBService::ReadTablesFrom
 {
   mCheckMalware = Preferences::GetBool(CHECK_MALWARE_PREF,
     CHECK_MALWARE_DEFAULT);
   mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF,
     CHECK_PHISHING_DEFAULT);
   mCheckBlockedURIs = Preferences::GetBool(CHECK_BLOCKED_PREF,
     CHECK_BLOCKED_DEFAULT);
 
-  nsCString allTables;
-  nsCString tables;
+  nsAutoCString allTables;
+  nsAutoCString tables;
 
   mBaseTables.Truncate();
   mTrackingProtectionTables.Truncate();
 
-  Preferences::GetCString(PHISH_TABLE_PREF, &allTables);
+  Preferences::GetCString(PHISH_TABLE_PREF, allTables);
   if (mCheckPhishing) {
     AppendTables(allTables, mBaseTables);
   }
 
-  Preferences::GetCString(MALWARE_TABLE_PREF, &tables);
+  Preferences::GetCString(MALWARE_TABLE_PREF, tables);
   AppendTables(tables, allTables);
   if (mCheckMalware) {
     AppendTables(tables, mBaseTables);
   }
 
-  Preferences::GetCString(BLOCKED_TABLE_PREF, &tables);
+  Preferences::GetCString(BLOCKED_TABLE_PREF, tables);
   AppendTables(tables, allTables);
   if (mCheckBlockedURIs) {
     AppendTables(tables, mBaseTables);
   }
 
-  Preferences::GetCString(DOWNLOAD_BLOCK_TABLE_PREF, &tables);
+  Preferences::GetCString(DOWNLOAD_BLOCK_TABLE_PREF, tables);
   AppendTables(tables, allTables);
 
-  Preferences::GetCString(DOWNLOAD_ALLOW_TABLE_PREF, &tables);
+  Preferences::GetCString(DOWNLOAD_ALLOW_TABLE_PREF, tables);
   AppendTables(tables, allTables);
 
-  Preferences::GetCString(TRACKING_TABLE_PREF, &tables);
+  Preferences::GetCString(TRACKING_TABLE_PREF, tables);
   AppendTables(tables, allTables);
   AppendTables(tables, mTrackingProtectionTables);
 
-  Preferences::GetCString(TRACKING_WHITELIST_TABLE_PREF, &tables);
+  Preferences::GetCString(TRACKING_WHITELIST_TABLE_PREF, tables);
   AppendTables(tables, allTables);
   AppendTables(tables, mTrackingProtectionTables);
 
   Classifier::SplitTables(allTables, mGethashTables);
 
-  Preferences::GetCString(DISALLOW_COMPLETION_TABLE_PREF, &tables);
+  Preferences::GetCString(DISALLOW_COMPLETION_TABLE_PREF, tables);
   Classifier::SplitTables(tables, mDisallowCompletionsTables);
 
   return NS_OK;
 }
 
 nsresult
 nsUrlClassifierDBService::Init()
 {
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -746,17 +746,17 @@ GetContentProcessSandboxTempDir()
   nsresult rv = NS_GetSpecialDirectory(GetContentProcessTempBaseDirKey(),
                                        getter_AddRefs(localFile));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return nullptr;
   }
 
   nsAutoString tempDirSuffix;
   rv = Preferences::GetString("security.sandbox.content.tempDirSuffix",
-                              &tempDirSuffix);
+                              tempDirSuffix);
   if (NS_WARN_IF(NS_FAILED(rv)) || tempDirSuffix.IsEmpty()) {
     return nullptr;
   }
 
   rv = localFile->Append(NS_LITERAL_STRING("Temp-") + tempDirSuffix);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return nullptr;
   }
--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
@@ -182,17 +182,17 @@ nsOSHelperAppService::GetFileLocation(co
   */
   NS_ENSURE_TRUE(Preferences::GetRootBranch(), NS_ERROR_FAILURE);
 
   /*
     If we have an env var we should check whether the pref is a user
     pref.  If we do not, we don't care.
   */
   if (Preferences::HasUserValue(aPrefName) &&
-      NS_SUCCEEDED(Preferences::GetString(aPrefName, &aFileLocation))) {
+      NS_SUCCEEDED(Preferences::GetString(aPrefName, aFileLocation))) {
     return NS_OK;
   }
 
   if (aEnvVarName && *aEnvVarName) {
     char* prefValue = PR_GetEnv(aEnvVarName);
     if (prefValue && *prefValue) {
       // the pref is in the system charset and it's a filepath... The
       // natural way to do the charset conversion is by just initing
@@ -207,17 +207,17 @@ nsOSHelperAppService::GetFileLocation(co
 
       rv = file->GetPath(aFileLocation);
       NS_ENSURE_SUCCESS(rv, rv);
 
       return NS_OK;
     }
   }
 
-  return Preferences::GetString(aPrefName, &aFileLocation);
+  return Preferences::GetString(aPrefName, aFileLocation);
 }
 
 
 /* Get the mime.types file names from prefs and look up info in them
    based on extension */
 // static
 nsresult
 nsOSHelperAppService::LookUpTypeAndDescription(const nsAString& aFileExtension,
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -240,17 +240,17 @@ RemovePrefForFeature(int32_t aFeature)
 
   Preferences::ClearUser(prefname);
 }
 
 static bool
 GetPrefValueForDriverVersion(nsCString& aVersion)
 {
   return NS_SUCCEEDED(Preferences::GetCString(SUGGESTED_VERSION_PREF,
-                                              &aVersion));
+                                              aVersion));
 }
 
 static void
 SetPrefValueForDriverVersion(const nsAString& aVersion)
 {
   Preferences::SetString(SUGGESTED_VERSION_PREF, aVersion);
 }
 
--- a/widget/cocoa/nsPrintSettingsX.mm
+++ b/widget/cocoa/nsPrintSettingsX.mm
@@ -122,17 +122,17 @@ nsPrintSettingsX::SetCocoaPrintInfo(NSPr
 }
 
 NS_IMETHODIMP nsPrintSettingsX::ReadPageFormatFromPrefs()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   nsAutoCString encodedData;
   nsresult rv =
-    Preferences::GetCString(MAC_OS_X_PAGE_SETUP_PREFNAME, &encodedData);
+    Preferences::GetCString(MAC_OS_X_PAGE_SETUP_PREFNAME, encodedData);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // decode the base64
   char* decodedData = PL_Base64Decode(encodedData.get(), encodedData.Length(), nullptr);
   NSData* data = [NSData dataWithBytes:decodedData length:strlen(decodedData)];
   if (!data)
--- a/widget/nsPrintOptionsImpl.cpp
+++ b/widget/nsPrintOptionsImpl.cpp
@@ -487,17 +487,17 @@ nsPrintOptions::ReadPrefs(nsIPrintSettin
   // Paper size prefs are read as a group
   if (aFlags & nsIPrintSettings::kInitSavePaperSize) {
     int32_t sizeUnit;
     double width, height;
 
     bool success = GETINTPREF(kPrintPaperSizeUnit, &sizeUnit)
                   && GETDBLPREF(kPrintPaperWidth, width)
                   && GETDBLPREF(kPrintPaperHeight, height)
-                  && GETSTRPREF(kPrintPaperName, &str);
+                  && GETSTRPREF(kPrintPaperName, str);
 
     // Bug 315687: Sanity check paper size to avoid paper size values in
     // mm when the size unit flag is inches. The value 100 is arbitrary
     // and can be changed.
 #if defined(XP_WIN)
     bool saveSanitizedSizePrefs = false;
 #endif
     if (success) {
@@ -554,52 +554,52 @@ nsPrintOptions::ReadPrefs(nsIPrintSettin
   if (aFlags & nsIPrintSettings::kInitSaveOddEvenPages) {
     if (GETBOOLPREF(kPrintOddPages, &b)) {
       aPS->SetPrintOptions(nsIPrintSettings::kPrintOddPages, b);
       DUMP_BOOL(kReadStr, kPrintOddPages, b);
     }
   }
 
   if (aFlags & nsIPrintSettings::kInitSaveHeaderLeft) {
-    if (GETSTRPREF(kPrintHeaderStrLeft, &str)) {
+    if (GETSTRPREF(kPrintHeaderStrLeft, str)) {
       aPS->SetHeaderStrLeft(str.get());
       DUMP_STR(kReadStr, kPrintHeaderStrLeft, str.get());
     }
   }
 
   if (aFlags & nsIPrintSettings::kInitSaveHeaderCenter) {
-    if (GETSTRPREF(kPrintHeaderStrCenter, &str)) {
+    if (GETSTRPREF(kPrintHeaderStrCenter, str)) {
       aPS->SetHeaderStrCenter(str.get());
       DUMP_STR(kReadStr, kPrintHeaderStrCenter, str.get());
     }
   }
 
   if (aFlags & nsIPrintSettings::kInitSaveHeaderRight) {
-    if (GETSTRPREF(kPrintHeaderStrRight, &str)) {
+    if (GETSTRPREF(kPrintHeaderStrRight, str)) {
       aPS->SetHeaderStrRight(str.get());
       DUMP_STR(kReadStr, kPrintHeaderStrRight, str.get());
     }
   }
 
   if (aFlags & nsIPrintSettings::kInitSaveFooterLeft) {
-    if (GETSTRPREF(kPrintFooterStrLeft, &str)) {
+    if (GETSTRPREF(kPrintFooterStrLeft, str)) {
       aPS->SetFooterStrLeft(str.get());
       DUMP_STR(kReadStr, kPrintFooterStrLeft, str.get());
     }
   }
 
   if (aFlags & nsIPrintSettings::kInitSaveFooterCenter) {
-    if (GETSTRPREF(kPrintFooterStrCenter, &str)) {
+    if (GETSTRPREF(kPrintFooterStrCenter, str)) {
       aPS->SetFooterStrCenter(str.get());
       DUMP_STR(kReadStr, kPrintFooterStrCenter, str.get());
     }
   }
 
   if (aFlags & nsIPrintSettings::kInitSaveFooterRight) {
-    if (GETSTRPREF(kPrintFooterStrRight, &str)) {
+    if (GETSTRPREF(kPrintFooterStrRight, str)) {
       aPS->SetFooterStrRight(str.get());
       DUMP_STR(kReadStr, kPrintFooterStrRight, str.get());
     }
   }
 
   if (aFlags & nsIPrintSettings::kInitSaveBGColors) {
     if (GETBOOLPREF(kPrintBGColors, &b)) {
       aPS->SetPrintBGColors(b);
@@ -645,17 +645,17 @@ nsPrintOptions::ReadPrefs(nsIPrintSettin
   if (aFlags & nsIPrintSettings::kInitSavePrintToFile) {
     if (GETBOOLPREF(kPrintToFile, &b)) {
       aPS->SetPrintToFile(b);
       DUMP_BOOL(kReadStr, kPrintToFile, b);
     }
   }
 
   if (aFlags & nsIPrintSettings::kInitSaveToFileName) {
-    if (GETSTRPREF(kPrintToFileName, &str)) {
+    if (GETSTRPREF(kPrintToFileName, str)) {
       aPS->SetToFileName(str.get());
       DUMP_STR(kReadStr, kPrintToFileName, str.get());
     }
   }
 
   if (aFlags & nsIPrintSettings::kInitSavePageDelay) {
     if (GETINTPREF(kPrintPageDelay, &iVal)) {
       aPS->SetPrintPageDelay(iVal);
@@ -1019,17 +1019,17 @@ nsPrintOptions::GetDefaultPrinterName(ch
 {
   nsresult rv;
   nsCOMPtr<nsIPrinterEnumerator> prtEnum =
            do_GetService(NS_PRINTER_ENUMERATOR_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Look up the printer from the last print job
   nsAutoString lastPrinterName;
-  Preferences::GetString(kPrinterName, &lastPrinterName);
+  Preferences::GetString(kPrinterName, lastPrinterName);
   if (!lastPrinterName.IsEmpty()) {
     // Verify it's still a valid printer
     nsCOMPtr<nsIStringEnumerator> printers;
     rv = prtEnum->GetPrinterNameList(getter_AddRefs(printers));
     if (NS_SUCCEEDED(rv)) {
       bool isValid = false;
       bool hasMore;
       while (NS_SUCCEEDED(printers->HasMore(&hasMore)) && hasMore) {
@@ -1209,17 +1209,17 @@ nsPrintOptions::SavePrintSettingsToPrefs
 //-- Protected Methods --------------------------------
 //-----------------------------------------------------
 nsresult
 nsPrintOptions::ReadPrefDouble(const char * aPrefId, double& aVal)
 {
   NS_ENSURE_ARG_POINTER(aPrefId);
 
   nsAutoCString str;
-  nsresult rv = Preferences::GetCString(aPrefId, &str);
+  nsresult rv = Preferences::GetCString(aPrefId, str);
   if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
     aVal = atof(str.get());
   }
   return rv;
 }
 
 nsresult
 nsPrintOptions::WritePrefDouble(const char * aPrefId, double aVal)
@@ -1232,19 +1232,19 @@ nsPrintOptions::WritePrefDouble(const ch
   return Preferences::SetCString(aPrefId, str);
 }
 
 void
 nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId, int32_t& aTwips,
                                       const char * aMarginPref)
 {
   nsAutoString str;
-  nsresult rv = Preferences::GetString(aPrefId, &str);
+  nsresult rv = Preferences::GetString(aPrefId, str);
   if (NS_FAILED(rv) || str.IsEmpty()) {
-    rv = Preferences::GetString(aMarginPref, &str);
+    rv = Preferences::GetString(aMarginPref, str);
   }
   if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
     nsresult errCode;
     float inches = str.ToFloat(&errCode);
     if (NS_SUCCEEDED(errCode)) {
       aTwips = NS_INCHES_TO_INT_TWIPS(inches);
     } else {
       aTwips = 0;
@@ -1286,17 +1286,17 @@ nsPrintOptions::WriteInchesIntFromTwipsP
 }
 
 void
 nsPrintOptions::ReadJustification(const char * aPrefId, int16_t& aJust,
                                   int16_t aInitValue)
 {
   aJust = aInitValue;
   nsAutoString justStr;
-  if (NS_SUCCEEDED(Preferences::GetString(aPrefId, &justStr))) {
+  if (NS_SUCCEEDED(Preferences::GetString(aPrefId, justStr))) {
     if (justStr.EqualsASCII(kJustRight)) {
       aJust = nsIPrintSettings::kJustRight;
     } else if (justStr.EqualsASCII(kJustCenter)) {
       aJust = nsIPrintSettings::kJustCenter;
     } else {
       aJust = nsIPrintSettings::kJustLeft;
     }
   }
--- a/widget/nsXPLookAndFeel.cpp
+++ b/widget/nsXPLookAndFeel.cpp
@@ -329,17 +329,17 @@ nsXPLookAndFeel::FloatPrefChanged(nsLook
 #endif
 }
 
 // static
 void
 nsXPLookAndFeel::ColorPrefChanged (unsigned int index, const char *prefName)
 {
   nsAutoString colorStr;
-  nsresult rv = Preferences::GetString(prefName, &colorStr);
+  nsresult rv = Preferences::GetString(prefName, colorStr);
   if (NS_FAILED(rv)) {
     return;
   }
   if (!colorStr.IsEmpty()) {
     nscolor thecolor;
     if (colorStr[0] == char16_t('#')) {
       if (NS_HexToRGBA(nsDependentString(colorStr, 1),
                        nsHexColorType::NoAlpha, &thecolor)) {
@@ -383,17 +383,17 @@ nsXPLookAndFeel::InitFromPref(nsLookAndF
     aPref->floatVar = (float)intpref / 100.0f;
   }
 }
 
 void
 nsXPLookAndFeel::InitColorFromPref(int32_t i)
 {
   nsAutoString colorStr;
-  nsresult rv = Preferences::GetString(sColorPrefs[i], &colorStr);
+  nsresult rv = Preferences::GetString(sColorPrefs[i], colorStr);
   if (NS_FAILED(rv) || colorStr.IsEmpty()) {
     return;
   }
   nscolor thecolor;
   if (colorStr[0] == char16_t('#')) {
     nsAutoString hexString;
     colorStr.Right(hexString, colorStr.Length() - 1);
     if (NS_HexToRGBA(hexString, nsHexColorType::NoAlpha, &thecolor)) {
--- a/widget/windows/WinIMEHandler.cpp
+++ b/widget/windows/WinIMEHandler.cpp
@@ -933,17 +933,17 @@ IMEHandler::AutoInvokeOnScreenKeyboardIn
 }
 
 // Based on DisplayVirtualKeyboard() in Chromium's base/win/win_util.cc.
 // static
 void
 IMEHandler::ShowOnScreenKeyboard()
 {
   nsAutoString cachedPath;
-  nsresult result = Preferences::GetString(kOskPathPrefName, &cachedPath);
+  nsresult result = Preferences::GetString(kOskPathPrefName, cachedPath);
   if (NS_FAILED(result) || cachedPath.IsEmpty()) {
     wchar_t path[MAX_PATH];
     // The path to TabTip.exe is defined at the following registry key.
     // This is pulled out of the 64-bit registry hive directly.
     const wchar_t kRegKeyName[] =
       L"Software\\Classes\\CLSID\\"
       L"{054AAE20-4BEA-4347-8A35-64A533254A9D}\\LocalServer32";
     if (!WinUtils::GetRegistryKey(HKEY_LOCAL_MACHINE,
--- a/xpcom/base/LogModulePrefWatcher.cpp
+++ b/xpcom/base/LogModulePrefWatcher.cpp
@@ -59,17 +59,17 @@ LoadPrefValue(const char* aName)
   nsresult rv;
   int32_t prefLevel = 0;
   nsAutoCString prefValue;
 
   if (strncmp(aName, kLoggingConfigPrefPrefix, kLoggingConfigPrefixLen) == 0) {
     nsAutoCString prefName(aName);
 
     if (prefName.EqualsLiteral(kLoggingPrefLogFile)) {
-      rv = Preferences::GetCString(aName, &prefValue);
+      rv = Preferences::GetCString(aName, prefValue);
       // The pref was reset. Clear the user file.
       if (NS_FAILED(rv) || prefValue.IsEmpty()) {
         LogModule::SetLogFile(nullptr);
         return;
       }
 
       // If the pref value doesn't have a PID placeholder, append it to the end.
       if (!strstr(prefValue.get(), "%PID")) {
@@ -84,17 +84,17 @@ LoadPrefValue(const char* aName)
       bool sync = Preferences::GetBool(aName, false);
       LogModule::SetIsSync(sync);
     }
     return;
   }
 
   if (Preferences::GetInt(aName, &prefLevel) == NS_OK) {
     logLevel = ToLogLevel(prefLevel);
-  } else if (Preferences::GetCString(aName, &prefValue) == NS_OK) {
+  } else if (Preferences::GetCString(aName, prefValue) == NS_OK) {
     if (prefValue.LowerCaseEqualsLiteral("error")) {
       logLevel = LogLevel::Error;
     } else if (prefValue.LowerCaseEqualsLiteral("warning")) {
       logLevel = LogLevel::Warning;
     } else if (prefValue.LowerCaseEqualsLiteral("info")) {
       logLevel = LogLevel::Info;
     } else if (prefValue.LowerCaseEqualsLiteral("debug")) {
       logLevel = LogLevel::Debug;
--- a/xpcom/base/nsDumpUtils.cpp
+++ b/xpcom/base/nsDumpUtils.cpp
@@ -242,18 +242,17 @@ SignalPipeWatcher::OnFileCanReadWithoutB
 
 StaticRefPtr<FifoWatcher> FifoWatcher::sSingleton;
 
 /* static */ FifoWatcher*
 FifoWatcher::GetSingleton()
 {
   if (!sSingleton) {
     nsAutoCString dirPath;
-    Preferences::GetCString(
-      "memory_info_dumper.watch_fifo.directory", &dirPath);
+    Preferences::GetCString("memory_info_dumper.watch_fifo.directory", dirPath);
     sSingleton = new FifoWatcher(dirPath);
     sSingleton->Init();
     ClearOnShutdown(&sSingleton);
   }
   return sSingleton;
 }
 
 /* static */ bool