Bug 888784 - Get rid of FormHistory.shutdown. r?mak draft
authorMike Conley <mconley@mozilla.com>
Thu, 30 Nov 2017 18:11:18 -0500
changeset 723113 c4c39c375f6d65f4d41c6bcd1912a61d7f89922b
parent 723112 236bf898faffb8bc1f0eb940428d7e0fecc1aa27
child 723114 afaef651975c856a7b81f4cea4fb47581fa9a442
push id96341
push usermconley@mozilla.com
push dateMon, 22 Jan 2018 16:46:17 +0000
reviewersmak
bugs888784
milestone60.0a1
Bug 888784 - Get rid of FormHistory.shutdown. r?mak FormHistory.shutdown was called via FormHistoryStartup.js's profile-before-change observer to close the database synchronously. Now FormHistory uses AsyncShutdown and closes the database asynchronously, so FormHistory.shutdown is no longer required. MozReview-Commit-ID: Lok5vx1dOTW
toolkit/components/satchel/FormHistory.jsm
toolkit/components/satchel/FormHistoryStartup.js
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -1505,14 +1505,12 @@ this.FormHistory = {
       handleResult(aBeginningCount) {
         expireOldEntriesDeletion(expireTime, aBeginningCount);
       },
       handleError(aError) {
         log("expireStartCountFailure");
       },
     });
   },
-
-  shutdown() { dbClose(true); },
 };
 
 // Prevent add-ons from redefining this API
 Object.freeze(FormHistory);
--- a/toolkit/components/satchel/FormHistoryStartup.js
+++ b/toolkit/components/satchel/FormHistoryStartup.js
@@ -25,19 +25,16 @@ FormHistoryStartup.prototype = {
     switch (topic) {
       case "nsPref:changed":
         FormHistory.updatePrefs();
         break;
       case "idle-daily":
       case "formhistory-expire-now":
         FormHistory.expireOldEntries();
         break;
-      case "profile-before-change":
-        FormHistory.shutdown();
-        break;
       case "profile-after-change":
         this.init();
         break;
     }
   },
 
   inited: false,
   pendingQuery: null,
@@ -46,17 +43,16 @@ FormHistoryStartup.prototype = {
     if (this.inited) {
       return;
     }
     this.inited = true;
 
     Services.prefs.addObserver("browser.formfill.", this, true);
 
     // triggers needed service cleanup and db shutdown
-    Services.obs.addObserver(this, "profile-before-change", true);
     Services.obs.addObserver(this, "idle-daily", true);
     Services.obs.addObserver(this, "formhistory-expire-now", true);
 
     Services.ppmm.loadProcessScript("chrome://satchel/content/formSubmitListener.js", true);
     Services.ppmm.addMessageListener("FormHistory:FormSubmitEntries", this);
 
     let messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
                          .getService(Ci.nsIMessageListenerManager);