Last active
April 5, 2022 15:11
-
-
Save hinxx/3b4b55228724fa99650730d41f0c03fe to your computer and use it in GitHub Desktop.
Firefox extension interface to remove active logins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/browser/components/extensions/ExtensionBrowsingData.jsm b/browser/components/extensions/ExtensionBrowsingData.jsm | |
--- a/browser/components/extensions/ExtensionBrowsingData.jsm | |
+++ b/browser/components/extensions/ExtensionBrowsingData.jsm | |
@@ -46,7 +46,10 @@ class BrowsingDataDelegate { | |
const PREF_DOMAIN = "privacy.cpd."; | |
// The following prefs are the only ones in Firefox that match corresponding | |
// values used by Chrome when rerturning settings. | |
- const PREF_LIST = ["cache", "cookies", "history", "formdata", "downloads"]; | |
+ // HK | |
+ //const PREF_LIST = ["cache", "cookies", "history", "formdata", "downloads"]; | |
+ const PREF_LIST = ["cache", "cookies", "history", "formdata", "downloads", "sessions"]; | |
+ // HK | |
// since will be the start of what is returned by Sanitizer.getClearRange | |
// divided by 1000 to convert to ms. | |
diff --git a/toolkit/components/extensions/parent/ext-browsingData.js b/toolkit/components/extensions/parent/ext-browsingData.js | |
--- a/toolkit/components/extensions/parent/ext-browsingData.js | |
+++ b/toolkit/components/extensions/parent/ext-browsingData.js | |
@@ -78,6 +78,14 @@ const clearCache = options => { | |
return clearData(options, Ci.nsIClearDataService.CLEAR_ALL_CACHES); | |
}; | |
+// HK | |
+const clearSessions = options => { | |
+ // copied flags from Sanitizer.jsm | |
+ return clearData(options, Ci.nsIClearDataService.CLEAR_AUTH_TOKENS | | |
+ Ci.nsIClearDataService.CLEAR_AUTH_CACHE); | |
+}; | |
+// HK | |
+ | |
const clearCookies = async function(options) { | |
let cookieMgr = Services.cookies; | |
// This code has been borrowed from Sanitizer.jsm. | |
@@ -278,6 +286,10 @@ class BrowsingDataImpl { | |
switch (dataType) { | |
case "cache": | |
return clearCache(options); | |
+// HK | |
+ case "sessions": | |
+ return clearSessions(options); | |
+// HK | |
case "cookies": | |
return clearCookies(options); | |
case "indexedDB": | |
diff --git a/toolkit/components/extensions/schemas/browsing_data.json b/toolkit/components/extensions/schemas/browsing_data.json | |
--- a/toolkit/components/extensions/schemas/browsing_data.json | |
+++ b/toolkit/components/extensions/schemas/browsing_data.json | |
@@ -117,6 +117,11 @@ | |
"optional": true, | |
"description": "Stored passwords." | |
}, | |
+ "sessions": { | |
+ "type": "boolean", | |
+ "optional": true, | |
+ "description": "Stored active logins." | |
+ }, | |
"pluginData": { | |
"type": "boolean", | |
"optional": true, | |
@@ -226,6 +231,25 @@ | |
] | |
}, | |
{ | |
+ "name": "removeSessions", | |
+ "description": "Clears the active logins.", | |
+ "type": "function", | |
+ "async": "callback", | |
+ "parameters": [ | |
+ { | |
+ "$ref": "RemovalOptions", | |
+ "name": "options" | |
+ }, | |
+ { | |
+ "name": "callback", | |
+ "type": "function", | |
+ "description": "Called when the browser's active logins have been cleared.", | |
+ "optional": true, | |
+ "parameters": [] | |
+ } | |
+ ] | |
+ }, | |
+ { | |
"name": "removeCookies", | |
"description": "Clears the browser's cookies and server-bound certificates modified within a particular timeframe.", | |
"type": "function", |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment