]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/modules/sanitizer.jsm
Import r6976 from upstream hg supporting Firefox up to 25.*
[dactyl.git] / common / modules / sanitizer.jsm
index 01b0ecad1b750f0ee7238f0b9da099182bdf589d..2db1dfe54d1455ce9faebf3933e788649b8f84bd 100644 (file)
@@ -1,5 +1,5 @@
 // Copyright (c) 2009 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2009-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k at Gmail>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -171,7 +171,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
             before: [
                 ["preferences", { id: branch.substr(Item.PREFIX.length) + "history",
                                   xmlns: "xul" },
-                  template.map(ourItems(persistent), function (item)
+                  template.map(ourItems(persistent), item =>
                       ["preference", { type: "bool", id: branch + item.name, name: branch + item.name }])]
             ],
             init: function init(win) {
@@ -186,7 +186,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
 
             let (branch = Item.PREFIX + Item.SHUTDOWN_BRANCH) {
                 overlay.overlayWindow("chrome://browser/content/preferences/sanitize.xul",
-                                   function (win) prefOverlay(branch, true, {
+                                      function (win) prefOverlay(branch, true, {
                     append: {
                         SanitizeDialogPane:
                             ["groupbox", { orient: "horizontal", xmlns: "xul" },
@@ -197,9 +197,9 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                                     ["column", { flex: "1" }]],
                                 ["rows", {},
                                   let (items = ourItems(true))
-                                     template.map(util.range(0, Math.ceil(items.length / 2)), function (i)
+                                     template.map(util.range(0, Math.ceil(items.length / 2)), i =>
                                          ["row", {},
-                                             template.map(items.slice(i * 2, i * 2 + 2), function (item)
+                                             template.map(items.slice(i * 2, i * 2 + 2), item =>
                                                 ["checkbox", { xmlns: XUL, label: item.description, preference: branch + item.name }])])]]]
                     }
                 }));
@@ -211,7 +211,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                         itemList: [
                             ["listitem", { xmlns: "xul", label: /*L*/"See :help privacy for the following:",
                                            disabled: "true", style: "font-style: italic; font-weight: bold;" }],
-                            template.map(ourItems(), function ([item, desc])
+                            template.map(ourItems(), ([item, desc]) =>
                                 ["listitem", { xmlns: "xul", preference: branch + item,
                                                type: "checkbox", label: config.appName + ", " + desc,
                                                onsyncfrompreference: "return gSanitizePromptDialog.onReadGeneric();" }])
@@ -247,7 +247,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
             if (!("value" in prop) || !callable(prop.value) && !(k in item))
                 Object.defineProperty(item, k, prop);
 
-        let names = Set([name].concat(params.contains || []).map(function (e) "clear-" + e));
+        let names = Set([name].concat(params.contains || []).map(e => "clear-" + e));
         if (params.action)
             storage.addObserver("sanitizer",
                 function (key, event, arg) {
@@ -466,7 +466,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                         sanitizer.sanitize(items, range);
                 }
 
-                if (array.nth(opt.value, function (i) i == "all" || /^!/.test(i), 0) == "all" && !args["-host"])
+                if (array.nth(opt.value, i => i == "all" || /^!/.test(i), 0) == "all" && !args["-host"])
                     modules.commandline.input(_("sanitize.prompt.deleteAll") + " ",
                         function (resp) {
                             if (resp.match(/^y(es)?$/i)) {
@@ -493,8 +493,8 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                         names: ["-host", "-h"],
                         description: "Only sanitize items referring to listed host or hosts",
                         completer: function (context, args) {
-                            context.filters.push(function (item)
-                                !args["-host"].some(function (host) util.isSubdomain(item.text, host)));
+                            context.filters.push(item =>
+                                !args["-host"].some(host => util.isSubdomain(item.text, host)));
                             modules.completion.domain(context);
                         },
                         type: modules.CommandOption.LIST
@@ -586,7 +586,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
     completion: function initCompletion(dactyl, modules, window) {
         modules.completion.visibleHosts = function completeHosts(context) {
             let res = util.visibleHosts(window.content);
-            if (context.filter && !res.some(function (host) host.indexOf(context.filter) >= 0))
+            if (context.filter && !res.some(host => host.indexOf(context.filter) >= 0))
                 res.push(context.filter);
 
             context.title = ["Domain"];
@@ -612,11 +612,12 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                 },
 
                 has: function has(val)
-                    let (res = array.nth(this.value, function (v) v == "all" || v.replace(/^!/, "") == val, 0))
+                    let (res = array.nth(this.value, 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.replace(/^!/, "")))
+                    values.every(val => (val === "all" || Set.has(sanitizer.itemMap, val.replace(/^!/, ""))))
             });
 
         options.add(["sanitizeshutdown", "ss"],
@@ -679,7 +680,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                 ],
                 getter: function () (this.values[prefs.get(this.PREF)] || ["all"])[0],
                 setter: function (val) {
-                    prefs.set(this.PREF, this.values.map(function (i) i[0]).indexOf(val));
+                    prefs.set(this.PREF, this.values.map(i => i[0]).indexOf(val));
                     return val;
                 },
                 initialValue: true,
@@ -698,7 +699,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                 ],
                 getter: function () (this.values[prefs.get(this.PREF)] || [prefs.get(this.PREF_DAYS)])[0],
                 setter: function (value) {
-                    let val = this.values.map(function (i) i[0]).indexOf(value);
+                    let val = this.values.map(i => i[0]).indexOf(value);
                     if (val > -1)
                         prefs.set(this.PREF, val);
                     else {