Bug 888784 - Make FormHistory.expireOldEntries use new Sqlite.jsm database backend. r?mak draft
authorMike Conley <mconley@mozilla.com>
Fri, 01 Dec 2017 14:54:02 -0500
changeset 723115 2fd5fec679ceda908e183eb7dac131934e65b38e
parent 723114 afaef651975c856a7b81f4cea4fb47581fa9a442
child 723116 9695f645a9e79b9b885701974e8699975fcd5f17
push id96341
push usermconley@mozilla.com
push dateMon, 22 Jan 2018 16:46:17 +0000
reviewersmak
bugs888784
milestone60.0a1
Bug 888784 - Make FormHistory.expireOldEntries use new Sqlite.jsm database backend. r?mak MozReview-Commit-ID: KSaWz0s6hF1
toolkit/components/satchel/FormHistory.jsm
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -862,23 +862,22 @@ function expireOldEntriesDeletion(aExpir
  * @param {number} aBeginningCount number of entries at first
  */
 function expireOldEntriesVacuum(aExpireTime, aBeginningCount) {
   FormHistory.count({}, {
     handleResult(aEndingCount) {
       if (aBeginningCount - aEndingCount > 500) {
         log("expireOldEntriesVacuum");
 
-        let stmt = dbCreateAsyncStatement("VACUUM");
-        stmt.executeAsync({
-          handleResult: NOOP,
-          handleError(aError) {
+        FormHistory.db.then(async conn => {
+          try {
+            await conn.executeCached("VACUUM");
+          } catch (e) {
             log("expireVacuumError");
-          },
-          handleCompletion: NOOP,
+          }
         });
       }
 
       sendNotification("formhistory-expireoldentries", aExpireTime);
     },
     handleError(aError) {
       log("expireEndCountFailure");
     },