Bug 1557997 - IDB: Add more IsShuttingDown checks to database maintenance; r=asuth a=jcristau
authorJan Varga <jan.varga@gmail.com>
Sun, 09 Jun 2019 09:20:49 +0200
changeset 536848 1c5156a0ede91bcce7b87450387a3ebbdfa4037b
parent 536847 2014f3735cc2e37f2a84c214c07d69f1889e3634
child 536849 0199db54157108d082011d30ae4a6c9788a38e83
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth, jcristau
bugs1557997
milestone68.0
Bug 1557997 - IDB: Add more IsShuttingDown checks to database maintenance; r=asuth a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D34283
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -16953,17 +16953,18 @@ nsresult Maintenance::DirectoryWork() {
                     size_t(PERSISTENCE_TYPE_INVALID),
                 "Something changed with available persistence types!");
 
   NS_NAMED_LITERAL_STRING(idbDirName, IDB_DIRECTORY_NAME);
   NS_NAMED_LITERAL_STRING(sqliteExtension, ".sqlite");
 
   for (const PersistenceType persistenceType : kPersistenceTypes) {
     // Loop over "<persistence>" directories.
-    if (IsAborted()) {
+    if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
+        IsAborted()) {
       return NS_ERROR_ABORT;
     }
 
     nsAutoCString persistenceTypeString;
     if (persistenceType == PERSISTENCE_TYPE_PERSISTENT) {
       // XXX This shouldn't be a special case...
       persistenceTypeString.AssignLiteral("permanent");
     } else {
@@ -17007,17 +17008,18 @@ nsresult Maintenance::DirectoryWork() {
     }
 
     if (!persistenceDirEntries) {
       continue;
     }
 
     while (true) {
       // Loop over "<origin>/idb" directories.
-      if (IsAborted()) {
+      if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
+          IsAborted()) {
         return NS_ERROR_ABORT;
       }
 
       nsCOMPtr<nsIFile> originDir;
       rv = persistenceDirEntries->GetNextFile(getter_AddRefs(originDir));
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
@@ -17083,17 +17085,18 @@ nsresult Maintenance::DirectoryWork() {
 
       nsCString suffix;
       nsCString group;
       nsCString origin;
       nsTArray<nsString> databasePaths;
 
       while (true) {
         // Loop over files in the "idb" directory.
-        if (IsAborted()) {
+        if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) ||
+            IsAborted()) {
           return NS_ERROR_ABORT;
         }
 
         nsCOMPtr<nsIFile> idbDirFile;
         rv = idbDirEntries->GetNextFile(getter_AddRefs(idbDirFile));
         if (NS_WARN_IF(NS_FAILED(rv))) {
           return rv;
         }
@@ -17927,17 +17930,18 @@ NS_IMPL_QUERY_INTERFACE(DatabaseMaintena
 NS_IMETHODIMP
 DatabaseMaintenance::AutoProgressHandler::OnProgress(
     mozIStorageConnection* aConnection, bool* _retval) {
   NS_ASSERT_OWNINGTHREAD(DatabaseMaintenance::AutoProgressHandler);
   MOZ_ASSERT(aConnection);
   MOZ_ASSERT(mConnection == aConnection);
   MOZ_ASSERT(_retval);
 
-  *_retval = mMaintenance->IsAborted();
+  *_retval = QuotaClient::IsShuttingDownOnNonBackgroundThread() ||
+             mMaintenance->IsAborted();
 
   return NS_OK;
 }
 
 /*******************************************************************************
  * Local class implementations
  ******************************************************************************/