Bug 1422365 - Introduce nsIClearDataService - part 14 - logins, r=johannh

This commit is contained in:
Andrea Marchesini 2018-06-01 14:30:01 +02:00
parent bd85ed6605
commit fe0853f6f2
3 changed files with 20 additions and 9 deletions

View File

@ -421,14 +421,9 @@ var Sanitizer = {
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);
}
},

View File

@ -474,6 +474,15 @@ const AuthTokensCleaner = {
},
};
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,
@ -517,6 +526,9 @@ const FLAGS_MAP = [
{ flag: Ci.nsIClearDataService.CLEAR_AUTH_TOKENS,
cleaner: AuthTokensCleaner, },
{ flag: Ci.nsIClearDataService.CLEAR_AUTH_CACHE,
cleaner: AuthCacheCleaner, },
];
this.ClearDataService = function() {};

View File

@ -153,6 +153,11 @@ interface nsIClearDataService : nsISupports
*/
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;
@ -160,7 +165,6 @@ interface nsIClearDataService : nsISupports
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;
*/
/**