Bug 1538968 - release assert if something tries to start the history service before profile startup, r=mak
☠☠ backed out by 2e6a1dcc4205 ☠ ☠
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 26 Mar 2019 16:39:22 +0000
changeset 466486 afc9e5ce9971595f7fe6f46ed81f0a89ee65aeea
parent 466485 56e336b27bcb388ab4b0d04cd502224af26aa1d7
child 466487 e490b9372c21ec3daa652a4a01e12d6194834786
push id35768
push useropoprus@mozilla.com
push dateThu, 28 Mar 2019 09:55:54 +0000
treeherdermozilla-central@c045dd97faf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1538968
milestone68.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 1538968 - release assert if something tries to start the history service before profile startup, r=mak Depends on D24909 Differential Revision: https://phabricator.services.mozilla.com/D24910
toolkit/components/places/History.cpp
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -1440,16 +1440,26 @@ void StoreAndNotifyEmbedVisit(VisitData&
 History* History::gService = nullptr;
 
 History::History()
     : mShuttingDown(false),
       mShutdownMutex("History::mShutdownMutex"),
       mObservers(VISIT_OBSERVERS_INITIAL_CACHE_LENGTH),
       mRecentlyVisitedURIs(RECENTLY_VISITED_URIS_SIZE) {
   NS_ASSERTION(!gService, "Ruh-roh!  This service has already been created!");
+  if (XRE_IsParentProcess()) {
+    nsCOMPtr<nsIProperties> dirsvc = services::GetDirectoryService();
+    bool haveProfile = false;
+    MOZ_RELEASE_ASSERT(
+        dirsvc &&
+            NS_SUCCEEDED(
+                dirsvc->Has(NS_APP_USER_PROFILE_50_DIR, &haveProfile)) &&
+            haveProfile,
+        "Can't construct history service if there is no profile.");
+  }
   gService = this;
 
   nsCOMPtr<nsIObserverService> os = services::GetObserverService();
   NS_WARNING_ASSERTION(os, "Observer service was not found!");
   if (os) {
     (void)os->AddObserver(this, TOPIC_PLACES_SHUTDOWN, false);
   }
 }