Bug 1517089 - Part 2: Move pref initialization to InitializeLocalStorage; r=asuth
authorJan Varga <jan.varga@gmail.com>
Thu, 07 Feb 2019 19:51:07 +0100
changeset 457569 09ac1f780e566b62a91e62df10ff0c37622b0b22
parent 457568 9b51d5398126be69bf30d2d08bd4c9a47dc33478
child 457570 534dc9cee9aeb4e48c4039f26a45e310f3aed40a
push id111758
push userjvarga@mozilla.com
push dateThu, 07 Feb 2019 18:52:19 +0000
treeherdermozilla-inbound@08d6d7646f18 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1517089
milestone67.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 1517089 - Part 2: Move pref initialization to InitializeLocalStorage; r=asuth
dom/localstorage/ActorsParent.cpp
--- a/dom/localstorage/ActorsParent.cpp
+++ b/dom/localstorage/ActorsParent.cpp
@@ -2952,16 +2952,27 @@ void SnapshotPrefillPrefChangedCallback(
  * Exported functions
  ******************************************************************************/
 
 void InitializeLocalStorage() {
   MOZ_ASSERT(XRE_IsParentProcess());
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!gLocalStorageInitialized);
 
+  if (NS_FAILED(Preferences::AddAtomicUintVarCache(
+          &gOriginLimitKB, kDefaultQuotaPref, kDefaultOriginLimitKB))) {
+    NS_WARNING("Unable to respond to default quota pref changes!");
+  }
+
+  Preferences::RegisterCallbackAndCall(ShadowWritesPrefChangedCallback,
+                                       kShadowWritesPref);
+
+  Preferences::RegisterCallbackAndCall(SnapshotPrefillPrefChangedCallback,
+                                       kSnapshotPrefillPref);
+
 #ifdef DEBUG
   gLocalStorageInitialized = true;
 #endif
 }
 
 PBackgroundLSDatabaseParent* AllocPBackgroundLSDatabaseParent(
     const PrincipalInfo& aPrincipalInfo, const uint32_t& aPrivateBrowsingId,
     const uint64_t& aDatastoreId) {
@@ -7166,27 +7177,16 @@ nsresult QuotaClient::RegisterObservers(
     nsCOMPtr<nsIObserver> observer = new Observer(aBackgroundEventTarget);
 
     nsresult rv =
         obs->AddObserver(observer, kPrivateBrowsingObserverTopic, false);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    if (NS_FAILED(Preferences::AddAtomicUintVarCache(
-            &gOriginLimitKB, kDefaultQuotaPref, kDefaultOriginLimitKB))) {
-      NS_WARNING("Unable to respond to default quota pref changes!");
-    }
-
-    Preferences::RegisterCallbackAndCall(ShadowWritesPrefChangedCallback,
-                                         kShadowWritesPref);
-
-    Preferences::RegisterCallbackAndCall(SnapshotPrefillPrefChangedCallback,
-                                         kSnapshotPrefillPref);
-
     sObserversRegistered = true;
   }
 
   return NS_OK;
 }
 
 nsresult QuotaClient::InitOrigin(PersistenceType aPersistenceType,
                                  const nsACString& aGroup,