Bug 1548748 - OriginInfo needs to be destroyed too if origin clearing is invoked for a specific quota client and there's no other quota client left; r=ttung
authorJan Varga <jan.varga@gmail.com>
Fri, 03 May 2019 10:29:42 +0200
changeset 531387 f8178fdb90bc7673d7079251a2e640cb701c94ba
parent 531274 9dbf4a541fff28274537c379f29b7bdb58cfd60d
child 531388 7921024c9fa6befe8ad1edf3037cb0a7bfacba7a
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttung
bugs1548748
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 1548748 - OriginInfo needs to be destroyed too if origin clearing is invoked for a specific quota client and there's no other quota client left; r=ttung Differential Revision: https://phabricator.services.mozilla.com/D29801
dom/quota/ActorsParent.cpp
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -8105,23 +8105,24 @@ void ClearRequestBase::DeleteFiles(Quota
 
     bool initialized;
     if (aPersistenceType == PERSISTENCE_TYPE_PERSISTENT) {
       initialized = aQuotaManager->IsOriginInitialized(origin);
     } else {
       initialized = aQuotaManager->IsTemporaryStorageInitialized();
     }
 
+    bool hasOtherClient = false;
+
     UsageInfo usageInfo;
 
     if (!mClientType.IsNull()) {
       // Checking whether there is any other client in the directory is needed.
       // If there is not, removing whole directory is needed.
       nsCOMPtr<nsIDirectoryEnumerator> originEntries;
-      bool hasOtherClient = false;
       if (NS_WARN_IF(NS_FAILED(
               file->GetDirectoryEntries(getter_AddRefs(originEntries)))) ||
           !originEntries) {
         return;
       }
 
       nsCOMPtr<nsIFile> clientFile;
       while (NS_SUCCEEDED((rv = originEntries->GetNextFile(
@@ -8209,21 +8210,23 @@ void ClearRequestBase::DeleteFiles(Quota
 
     // If it hasn't been initialized, we don't need to update the quota and
     // notify the removing client.
     if (!initialized) {
       return;
     }
 
     if (aPersistenceType != PERSISTENCE_TYPE_PERSISTENT) {
-      if (mClientType.IsNull()) {
-        aQuotaManager->RemoveQuotaForOrigin(aPersistenceType, group, origin);
-      } else {
+      if (hasOtherClient) {
+        MOZ_ASSERT(!mClientType.IsNull());
+
         aQuotaManager->DecreaseUsageForOrigin(aPersistenceType, group, origin,
                                               usageInfo.TotalUsage());
+      } else {
+        aQuotaManager->RemoveQuotaForOrigin(aPersistenceType, group, origin);
       }
     }
 
     aQuotaManager->OriginClearCompleted(aPersistenceType, origin, mClientType);
   }
 }
 
 nsresult ClearRequestBase::DoDirectoryWork(QuotaManager* aQuotaManager) {