From ed38331178572e8a62fe84b5a7ff7715e662ee3a Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 10 Sep 2009 16:33:36 -0400 Subject: [PATCH] Respect 'sanitizetimespan' in command history sanitization. --- common/content/sanitizer.js | 2 ++ common/content/ui.js | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/common/content/sanitizer.js b/common/content/sanitizer.js index fcaf028d..f9c89266 100644 --- a/common/content/sanitizer.js +++ b/common/content/sanitizer.js @@ -235,6 +235,8 @@ function Sanitizer() //{{{ if (options.getPref(self.prefDomain2 + "commandLine") == null) options.setPref(self.prefDomain2 + "commandLine", false) + self.getClearRange = Sanitizer.getClearRange; + // Largely ripped from from browser/base/content/sanitize.js so we can override // the pref strategy without stepping on the global prefs namespace. self.sanitize = function () { diff --git a/common/content/ui.js b/common/content/ui.js index 6b3aae5c..ae66fa79 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -167,10 +167,16 @@ function CommandLine() //{{{ /** * Removes any private data from this history. */ - sanitize: function () + sanitize: function (timespan) { - // TODO: Respect privacy.item.timeSpan (options["sts"]) - this.store.mutate("filter", function (line) !line.privateData); + let range = [0, Number.MAX_VALUE]; + if (liberator.has("sanitizer") && (timespan || options["sanitizetimespan"])) + range = sanitizer.getClearRange(timespan || options["sanitizetimespan"]); + + this.store.mutate("filter", function (item) { + let timestamp = (item.timestamp || Date.now()/1000) * 1000; + return !line.privateData || timestamp < self.range[0] || timestamp > self.range[1]; + }); }, /** * Replace the current input field value.