mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-27 03:53:34 +01:00
Make macros and marks sanitizeable.
This commit is contained in:
@@ -27,16 +27,14 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - should all storage items with the privateData flag be sanitizeable? i.e.
|
// - fix Sanitize autocommand
|
||||||
// local-marks, url-marks, quick-marks, macros. Bookmarks et al aren't
|
|
||||||
// sanitizeable in FF.
|
|
||||||
// - add warning for TIMESPAN_EVERYTHING?
|
// - add warning for TIMESPAN_EVERYTHING?
|
||||||
// - respect privacy.clearOnShutdown et al or recommend VimperatorLeave autocommand?
|
// - respect privacy.clearOnShutdown et al or recommend VimperatorLeave autocommand?
|
||||||
// - add support for :set sanitizeitems=all like 'eventignore'?
|
// - add support for :set sanitizeitems=all like 'eventignore'?
|
||||||
// - integrate with the Clear Private Data dialog?
|
// - integrate with the Clear Private Data dialog?
|
||||||
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
// - finish FF 3.0 support if we're going to support that in Vimperator 2.2
|
// - finish 1.9.0 support if we're going to support sanitizing in Xulmus
|
||||||
|
|
||||||
function Sanitizer() //{{{
|
function Sanitizer() //{{{
|
||||||
{
|
{
|
||||||
@@ -48,21 +46,17 @@ function Sanitizer() //{{{
|
|||||||
services.get("subscriptLoader").loadSubScript("chrome://browser/content/sanitize.js", local);
|
services.get("subscriptLoader").loadSubScript("chrome://browser/content/sanitize.js", local);
|
||||||
const Sanitizer = local.Sanitizer;
|
const Sanitizer = local.Sanitizer;
|
||||||
|
|
||||||
var prefToArgMap = {
|
var prefArgList = [["commandLine", "commandline"],
|
||||||
cache: "cache",
|
["offlineApps", "offlineapps"],
|
||||||
cookies: "cookies",
|
["siteSettings", "sitesettings"]];
|
||||||
offlineApps: "offlineapps",
|
|
||||||
history: "history",
|
|
||||||
formdata: "formdata",
|
|
||||||
downloads: "downloads",
|
|
||||||
passwords: "passwords",
|
|
||||||
sessions: "sessions",
|
|
||||||
siteSettings: "sitesettings",
|
|
||||||
commandLine: "commandline"
|
|
||||||
};
|
|
||||||
|
|
||||||
function prefToArg(pref) prefToArgMap[pref.replace(/.*\./, "")]
|
function prefToArg(pref)
|
||||||
function argToPref(arg) [p for ([p, a] in Iterator(prefToArgMap)) if (a == arg)][0]
|
{
|
||||||
|
let pref = pref.replace(/.*\./, "");
|
||||||
|
return util.Array.toObject(prefArgList)[pref] || pref;
|
||||||
|
}
|
||||||
|
|
||||||
|
function argToPref(arg) [k for ([, [k, v]] in Iterator(prefArgList)) if (v == arg)][0] || arg
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// OPTIONS /////////////////////////////////////////////////
|
////////////////////// OPTIONS /////////////////////////////////////////////////
|
||||||
@@ -70,7 +64,7 @@ function Sanitizer() //{{{
|
|||||||
|
|
||||||
options.add(["sanitizeitems", "si"],
|
options.add(["sanitizeitems", "si"],
|
||||||
"The default list of private items to sanitize",
|
"The default list of private items to sanitize",
|
||||||
"stringlist", "history,formdata,cookies,cache,sessions,commandline",
|
"stringlist", "cache,commandline,cookies,formdata,history,marks,sessions",
|
||||||
{
|
{
|
||||||
setter: function (values)
|
setter: function (values)
|
||||||
{
|
{
|
||||||
@@ -93,15 +87,17 @@ function Sanitizer() //{{{
|
|||||||
getter: function () sanitizer.prefNames.filter(function (pref) options.getPref(pref)).map(prefToArg).join(","),
|
getter: function () sanitizer.prefNames.filter(function (pref) options.getPref(pref)).map(prefToArg).join(","),
|
||||||
completer: function (value) [
|
completer: function (value) [
|
||||||
["cache", "Cache"],
|
["cache", "Cache"],
|
||||||
|
["commandline", "Command-line history"],
|
||||||
["cookies", "Cookies"],
|
["cookies", "Cookies"],
|
||||||
["offlineapps", "Offline website data"],
|
|
||||||
["history", "Browsing history"],
|
|
||||||
["formdata", "Saved form and search history"],
|
|
||||||
["downloads", "Download history"],
|
["downloads", "Download history"],
|
||||||
|
["formdata", "Saved form and search history"],
|
||||||
|
["history", "Browsing history"],
|
||||||
|
["macros", "Saved macros"],
|
||||||
|
["marks", "Local and URL marks"],
|
||||||
|
["offlineapps", "Offline website data"],
|
||||||
["passwords", "Saved passwords"],
|
["passwords", "Saved passwords"],
|
||||||
["sessions", "Authenticated sessions"],
|
["sessions", "Authenticated sessions"],
|
||||||
["sitesettings", "Site preferences"],
|
["sitesettings", "Site preferences"],
|
||||||
["commandline", "Command-line history"]
|
|
||||||
],
|
],
|
||||||
validator: Option.validateCompleter
|
validator: Option.validateCompleter
|
||||||
});
|
});
|
||||||
@@ -210,30 +206,51 @@ function Sanitizer() //{{{
|
|||||||
self.prefDomain = "privacy.item.";
|
self.prefDomain = "privacy.item.";
|
||||||
|
|
||||||
self.prefDomain2 = "extensions.liberator.privacy.cpd.";
|
self.prefDomain2 = "extensions.liberator.privacy.cpd.";
|
||||||
self.items.commandLine = {
|
|
||||||
canClear: true,
|
// add liberator-specific private items
|
||||||
clear: function ()
|
[
|
||||||
{
|
{
|
||||||
let stores = ["command", "search"];
|
name: "commandLine",
|
||||||
|
action: function ()
|
||||||
if (self.range)
|
|
||||||
{
|
{
|
||||||
stores.forEach(function (store) {
|
let stores = ["command", "search"];
|
||||||
storage["history-" + store].mutate("filter", function (item) {
|
|
||||||
let timestamp = item.timestamp * 1000;
|
|
||||||
return timestamp < self.range[0] || timestamp > self.range[1];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
stores.forEach(function (store) { storage["history-" + store].truncate(0); });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// FIXME
|
if (self.range)
|
||||||
// create liberator-specific sanitize prefs
|
{
|
||||||
if (options.getPref(self.prefDomain2 + "commandLine") == null)
|
stores.forEach(function (store) {
|
||||||
options.setPref(self.prefDomain2 + "commandLine", false)
|
storage["history-" + store].mutate("filter", function (item) {
|
||||||
|
let timestamp = item.timestamp * 1000;
|
||||||
|
return timestamp < self.range[0] || timestamp > self.range[1];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stores.forEach(function (store) { storage["history-" + store].truncate(0); });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "macros",
|
||||||
|
action: function () { storage["macros"].clear(); }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "marks",
|
||||||
|
action: function ()
|
||||||
|
{
|
||||||
|
storage["local-marks"].clear();
|
||||||
|
storage["url-marks"].clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
].forEach(function (item) {
|
||||||
|
let pref = self.prefDomain2 + item.name;
|
||||||
|
|
||||||
|
if (options.getPref(pref) == null)
|
||||||
|
options.setPref(pref, false);
|
||||||
|
|
||||||
|
self.items[item.name] = {
|
||||||
|
canClear: true,
|
||||||
|
clear: item.action
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
self.getClearRange = Sanitizer.getClearRange;
|
self.getClearRange = Sanitizer.getClearRange;
|
||||||
|
|
||||||
|
|||||||
@@ -665,23 +665,26 @@ ____
|
|||||||
|
|
||||||
|
|
||||||
|\'si'| |\'sanitizeitems'| +
|
|\'si'| |\'sanitizeitems'| +
|
||||||
||'sanitizeitems' 'si'|| stringlist (default: "history,formdata,cookies,cache,sessions,commandline")
|
||'sanitizeitems' 'si'|| stringlist
|
||||||
____
|
____
|
||||||
|
(default: "cache,commandline,cookies,formdata,history,marks,sessions")
|
||||||
|
|
||||||
The default list of private items to sanitize.
|
The default list of private items to sanitize.
|
||||||
|
|
||||||
[frame="topbot",grid="none",cols="1,4"]
|
[frame="topbot",grid="none",cols="1,4"]
|
||||||
|===============================================================================
|
|===============================================================================
|
||||||
|*cache* |Cache
|
|*cache* |Cache
|
||||||
|*commandline* |Command-line history
|
|*commandline* |Command-line history
|
||||||
|*cookies* |Cookies
|
|*cookies* |Cookies
|
||||||
|*downloads* |Download history
|
|*downloads* |Download history
|
||||||
|*formdata* |Saved form and search history
|
|*formdata* |Saved form and search history
|
||||||
|*history* |Browsing history
|
|*history* |Browsing history
|
||||||
|*offlineapps* |Offline website data
|
|*marks* |Local and URL marks
|
||||||
|*passwords* |Saved passwords
|
|*macros* |Saved macros
|
||||||
|*sessions* |Authenticated sessions
|
|*offlineapps* |Offline website data
|
||||||
|*sitesettings* |Site preferences
|
|*passwords* |Saved passwords
|
||||||
|
|*sessions* |Authenticated sessions
|
||||||
|
|*sitesettings*|Site preferences
|
||||||
|===============================================================================
|
|===============================================================================
|
||||||
|
|
||||||
When history items are sanitized [c]:open[c], [c]:tabopen[c] and [c]:winopen[c]
|
When history items are sanitized [c]:open[c], [c]:tabopen[c] and [c]:winopen[c]
|
||||||
|
|||||||
Reference in New Issue
Block a user