diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-08-06 13:51:21 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-08-06 13:51:21 -0400 |
commit | 48d1109f6a49e1f9a969e9efb1024e2a74c19721 (patch) | |
tree | d88c9e68035678e48bf4acebc6642ec26368e240 /common | |
parent | b9f4221643da89f1c8b11df723e40d104e0cb515 (diff) | |
download | pentadactyl-48d1109f6a49e1f9a969e9efb1024e2a74c19721.tar.gz |
Reconcile the format of 'sanitizeitems' with most other list options.
Diffstat (limited to 'common')
-rw-r--r-- | common/content/editor.js | 9 | ||||
-rw-r--r-- | common/locale/en-US/options.xml | 5 | ||||
-rw-r--r-- | common/locale/en-US/privacy.xml | 7 | ||||
-rw-r--r-- | common/modules/sanitizer.jsm | 35 |
4 files changed, 41 insertions, 15 deletions
diff --git a/common/content/editor.js b/common/content/editor.js index 007679db..c8758f61 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -861,7 +861,14 @@ var Editor = Module("editor", { "string", config.locale, { initValue: function () {}, - getter: function getter() services.spell.dictionary || "", + getter: function getter() { + try { + return services.spell.dictionary || ""; + } + catch (e) { + return ""; + } + }, setter: function setter(val) { services.spell.dictionary = val; }, completer: function completer(context) { let res = {}; diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml index fa66f6fb..7a37f164 100644 --- a/common/locale/en-US/options.xml +++ b/common/locale/en-US/options.xml @@ -1321,7 +1321,10 @@ <description> <p> The default list of private items to sanitize. See - <ex>:sanitize</ex> for a list and explanation of possible values. + <ex>:sanitize</ex> for a list and explanation of possible values. A + value of <str>all</str> will cause all items to be sanitized. Items + may be excluded by prefixing them with a <tt>!</tt>. The first + matching item takes precedence. </p> </description> </item> diff --git a/common/locale/en-US/privacy.xml b/common/locale/en-US/privacy.xml index 7782ff99..5ab2a402 100644 --- a/common/locale/en-US/privacy.xml +++ b/common/locale/en-US/privacy.xml @@ -76,6 +76,13 @@ </dl> <p> + Items may be excluded by prefixing them with a <tt>!</tt>. The first + matching item takes precedence. Therefore, the value + <tt>!commandline all</tt> will sanitize all items but the command + line. A value of <tt>all !commandline</tt> will sanitize all items. + </p> + + <p> When <em>history</em> items are sanitized, all command-line history items containing URLs or page titles (other than bookmark commands) are additionally cleared. Invocations of the diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index 92753ed1..47c8c458 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -407,7 +407,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef function (args) { dactyl.assert(!modules.options['private'], _("command.sanitize.privateMode")); - if (args["-host"] && !args.length) + if (args["-host"] && !args.length && !args.bang) args[0] = "all"; let timespan = args["-timespan"] || modules.options["sanitizetimespan"]; @@ -418,15 +418,15 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef match ? 1000 * (Date.now() - 1000 * parseInt(num, 10) * { m: 60, h: 3600, d: 3600 * 24, w: 3600 * 24 * 7 }[unit]) : (timespan[0] == "s" ? sanitizer.sessionStart : null); - let items = args.slice(); - - if (args.bang) { + let opt = modules.options.get("sanitizeitems"); + if (args.bang) dactyl.assert(args.length == 0, _("error.trailingCharacters")); - items = Object.keys(sanitizer.itemMap).filter( - function (k) modules.options.get("sanitizeitems").has(k)); + else { + dactyl.assert(opt.validator(args), _("error.invalidArgument")); + opt = { __proto__: opt, value: args.slice() }; } - else - dactyl.assert(modules.options.get("sanitizeitems").validator(items), _("error.invalidArgument")); + + let items = Object.keys(sanitizer.itemMap).slice(1).filter(opt.has, opt); function sanitize(items) { sanitizer.range = range.native; @@ -442,13 +442,12 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef sanitizer.sanitize(items, range); } - if (items.indexOf("all") >= 0 && !args["-host"]) + if (array.nth(opt.value, function (i) i == "all" || /^!/.test(i), 0) == "all" && !args["-host"]) modules.commandline.input(_("sanitize.prompt.deleteAll") + " ", function (resp) { if (resp.match(/^y(es)?$/i)) { - items = Object.keys(sanitizer.itemMap).filter(function (k) items.indexOf(k) === -1); sanitize(items); - dactyl.echo(_("command.sanitize.allDeleted")); + dactyl.echomsg(_("command.sanitize.allDeleted")); } else dactyl.echo(_("command.sanitize.noneDeleted")); @@ -594,9 +593,19 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef "stringlist", "all", { get values() values(sanitizer.itemMap).toArray(), - has: modules.Option.has.toggleAll, + + completer: function completer(context, extra) { + if (context.filter[0] == "!") + context.advance(1); + return completer.superapply(this, arguments); + }, + + has: function has(val) + let (res = array.nth(this.value, function (v) v == "all" || v.replace(/^!/, "") == val, 0)) + res && !/^!/.test(res), + validator: function (values) values.length && - values.every(function (val) val === "all" || Set.has(sanitizer.itemMap, val)) + values.every(function (val) val === "all" || Set.has(sanitizer.itemMap, val.replace(/^!/, ""))) }); options.add(["sanitizeshutdown", "ss"], |