Bug 1047098 - Test to clear quota manger when clearing all history draft
authorFischer.json <fischer.json@gmail.com>
Wed, 20 Sep 2017 12:42:49 +0800
changeset 667479 50f231c88e13c665480478aecbd356b1c455bcc5
parent 667303 a0eb21bf55e1c1ae0ba311e6f2273da05c712799
child 732395 0857a5d6269ada3ddf6f5b88629d7903b18c2435
push id80722
push userbmo:fliu@mozilla.com
push dateWed, 20 Sep 2017 04:43:17 +0000
bugs1047098
milestone57.0a1
Bug 1047098 - Test to clear quota manger when clearing all history MozReview-Commit-ID: Jz5XSneIOAk
browser/base/content/sanitize.js
--- a/browser/base/content/sanitize.js
+++ b/browser/base/content/sanitize.js
@@ -12,16 +12,17 @@ XPCOMUtils.defineLazyModuleGetters(this,
   AppConstants: "resource://gre/modules/AppConstants.jsm",
   PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
   FormHistory: "resource://gre/modules/FormHistory.jsm",
   Downloads: "resource://gre/modules/Downloads.jsm",
   DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
   TelemetryStopwatch: "resource://gre/modules/TelemetryStopwatch.jsm",
   console: "resource://gre/modules/Console.jsm",
   setTimeout: "resource://gre/modules/Timer.jsm",
+  SiteDataManager: "resource:///modules/SiteDataManager.jsm",
 });
 
 var {classes: Cc, interfaces: Ci} = Components;
 
 /**
  * A number of iterations after which to yield time back
  * to the system.
  */
@@ -143,16 +144,21 @@ Sanitizer.prototype = {
       seenError = true;
       console.error("Error sanitizing " + name, ex);
     };
 
     // Array of objects in form { name, promise }.
     // `name` is the item's name and `promise` may be a promise, if the
     // sanitization is asynchronous, or the function return value, otherwise.
     let handles = [];
+    // TEST for bug 1047098:
+    // If no tange, that means clear all data, including Quota Manger's data, like indexedDB.
+    if (!range) {
+      await SiteDataManager.removeAll();
+    }
     for (let name of itemsToClear) {
       let item = this.items[name];
       try {
         // Catch errors here, so later we can just loop through these.
         handles.push({ name,
                        promise: item.clear(range)
                                     .then(() => progress[name] = "cleared",
                                           ex => annotateError(name, ex))