Bug 1342067 - Annotate the name of the preference accessed too early in the pre-END_INIT_PREFS phase preference access crash message; r=blassey
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 23 Feb 2017 10:04:45 -0500
changeset 344623 ef1063db138cfbb3e6bb1f01d1e5e27947e53e94
parent 344622 ac8a51344b667d745cf041818d4ebdb009879d87
child 344624 9fe977a59fa1656a0a03b8ea1ad6c873520ef1d2
push id31414
push usercbook@mozilla.com
push dateFri, 24 Feb 2017 10:47:41 +0000
treeherdermozilla-central@be661bae6cb9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs1342067
milestone54.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 1342067 - Annotate the name of the preference accessed too early in the pre-END_INIT_PREFS phase preference access crash message; r=blassey
modules/libpref/prefapi.cpp
--- a/modules/libpref/prefapi.cpp
+++ b/modules/libpref/prefapi.cpp
@@ -778,18 +778,23 @@ PrefHashEntry* pref_HashTableLookup(cons
     MOZ_ASSERT(NS_IsMainThread());
 #endif
     MOZ_ASSERT((!XRE_IsContentProcess() || gPhase != START),
                "pref access before commandline prefs set");
     /* If you're hitting this assertion, you've added a pref access to start up.
      * Consider moving it later or add it to the whitelist in ContentPrefs.cpp
      * and get review from a DOM peer
      */
-    MOZ_ASSERT((!XRE_IsContentProcess() || gPhase > END_INIT_PREFS || gWatchingPref || inInitArray(key)),
-               "accessing non-init pref before the rest of the prefs are sent");
+#ifdef DEBUG
+    if (XRE_IsContentProcess() && gPhase <= END_INIT_PREFS &&
+        !gWatchingPref && !inInitArray(key)) {
+      MOZ_CRASH_UNSAFE_PRINTF("accessing non-init pref %s before the rest of the prefs are sent",
+                              key);
+    }
+#endif
     return static_cast<PrefHashEntry*>(gHashTable->Search(key));
 }
 
 nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, uint32_t flags)
 {
 #ifndef MOZ_B2G
     MOZ_ASSERT(NS_IsMainThread());
 #endif