Bug 1422365 - Introduce nsIClearDataService - part 14 - logins, r=johannh
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 01 Jun 2018 14:30:01 +0200
changeset 420883 ebdf4bc31e581e48bb2fa009694c9fa410efcbd5
parent 420882 9be5e7c20ed3f42b4b324d06e9e43b6303955b74
child 420884 144e01c7cfc470c80d422c0dd1202b725021583c
push id34083
push userapavel@mozilla.com
push dateSat, 02 Jun 2018 23:03:25 +0000
treeherdermozilla-central@1f62ecdf59b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1422365
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1422365 - Introduce nsIClearDataService - part 14 - logins, r=johannh
browser/modules/Sanitizer.jsm
toolkit/components/cleardata/ClearDataService.js
toolkit/components/cleardata/nsIClearDataService.idl
--- a/browser/modules/Sanitizer.jsm
+++ b/browser/modules/Sanitizer.jsm
@@ -416,24 +416,19 @@ var Sanitizer = {
         TelemetryStopwatch.finish("FX_SANITIZE_DOWNLOADS", refObj);
       }
     },
 
     sessions: {
       async clear(range) {
         let refObj = {};
         TelemetryStopwatch.start("FX_SANITIZE_SESSIONS", refObj);
-        await clearData(range, Ci.nsIClearDataService.CLEAR_AUTH_TOKENS);
-
-        try {
-          // clear FTP and plain HTTP auth sessions
-          Services.obs.notifyObservers(null, "net:clear-active-logins");
-        } finally {
-          TelemetryStopwatch.finish("FX_SANITIZE_SESSIONS", refObj);
-        }
+        await clearData(range, Ci.nsIClearDataService.CLEAR_AUTH_TOKENS |
+                               Ci.nsIClearDataService.CLEAR_AUTH_CACHE);
+        TelemetryStopwatch.finish("FX_SANITIZE_SESSIONS", refObj);
       }
     },
 
     siteSettings: {
       async clear(range) {
         let seenException;
         let refObj = {};
         TelemetryStopwatch.start("FX_SANITIZE_SITESETTINGS", refObj);
--- a/toolkit/components/cleardata/ClearDataService.js
+++ b/toolkit/components/cleardata/ClearDataService.js
@@ -469,16 +469,25 @@ const AuthTokensCleaner = {
       let sdr = Cc["@mozilla.org/security/sdr;1"]
                   .getService(Ci.nsISecretDecoderRing);
       sdr.logoutAndTeardown();
       aResolve();
     });
   },
 };
 
+const AuthCacheCleaner = {
+  deleteAll() {
+    return new Promise(aResolve => {
+      Services.obs.notifyObservers(null, "net:clear-active-logins");
+      aResolve();
+    });
+  },
+};
+
 // Here the map of Flags-Cleaner.
 const FLAGS_MAP = [
  { flag: Ci.nsIClearDataService.CLEAR_COOKIES,
    cleaner: CookieCleaner },
 
  { flag: Ci.nsIClearDataService.CLEAR_NETWORK_CACHE,
    cleaner: NetworkCacheCleaner },
 
@@ -512,16 +521,19 @@ const FLAGS_MAP = [
  { flag: Ci.nsIClearDataService.CLEAR_HISTORY,
    cleaner: HistoryCleaner, },
 
  { flag: Ci.nsIClearDataService.CLEAR_SESSION_HISTORY,
    cleaner: SessionHistoryCleaner, },
 
  { flag: Ci.nsIClearDataService.CLEAR_AUTH_TOKENS,
    cleaner: AuthTokensCleaner, },
+
+ { flag: Ci.nsIClearDataService.CLEAR_AUTH_CACHE,
+   cleaner: AuthCacheCleaner, },
 ];
 
 this.ClearDataService = function() {};
 
 ClearDataService.prototype = Object.freeze({
   classID: Components.ID("{0c06583d-7dd8-4293-b1a5-912205f779aa}"),
   QueryInterface: ChromeUtils.generateQI([Ci.nsIClearDataService]),
   _xpcom_factory: XPCOMUtils.generateSingletonFactory(ClearDataService),
--- a/toolkit/components/cleardata/nsIClearDataService.idl
+++ b/toolkit/components/cleardata/nsIClearDataService.idl
@@ -148,24 +148,28 @@ interface nsIClearDataService : nsISuppo
    */
   const uint32_t CLEAR_SESSION_HISTORY = 1 << 12;
 
   /**
    * Auth tokens
    */
   const uint32_t CLEAR_AUTH_TOKENS = 1 << 13;
 
+  /**
+   * Login cache
+   */
+  const uint32_t CLEAR_AUTH_CACHE = 1 << 14;
+
   /* TODO
   const uint32_t CLEAR_EME = 1 << 4;
   const uint32_t CLEAR_PERMISSIONS = 1 << 7;
   const uint32_t CLEAR_CONTENT_PREFERENCES = 1 << 9;
   const uint32_t CLEAR_HSTS = 1 << 12;
   const uint32_t CLEAR_HPKP = 1 << 13;
   const uint32_t CLEAR_FORMDATA = 1 << 16;
-  const uint32_t CLEAR_LOGINS = 1 << 18;
   */
 
   /**
    * Use this value to delete all the data.
    */
   const uint32_t CLEAR_ALL = 0xFFFF;
 
   /**************************************************************************