From f23e9321f1f1a73b0456a5fa2e9ee5ba62fd3af8 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 06:00:48 -0500 Subject: [PATCH] Only purge all domain data when explicitly asked rather than when history is specified. --- common/locale/en-US/various.xml | 17 +++++++++-------- common/modules/sanitizer.jsm | 29 ++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/common/locale/en-US/various.xml b/common/locale/en-US/various.xml index c66f85d6..da02cd66 100644 --- a/common/locale/en-US/various.xml +++ b/common/locale/en-US/various.xml @@ -198,6 +198,7 @@
downloads
Download history
formdata
Saved form and search history
history
Browsing history
+
host
All data from the given host
marks
Local and URL marks
macros
Saved macros
messages
Saved :messages
@@ -225,27 +226,27 @@ The following items are always cleared entirely, regardless of - timeframe: cache, offlineapps, + timeframe: cache, host, offlineapps, passwords, sessions, sitesettings. - Conversely, options are never cleared unless a host is - specified. + Conversely, host and options are never cleared + unless a host is specified.

If host (short name -h) is specified, only items containing a reference to that domain or a subdomain thereof are - cleared. Moreover, if commandline or history is - specified, the invocation of the :sanitize command is - naturally cleared as well. + cleared. Moreover, if either of commandline or + history is specified, the invocation of the + :sanitize command is naturally cleared as well.

This only applies to commandline, cookies, history, marks, messages, options, and sitesettings. All other - domain-specific data is cleared only along with history, + domain-specific data is cleared only along with host, when a request is made to &dactyl.host; to purge all data for - host. Included in this purge are all matching history + host. Included in this purge are all matching history entries, cookies, closed tabs, form data, and location bar entries. diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index b4cd74f6..47f402e8 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -78,7 +78,6 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef this.addItem("cache", { builtin: true, description: "Cache" }); this.addItem("downloads", { builtin: true, description: "Download history" }); this.addItem("formdata", { builtin: true, description: "Saved form and search history" }); - this.addItem("history", { builtin: true, description: "Browsing history", sessionHistory: true }); this.addItem("offlineapps", { builtin: true, description: "Offline website data" }); this.addItem("passwords", { builtin: true, description: "Saved passwords" }); this.addItem("sessions", { builtin: true, description: "Authenticated sessions" }); @@ -96,6 +95,32 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef }, override: true }); + this.addItem("history", { + builtin: true, + description: "Browsing history", + persistent: true, + sessionHistory: true, + action: function (range, host) { + if (host) + services.history.removePagesFromHost(host, true); + else + services.history.removeVisitsByTimeframe(this.range.min, this.range.max); + + if (!host) + services.observer.notifyObservers(null, "browser:purge-session-history", ""); + + if (!host || util.isDomainURL(prefs.get("general.open_location.last_url"), host)) + prefs.reset("general.open_location.last_url"); + }, + override: true + }); + this.addItem("host", { + description: "All data from the given host", + action: function (range, host) { + if (host) + services.privateBrowsing.removeDataFromDomain(host); + } + }); this.addItem("sitesettings", { builtin: true, description: "Site preferences", @@ -398,8 +423,6 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef if (args["-host"]) { args["-host"].forEach(function (host) { sanitizer.sanitizing = true; - if (items.indexOf("history") > -1) - services.privateBrowsing.removeDataFromDomain(host); sanitizer.sanitizeItems(items, range, host) }); }