Bug 1372988 part B - setting prefs after profile shutdown triggers assertions instead of just warnings, r?milan draft
authorBenjamin Smedberg <benjamin@smedbergs.us>
Wed, 21 Jun 2017 15:57:09 -0400
changeset 598558 5c80d212dc1a5913346f41052da49ff766c7aeeb
parent 598557 87a6d39edf0a4b8d93311163b20509eb14cad656
child 634510 85f5c8c17ba5033da138ee327033ca94a81d2672
push id65245
push userbsmedberg@mozilla.com
push dateWed, 21 Jun 2017 20:40:36 +0000
reviewersmilan
bugs1372988
milestone56.0a1
Bug 1372988 part B - setting prefs after profile shutdown triggers assertions instead of just warnings, r?milan MozReview-Commit-ID: 9qA2htqB58b
modules/libpref/Preferences.cpp
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -98,18 +98,18 @@ Preferences::DirtyCallback()
     // TODO: this should really assert because you can't set prefs in a
     // content process. But so much code currently does this that we just
     // ignore it for now.
     return;
   }
   if (gHashTable && sPreferences && !sPreferences->mDirty) {
     sPreferences->mDirty = true;
 
-    NS_WARNING_ASSERTION(!sPreferences->mProfileShutdown,
-                         "Setting user pref after profile shutdown.");
+    MOZ_ASSERT(!sPreferences->mProfileShutdown,
+               "Setting user pref after profile shutdown.");
 
     if (sPreferences->AllowOffMainThreadSave()) {
       static const int MAX_PREF_DELAY_MS = 2000;
       NS_IdleDispatchToCurrentThread(
         mozilla::NewRunnableMethod("Preferences::SavePrefFileAsynchronous",
                                    sPreferences,
                                    &Preferences::SavePrefFileAsynchronous),
         MAX_PREF_DELAY_MS);
@@ -1172,17 +1172,17 @@ Preferences::SavePrefFileInternal(nsIFil
     // we only check this flag when the caller wants to write to the default
     if (!mDirty) {
       return NS_OK;
     }
 
     // check for profile shutdown after mDirty because the runnables from
     // DirtyCallback can still be pending
     if (mProfileShutdown) {
-      NS_WARNING("Cannot save pref file after profile shutdown.");
+      MOZ_ASSERT_UNREACHABLE("Cannot save pref file after profile shutdown.");
       return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
     }
 
     // It's possible that we never got a prefs file.
     nsresult rv = NS_OK;
     if (mCurrentFile) {
       rv = WritePrefFile(mCurrentFile, aSaveMethod);
     }