Bug 1881797 - (part 2) Add a helper flag to clear cookies and site data. r=pbz

Differential Revision: https://phabricator.services.mozilla.com/D206533
This commit is contained in:
Harshit Sohaney 2024-04-09 15:39:32 +00:00
Родитель 3fc0fa2f77
Коммит 82bb8081bf
3 изменённых файлов: 16 добавлений и 24 удалений

Просмотреть файл

@ -924,29 +924,13 @@ export var Sanitizer = {
await maybeSanitizeSessionPrincipals(
progress,
principalsForShutdownClearing,
Ci.nsIClearDataService.CLEAR_COOKIES |
Ci.nsIClearDataService.CLEAR_COOKIE_BANNER_EXECUTED_RECORD |
Ci.nsIClearDataService.CLEAR_DOM_STORAGES |
Ci.nsIClearDataService.CLEAR_EME |
Ci.nsIClearDataService.CLEAR_AUTH_TOKENS |
Ci.nsIClearDataService.CLEAR_AUTH_CACHE |
Ci.nsIClearDataService.CLEAR_FINGERPRINTING_PROTECTION_STATE |
Ci.nsIClearDataService.CLEAR_BOUNCE_TRACKING_PROTECTION_STATE |
Ci.nsIClearDataService.CLEAR_STORAGE_PERMISSIONS
Ci.nsIClearDataService.CLEAR_COOKIES_AND_SITE_DATA
);
} else {
// Not on shutdown
await clearData(
range,
Ci.nsIClearDataService.CLEAR_COOKIES |
Ci.nsIClearDataService.CLEAR_COOKIE_BANNER_EXECUTED_RECORD |
Ci.nsIClearDataService.CLEAR_DOM_STORAGES |
Ci.nsIClearDataService.CLEAR_EME |
Ci.nsIClearDataService.CLEAR_AUTH_TOKENS |
Ci.nsIClearDataService.CLEAR_AUTH_CACHE |
Ci.nsIClearDataService.CLEAR_FINGERPRINTING_PROTECTION_STATE |
Ci.nsIClearDataService.CLEAR_BOUNCE_TRACKING_PROTECTION_STATE |
Ci.nsIClearDataService.CLEAR_STORAGE_PERMISSIONS
Ci.nsIClearDataService.CLEAR_COOKIES_AND_SITE_DATA
);
}
await clearData(range, Ci.nsIClearDataService.CLEAR_MEDIA_DEVICES);

Просмотреть файл

@ -658,12 +658,7 @@ export var SiteDataManager = {
async removeSiteData() {
await new Promise(function (resolve) {
Services.clearData.deleteData(
Ci.nsIClearDataService.CLEAR_COOKIES |
Ci.nsIClearDataService.CLEAR_DOM_STORAGES |
Ci.nsIClearDataService.CLEAR_HSTS |
Ci.nsIClearDataService.CLEAR_EME |
Ci.nsIClearDataService.CLEAR_BOUNCE_TRACKING_PROTECTION_STATE |
Ci.nsIClearDataService.CLEAR_STORAGE_PERMISSIONS,
Ci.nsIClearDataService.CLEAR_COOKIES_AND_SITE_DATA,
resolve
);
});

Просмотреть файл

@ -345,6 +345,19 @@ interface nsIClearDataService : nsISupports
CLEAR_CREDENTIAL_MANAGER_STATE | CLEAR_COOKIE_BANNER_EXCEPTION |
CLEAR_COOKIE_BANNER_EXECUTED_RECORD | CLEAR_FINGERPRINTING_PROTECTION_STATE |
CLEAR_BOUNCE_TRACKING_PROTECTION_STATE;
/**
* Helper flag for clearing cookies and site data.
* This flag groups state that we consider site data
* from the user perspective. If you implement UI that
* offers site data clearing this is almost always what you want.
* If you need more granular control please use more specific
* flags like CLEAR_COOKIES and CLEAR_DOM_STORAGES.
*/
const uint32_t CLEAR_COOKIES_AND_SITE_DATA =
CLEAR_COOKIES | CLEAR_COOKIE_BANNER_EXECUTED_RECORD | CLEAR_DOM_STORAGES | CLEAR_HSTS |
CLEAR_EME | CLEAR_AUTH_TOKENS | CLEAR_AUTH_CACHE | CLEAR_FINGERPRINTING_PROTECTION_STATE |
CLEAR_BOUNCE_TRACKING_PROTECTION_STATE | CLEAR_STORAGE_PERMISSIONS;
};
/**