Bug 1397818 - Make sure to always return Promises from the Sanitizer. r?grisha draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Thu, 07 Sep 2017 19:27:01 +0200
changeset 663106 23e1f17ee46b81fc2c5fb6be13fa72e9166b26d1
parent 663105 ec40c9e290be844e7ddecd4dd6466f3eee52dbec
child 731094 342cde4f47aee40f0d3e8b78884d6ca7f078c3e4
push id79322
push usermozilla@buttercookie.de
push dateTue, 12 Sep 2017 16:51:53 +0000
reviewersgrisha
bugs1397818
milestone57.0a1
Bug 1397818 - Make sure to always return Promises from the Sanitizer. r?grisha Our shutdown code needs this, so it can wait for sanitising to have actually finished before continuing further. MozReview-Commit-ID: DGNgFrvYIXV
mobile/android/modules/Sanitizer.jsm
--- a/mobile/android/modules/Sanitizer.jsm
+++ b/mobile/android/modules/Sanitizer.jsm
@@ -36,26 +36,24 @@ Sanitizer.prototype = {
   clearItem: function(aItemName, startTime) {
     // Only a subset of items support deletion with startTime.
     // Those who do not will be rejected with error message.
     if (typeof startTime != "undefined") {
       switch (aItemName) {
         // Normal call to DownloadFiles remove actual data from storage, but our web-extension consumer
         // deletes only download history. So, for this reason we are passing a flag 'deleteFiles'.
         case "downloadHistory":
-          this._clear("downloadFiles", { startTime, deleteFiles: false });
-          break;
+          return this._clear("downloadFiles", { startTime, deleteFiles: false });
         case "formdata":
-          this._clear(aItemName, { startTime });
-          break;
+          return this._clear(aItemName, { startTime });
         default:
           return Promise.reject({message: `Invalid argument: ${aItemName} does not support startTime argument.`});
       }
     } else {
-      this._clear(aItemName);
+      return this._clear(aItemName);
     }
   },
 
  _clear: function(aItemName, options) {
     let item = this.items[aItemName];
     let canClear = item.canClear;
     if (typeof canClear == "function") {
       canClear(function clearCallback(aCanClear) {