mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 21:08:12 +01:00
Respect -timespan when sanitizing command-line history.
This commit is contained in:
@@ -30,7 +30,6 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
// - should all storage items with the privateData flag be sanitizeable? i.e.
|
// - should all storage items with the privateData flag be sanitizeable? i.e.
|
||||||
// local-marks, url-marks, quick-marks, macros. Bookmarks et al aren't
|
// local-marks, url-marks, quick-marks, macros. Bookmarks et al aren't
|
||||||
// sanitizeable in FF.
|
// sanitizeable in FF.
|
||||||
// - timestamp the command-line history?
|
|
||||||
// - 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'?
|
||||||
@@ -215,8 +214,19 @@ function Sanitizer() //{{{
|
|||||||
canClear: true,
|
canClear: true,
|
||||||
clear: function ()
|
clear: function ()
|
||||||
{
|
{
|
||||||
storage["history-command"].truncate(0);
|
let stores = ["command", "search"];
|
||||||
storage["history-search"].truncate(0);
|
|
||||||
|
if (self.range)
|
||||||
|
{
|
||||||
|
stores.forEach(function (store) {
|
||||||
|
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); });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -244,6 +254,7 @@ function Sanitizer() //{{{
|
|||||||
return branch2.getBoolPref(name);
|
return branch2.getBoolPref(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache the range of times to clear
|
// Cache the range of times to clear
|
||||||
if (this.ignoreTimespan)
|
if (this.ignoreTimespan)
|
||||||
var range = null; // If we ignore timespan, clear everything
|
var range = null; // If we ignore timespan, clear everything
|
||||||
|
|||||||
@@ -161,8 +161,7 @@ function CommandLine() //{{{
|
|||||||
{
|
{
|
||||||
// Not really the ideal place for this check.
|
// Not really the ideal place for this check.
|
||||||
if (this.mode == "command")
|
if (this.mode == "command")
|
||||||
return (commands.get(str.replace("^[\s:]*", "").split(/[\s!]+/)[0]) || {})
|
return (commands.get(commands.parseCommand(str)[1]) || {}).privateData;
|
||||||
.privateData;
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -170,7 +169,7 @@ function CommandLine() //{{{
|
|||||||
*/
|
*/
|
||||||
sanitize: function ()
|
sanitize: function ()
|
||||||
{
|
{
|
||||||
// TODO: Respect privacy.item.timeSpan
|
// TODO: Respect privacy.item.timeSpan (options["sts"])
|
||||||
this.store.mutate("filter", function (line) !line.privateData);
|
this.store.mutate("filter", function (line) !line.privateData);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user