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
--- 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) {