Bug 1271280 - Places shutdown blockers have wrong names and are not properly reporting state. r=adw, a=ritu
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 09 May 2016 15:27:59 +0200
changeset 326252 2d928f3ea42b9835ba503e350213eef684af8980
parent 326251 5f542b19b6192ba1350f5486c001c796121f0950
child 326253 168613131e6a01c065897186ba2e91c3a9de3798
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, ritu
bugs1271280
milestone47.0
Bug 1271280 - Places shutdown blockers have wrong names and are not properly reporting state. r=adw, a=ritu MozReview-Commit-ID: CQlm5ZGgBwK
toolkit/components/places/Shutdown.cpp
--- a/toolkit/components/places/Shutdown.cpp
+++ b/toolkit/components/places/Shutdown.cpp
@@ -29,44 +29,48 @@ NS_IMETHODIMP
 PlacesShutdownBlocker::GetName(nsAString& aName)
 {
   aName = mName;
   return NS_OK;
 }
 
 // nsIAsyncShutdownBlocker
 NS_IMETHODIMP
-PlacesShutdownBlocker::GetState(nsIPropertyBag** aState)
+PlacesShutdownBlocker::GetState(nsIPropertyBag** _state)
 {
-  nsresult rv;
+  NS_ENSURE_ARG_POINTER(_state);
+
   nsCOMPtr<nsIWritablePropertyBag2> bag =
-    do_CreateInstance("@mozilla.org/hash-property-bag;1", &rv);
-  if (NS_WARN_IF(NS_FAILED(rv))) return rv;
+    do_CreateInstance("@mozilla.org/hash-property-bag;1");
+  NS_ENSURE_TRUE(bag, NS_ERROR_OUT_OF_MEMORY);
+  bag.forget(_state);
 
   // Put `mState` in field `progress`
   RefPtr<nsVariant> progress = new nsVariant();
-  rv = progress->SetAsUint8(mState);
+  nsresult rv = progress->SetAsUint8(mState);
   if (NS_WARN_IF(NS_FAILED(rv))) return rv;
-  rv = bag->SetPropertyAsInterface(NS_LITERAL_STRING("progress"), progress);
+  rv = static_cast<nsIWritablePropertyBag2*>(*_state)->SetPropertyAsInterface(
+    NS_LITERAL_STRING("progress"), progress);
   if (NS_WARN_IF(NS_FAILED(rv))) return rv;
 
   // Put `mBarrier`'s state in field `barrier`, if possible
   if (!mBarrier) {
     return NS_OK;
   }
   nsCOMPtr<nsIPropertyBag> barrierState;
   rv = mBarrier->GetState(getter_AddRefs(barrierState));
   if (NS_FAILED(rv)) {
     return NS_OK;
   }
 
   RefPtr<nsVariant> barrier = new nsVariant();
   rv = barrier->SetAsInterface(NS_GET_IID(nsIPropertyBag), barrierState);
   if (NS_WARN_IF(NS_FAILED(rv))) return rv;
-  rv = bag->SetPropertyAsInterface(NS_LITERAL_STRING("Barrier"), barrier);
+  rv = static_cast<nsIWritablePropertyBag2*>(*_state)->SetPropertyAsInterface(
+    NS_LITERAL_STRING("Barrier"), barrier);
   if (NS_WARN_IF(NS_FAILED(rv))) return rv;
 
   return NS_OK;
 }
 
 // nsIAsyncShutdownBlocker
 NS_IMETHODIMP
 PlacesShutdownBlocker::BlockShutdown(nsIAsyncShutdownClient* aParentClient)
@@ -148,17 +152,17 @@ NS_IMPL_ISUPPORTS_INHERITED(
   ClientsShutdownBlocker,
   PlacesShutdownBlocker,
   nsIAsyncShutdownCompletionCallback
 )
 
 ////////////////////////////////////////////////////////////////////////////////
 
 ConnectionShutdownBlocker::ConnectionShutdownBlocker(Database* aDatabase)
-  : PlacesShutdownBlocker(NS_LITERAL_STRING("Places Clients shutdown"))
+  : PlacesShutdownBlocker(NS_LITERAL_STRING("Places Connection shutdown"))
   , mDatabase(aDatabase)
 {
   // Do nothing.
 }
 
 // nsIAsyncShutdownBlocker
 NS_IMETHODIMP
 ConnectionShutdownBlocker::BlockShutdown(nsIAsyncShutdownClient* aParentClient)