// Copyright (c) 2009 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2009-2013 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2009-2014 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.
// "Allow this site to open popups" ...
services.permissions.removeAll();
// Zoom level, ...
- services.contentPrefs.removeGroupedPrefs();
+ services.contentPrefs.removeAllDomains(null);
}
// "Never remember passwords" ...
- for each (let domain in services.loginManager.getAllDisabledHosts())
+ for (let domain of services.loginManager.getAllDisabledHosts())
if (!host || util.isSubdomain(domain, host))
services.loginManager.setLoginSavingEnabled(host, true);
},
if (!("value" in prop) || !callable(prop.value) && !(k in item))
Object.defineProperty(item, k, prop);
- let names = Set([name].concat(params.contains || []).map(e => "clear-" + e));
+ function getWindow(obj) {
+ obj = Class.objectGlobal(obj);
+ return obj.window || obj;
+ }
+
+ let names = RealSet([name].concat(params.contains || []).map(e => "clear-" + e));
if (params.action)
storage.addObserver("sanitizer",
function (key, event, arg) {
- if (event in names)
+ if (names.has(event))
params.action.apply(params, arg);
},
- Class.objectGlobal(params.action));
+ getWindow(params.action));
if (params.privateEnter || params.privateLeave)
storage.addObserver("private-mode",
if (meth)
meth.call(params);
},
- Class.objectGlobal(params.action));
+ getWindow(params.privateEnter || params.privateLeave));
},
observers: {
UNPERMS: Class.Memoize(function () iter(this.PERMS).map(Array.reverse).toObject()),
COMMANDS: {
- unset: /*L*/"Unset",
- allow: /*L*/"Allowed",
- deny: /*L*/"Denied",
- session: /*L*/"Allowed for the current session",
- list: /*L*/"List all cookies for domain",
- clear: /*L*/"Clear all cookies for domain",
+ "unset": /*L*/"Unset",
+ "allow": /*L*/"Allowed",
+ "deny": /*L*/"Denied",
+ "session": /*L*/"Allowed for the current session",
+ "list": /*L*/"List all cookies for domain",
+ "clear": /*L*/"Clear all cookies for domain",
"clear-persistent": /*L*/"Clear all persistent cookies for domain",
"clear-session": /*L*/"Clear all session cookies for domain"
},
for (let c in iter(services.cookies, Ci.nsICookie2))
if (!host || util.isSubdomain(c.rawHost, host) ||
c.host[0] == "." && c.host.length < host.length
- && host.indexOf(c.host) == host.length - c.host.length)
+ && host.endsWith(c.host))
yield c;
},
if (args.bang)
dactyl.assert(args.length == 0, _("error.trailingCharacters"));
else {
+ dactyl.assert(args.length, _("error.argumentRequired"));
dactyl.assert(opt.validator(args), _("error.invalidArgument"));
opt = { __proto__: opt, value: args.slice() };
}
- let items = Object.keys(sanitizer.itemMap).slice(1).filter(opt.has, opt);
+ let items = Object.keys(sanitizer.itemMap)
+ .slice(1)
+ .filter(opt.has, opt);
function sanitize(items) {
sanitizer.range = range.native;
sanitizer.sanitize(items, range);
}
- if (array.nth(opt.value, i => i == "all" || /^!/.test(i), 0) == "all" && !args["-host"])
+ if ("all" == opt.value.find(i => (i == "all" ||
+ /^!/.test(i)))
+ && !args["-host"])
+
modules.commandline.input(_("sanitize.prompt.deleteAll") + " ",
function (resp) {
if (resp.match(/^y(es)?$/i)) {
completion: function initCompletion(dactyl, modules, window) {
modules.completion.visibleHosts = function completeHosts(context) {
let res = util.visibleHosts(window.content);
- if (context.filter && !res.some(host => host.indexOf(context.filter) >= 0))
+ if (context.filter && !res.some(host => host.contains(context.filter)))
res.push(context.filter);
context.title = ["Domain"];
},
has: function has(val)
- let (res = array.nth(this.value, v => (v == "all" || v.replace(/^!/, "") == val),
- 0))
+ let (res = this.value.find(v => (v == "all" || v.replace(/^!/, "") == val)))
res && !/^!/.test(res),
validator: function (values) values.length &&
- values.every(val => (val === "all" || Set.has(sanitizer.itemMap, val.replace(/^!/, ""))))
+ values.every(val => (val === "all" || hasOwnProperty(sanitizer.itemMap, val.replace(/^!/, ""))))
});
options.add(["sanitizeshutdown", "ss"],
sanitizer.runAtShutdown = false;
else {
sanitizer.runAtShutdown = true;
- let have = Set(value);
+ let have = RealSet(value);
for (let item in values(sanitizer.itemMap))
prefs.set(item.shutdownPref,
- Boolean(Set.has(have, item.name) ^ Set.has(have, "all")));
+ Boolean(have.has(item.name) ^ have.has("all")));
}
return value;
}