mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1422365 - Introduce nsIClearDataService - part 7 - appCache, r=johannh
This commit is contained in:
parent
1a54d00d85
commit
d7ef003a02
@ -14,7 +14,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
FormHistory: "resource://gre/modules/FormHistory.jsm",
|
||||
TelemetryStopwatch: "resource://gre/modules/TelemetryStopwatch.jsm",
|
||||
ServiceWorkerCleanUp: "resource://gre/modules/ServiceWorkerCleanUp.jsm",
|
||||
OfflineAppCacheHelper: "resource://gre/modules/offlineAppCache.jsm",
|
||||
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
|
||||
});
|
||||
|
||||
@ -334,8 +333,7 @@ var Sanitizer = {
|
||||
|
||||
offlineApps: {
|
||||
async clear(range) {
|
||||
// AppCache: this doesn't wait for the cleanup to be complete.
|
||||
OfflineAppCacheHelper.clear();
|
||||
await clearData(range, Ci.nsIClearDataService.CLEAR_DOM_STORAGES);
|
||||
|
||||
if (range) {
|
||||
let principals = sas.getActiveOrigins(range[0], range[1])
|
||||
|
@ -6,8 +6,12 @@
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Timer.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Downloads.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
setTimeout: "resource://gre/modules/Timer.jsm",
|
||||
Downloads: "resource://gre/modules/Downloads.jsm",
|
||||
OfflineAppCacheHelper: "resource://gre/modules/offlineAppCache.jsm",
|
||||
});
|
||||
|
||||
// A Cleaner is an object with 3 methods. These methods must return a Promise
|
||||
// object. Here a description of these methods:
|
||||
@ -249,6 +253,14 @@ const MediaDevicesCleaner = {
|
||||
},
|
||||
};
|
||||
|
||||
const AppCacheCleaner = {
|
||||
deleteAll() {
|
||||
// AppCache: this doesn't wait for the cleanup to be complete.
|
||||
OfflineAppCacheHelper.clear();
|
||||
return Promise.resolve();
|
||||
},
|
||||
};
|
||||
|
||||
// Here the map of Flags-Cleaner.
|
||||
const FLAGS_MAP = [
|
||||
{ flag: Ci.nsIClearDataService.CLEAR_COOKIES,
|
||||
@ -271,6 +283,9 @@ const FLAGS_MAP = [
|
||||
|
||||
{ flag: Ci.nsIClearDataService.CLEAR_MEDIA_DEVICES,
|
||||
cleaner: MediaDevicesCleaner, },
|
||||
|
||||
{ flag: Ci.nsIClearDataService.CLEAR_APPCACHE,
|
||||
cleaner: AppCacheCleaner, },
|
||||
];
|
||||
|
||||
this.ClearDataService = function() {};
|
||||
|
@ -118,6 +118,11 @@ interface nsIClearDataService : nsISupports
|
||||
*/
|
||||
const uint32_t CLEAR_MEDIA_DEVICES = 1 << 6;
|
||||
|
||||
/**
|
||||
* AppCache.
|
||||
*/
|
||||
const uint32_t CLEAR_APPCACHE = 1 << 7;
|
||||
|
||||
/* TODO
|
||||
const uint32_t CLEAR_EME = 1 << 4;
|
||||
const uint32_t CLEAR_PERMISSIONS = 1 << 7;
|
||||
@ -150,9 +155,11 @@ interface nsIClearDataService : nsISupports
|
||||
*/
|
||||
const uint32_t CLEAR_ALL_CACHES = CLEAR_NETWORK_CACHE | CLEAR_IMAGE_CACHE;
|
||||
|
||||
/*
|
||||
const uint32_t CLEAR_DOM_STORAGES = CLEAR_DOM_QUOTA | CLEAR_DOM_PUSH_NOTIFICATIONS | CLEAR_FORMDATA | CLEAR_SESSION_HISTORY;
|
||||
/**
|
||||
* Delete all DOM storages
|
||||
* TODO: add CLEAR_DOM_QUOTA | CLEAR_DOM_PUSH_NOTIFICATIONS | CLEAR_FORMDATA | CLEAR_SESSION_HISTORY;
|
||||
*/
|
||||
const uint32_t CLEAR_DOM_STORAGES = CLEAR_APPCACHE;
|
||||
|
||||
/*
|
||||
const uint32_t CLEAR_BROWSER_DATA = CLEAR_DOWNLOADS | CLEAR_PASSWORDS | CLEAR_PERMISSIONS | CLEAR_CONTENT_PREFERENCES | CLEAR_HISTORY | CLEAR_LOGINS;
|
||||
|
Loading…
Reference in New Issue
Block a user