1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-12 07:15:46 +01:00

s/\bset\b/Set/g

This commit is contained in:
Kris Maglione
2011-07-16 18:51:59 -04:00
parent 328b992969
commit 9002a78d14
29 changed files with 144 additions and 129 deletions

View File

@@ -118,8 +118,8 @@ var actions = {
});
},
get filter() {
let ids = set(keys(JSON.parse(prefs.get("extensions.bootstrappedAddons", "{}"))));
return function ({ item }) !item.userDisabled && set.has(ids, item.id);
let ids = Set(keys(JSON.parse(prefs.get("extensions.bootstrappedAddons", "{}"))));
return function ({ item }) !item.userDisabled && Set.has(ids, item.id);
},
perm: "disable"
},
@@ -166,7 +166,7 @@ var Addon = Class("Addon", {
},
commandAllowed: function commandAllowed(cmd) {
util.assert(set.has(actions, cmd), _("addon.unknownCommand"));
util.assert(Set.has(actions, cmd), _("addon.unknownCommand"));
let action = actions[cmd];
if ("perm" in action && !(this.permissions & AddonManager["PERM_CAN_" + action.perm.toUpperCase()]))

View File

@@ -218,7 +218,7 @@ defineModule("base", {
// sed -n 's/^(const|function) ([a-zA-Z0-9_]+).*/ "\2",/p' base.jsm | sort | fmt
exports: [
"ErrorBase", "Cc", "Ci", "Class", "Cr", "Cu", "Module", "JSMLoader", "Object", "Runnable",
"Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMUtils", "XPCSafeJSObjectWrapper",
"Set", "Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMUtils", "XPCSafeJSObjectWrapper",
"array", "bind", "call", "callable", "ctypes", "curry", "debuggerProperties", "defineModule",
"deprecated", "endModule", "forEach", "isArray", "isGenerator", "isinstance", "isObject",
"isString", "isSubclass", "iter", "iterAll", "iterOwnProperties", "keys", "memoize", "octal",
@@ -273,7 +273,7 @@ function properties(obj, prototypes, debugger_) {
try {
if ("dactylPropertyNames" in obj && !prototypes)
for (let key in values(obj.dactylPropertyNames))
if (key in obj && !set.add(seen, key))
if (key in obj && !Set.add(seen, key))
yield key;
}
catch (e) {}
@@ -288,7 +288,7 @@ function properties(obj, prototypes, debugger_) {
iter = (prop.name.stringValue for (prop in values(debuggerProperties(obj))));
for (let key in iter)
if (!prototypes || !set.add(seen, key) && obj != orig)
if (!prototypes || !Set.add(seen, key) && obj != orig)
yield key;
}
}
@@ -322,14 +322,14 @@ function deprecated(alternative, fn) {
}
deprecated.warn = function warn(func, name, alternative, frame) {
if (!func.seenCaller)
func.seenCaller = set([
func.seenCaller = Set([
"resource://dactyl" + JSMLoader.suffix + "/javascript.jsm",
"resource://dactyl" + JSMLoader.suffix + "/util.jsm"
]);
frame = frame || Components.stack.caller.caller;
let filename = util.fixURI(frame.filename || "unknown");
if (!set.add(func.seenCaller, filename))
if (!Set.add(func.seenCaller, filename))
util.dactyl(func).warn([util.urlPath(filename), frame.lineNumber, " "].join(":")
+ require("messages")._("warn.deprecated", name, alternative));
}
@@ -373,7 +373,7 @@ var iterAll = deprecated("iter", function iterAll() iter.apply(null, arguments))
* @param {[string]} ary @optional
* @returns {object}
*/
function set(ary) {
function Set(ary) {
let obj = {};
if (ary)
for (let val in values(ary))
@@ -388,7 +388,7 @@ function set(ary) {
* @param {string} key The key to add.
* @returns boolean
*/
set.add = curry(function set_add(set, key) {
Set.add = curry(function set_add(set, key) {
let res = this.has(set, key);
set[key] = true;
return res;
@@ -400,7 +400,7 @@ set.add = curry(function set_add(set, key) {
* @param {string} key The key to check.
* @returns {boolean}
*/
set.has = curry(function set_has(set, key) hasOwnProperty.call(set, key) &&
Set.has = curry(function set_has(set, key) hasOwnProperty.call(set, key) &&
propertyIsEnumerable.call(set, key));
/**
* Returns a new set containing the members of the first argument which
@@ -409,7 +409,7 @@ set.has = curry(function set_has(set, key) hasOwnProperty.call(set, key) &&
* @param {object} set The set.
* @returns {object}
*/
set.subtract = function set_subtract(set) {
Set.subtract = function set_subtract(set) {
set = update({}, set);
for (let i = 1; i < arguments.length; i++)
for (let k in keys(arguments[i]))
@@ -424,12 +424,23 @@ set.subtract = function set_subtract(set) {
* @param {string} key The key to remove.
* @returns boolean
*/
set.remove = curry(function set_remove(set, key) {
Set.remove = curry(function set_remove(set, key) {
let res = set.has(set, key);
delete set[key];
return res;
});
function set() {
deprecated.warn(set, "set", "Set");
return Set.apply(this, arguments);
}
Object.keys(Set).forEach(function (meth) {
set[meth] = function proxy() {
deprecated.warn(proxy, "set." + meth, "Set." + meth);
return Set[meth].apply(this, arguments);
};
});
/**
* Curries a function to the given number of arguments. Each
* call of the resulting function returns a new function. When
@@ -671,12 +682,14 @@ function update(target) {
if (typeof desc.value === "function" && target.__proto__) {
let func = desc.value.wrapped || desc.value;
func.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]);
func.superapply = function superapply(self, args)
let (meth = Object.getPrototypeOf(target)[k])
meth && meth.apply(self, args);
func.supercall = function supercall(self)
func.superapply(self, Array.slice(arguments, 1));
if (!func.superapply) {
func.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]);
func.superapply = function superapply(self, args)
let (meth = Object.getPrototypeOf(target)[k])
meth && meth.apply(self, args);
func.supercall = function supercall(self)
func.superapply(self, Array.slice(arguments, 1));
}
}
try {
Object.defineProperty(target, k, desc);
@@ -768,19 +781,19 @@ function Class() {
}
if (Cu.getGlobalForObject)
Class.objectGlobal = function (caller) {
Class.objectGlobal = function (object) {
try {
return Cu.getGlobalForObject(caller);
return Cu.getGlobalForObject(object);
}
catch (e) {
return null;
}
};
else
Class.objectGlobal = function (caller) {
while (caller.__parent__)
caller = caller.__parent__;
return caller;
Class.objectGlobal = function (object) {
while (object.__parent__)
object = object.__parent__;
return object;
};
/**
@@ -936,12 +949,14 @@ Class.prototype = {
if (typeof desc.value === "function") {
let func = desc.value.wrapped || desc.value;
func.__defineGetter__("super", function () Object.getPrototypeOf(self)[k]);
func.superapply = function superapply(self, args)
let (meth = Object.getPrototypeOf(self)[k])
meth && meth.apply(self, args);
func.supercall = function supercall(self)
func.superapply(self, Array.slice(arguments, 1));
if (!func.superapply) {
func.__defineGetter__("super", function () Object.getPrototypeOf(self)[k]);
func.superapply = function superapply(self, args)
let (meth = Object.getPrototypeOf(self)[k])
meth && meth.apply(self, args);
func.supercall = function supercall(self)
func.superapply(self, Array.slice(arguments, 1));
}
}
try {
if ("value" in desc && i in this.localizedProperties)
@@ -1440,7 +1455,7 @@ update(iter, {
uniq: function uniq(iter) {
let seen = {};
for (let item in iter)
if (!set.add(seen, item))
if (!Set.add(seen, item))
yield item;
},

View File

@@ -155,7 +155,7 @@ else
for each (let prop in Object.getOwnPropertyNames(global))
try {
if (!(prop in this.builtin) &&
["JSMLoader", "set", "EXPORTED_SYMBOLS"].indexOf(prop) < 0 &&
["JSMLoader", "Set", "set", "EXPORTED_SYMBOLS"].indexOf(prop) < 0 &&
!global.__lookupGetter__(prop))
global[prop] = undefined;
}

View File

@@ -296,7 +296,7 @@ var Command = Class("Command", {
explicitOpts: Class.memoize(function () ({})),
has: function AP_has(opt) set.has(this.explicitOpts, opt) || typeof opt === "number" && set.has(this, opt),
has: function AP_has(opt) Set.has(this.explicitOpts, opt) || typeof opt === "number" && Set.has(this, opt),
get literalArg() this.command.literal != null && this[this.command.literal] || "",
@@ -369,7 +369,7 @@ var Command = Class("Command", {
warn: function warn(context, type, message) {
let loc = !context ? "" : [context.file, context.line, " "].join(":");
if (!set.add(this.complained, type + ":" + (context ? context.file : "[Command Line]")))
if (!Set.add(this.complained, type + ":" + (context ? context.file : "[Command Line]")))
this.modules.dactyl.warn(loc + message);
}
}, {
@@ -905,7 +905,7 @@ var Commands = Module("commands", {
let matchOpts = function matchOpts(arg) {
// Push possible option matches into completions
if (complete && !onlyArgumentsRemaining)
completeOpts = options.filter(function (opt) opt.multiple || !set.has(args, opt.names[0]));
completeOpts = options.filter(function (opt) opt.multiple || !Set.has(args, opt.names[0]));
};
let resetCompletions = function resetCompletions() {
completeOpts = null;
@@ -1574,7 +1574,7 @@ var Commands = Module("commands", {
]
})),
iterateIndex: function (args) let (tags = services["dactyl:"].HELP_TAGS)
this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || set.has(tags, cmd.helpTag)),
this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || Set.has(tags, cmd.helpTag)),
format: {
headings: ["Command", "Group", "Description"],
description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")),

View File

@@ -22,9 +22,9 @@ var ConfigBase = Class("ConfigBase", {
* initialization code. Must call superclass's init function.
*/
init: function init() {
this.features.push = deprecated("set.add", function push(feature) set.add(this, feature));
this.features.push = deprecated("Set.add", function push(feature) Set.add(this, feature));
if (util.haveGecko("2b"))
set.add(this.features, "Gecko2");
Set.add(this.features, "Gecko2");
this.timeout(function () {
services["dactyl:"].pages.dtd = function () [null, util.makeDTD(config.dtd)];
@@ -142,10 +142,10 @@ var ConfigBase = Class("ConfigBase", {
* @returns {string}
*/
bestLocale: function (list) {
let langs = set(list);
let langs = Set(list);
return values([this.appLocale, this.appLocale.replace(/-.*/, ""),
"en", "en-US", iter(langs).next()])
.nth(function (l) set.has(langs, l), 0);
.nth(function (l) Set.has(langs, l), 0);
},
/**

View File

@@ -162,7 +162,7 @@ var Contexts = Module("contexts", {
{ _hive: { value: name } })));
memoize(contexts.groupsProto, name,
function () [group[name] for (group in values(this.groups)) if (set.has(group, name))]);
function () [group[name] for (group in values(this.groups)) if (Set.has(group, name))]);
},
get toStringParams() [this.name, this.Hive]
@@ -180,10 +180,10 @@ var Contexts = Module("contexts", {
0);
let contextPath = file.path;
let self = set.has(plugins, contextPath) && plugins.contexts[contextPath];
let self = Set.has(plugins, contextPath) && plugins.contexts[contextPath];
if (self) {
if (set.has(self, "onUnload"))
if (Set.has(self, "onUnload"))
self.onUnload();
}
else {
@@ -294,7 +294,7 @@ var Contexts = Module("contexts", {
initializedGroups: function (hive)
let (need = hive ? [hive] : Object.keys(this.hives))
this.groupList.filter(function (group) need.some(set.has(group))),
this.groupList.filter(function (group) need.some(Set.has(group))),
addGroup: function addGroup(name, description, filter, persist, replace) {
let group = this.getGroup(name);
@@ -350,7 +350,7 @@ var Contexts = Module("contexts", {
getGroup: function getGroup(name, hive) {
if (name === "default")
var group = this.context && this.context.context && this.context.context.GROUP;
else if (set.has(this.groupMap, name))
else if (Set.has(this.groupMap, name))
group = this.groupMap[name];
if (group && hive)
@@ -512,7 +512,7 @@ var Contexts = Module("contexts", {
util.assert(!group.builtin ||
!["-description", "-locations", "-nopersist"]
.some(set.has(args.explicitOpts)),
.some(Set.has(args.explicitOpts)),
_("group.cantModifyBuiltin"));
},
{

View File

@@ -86,10 +86,10 @@ var Download = Class("Download", {
})),
command: function command(name) {
util.assert(set.has(this.allowedCommands, name), _("download.unknownCommand"));
util.assert(Set.has(this.allowedCommands, name), _("download.unknownCommand"));
util.assert(this.allowedCommands[name], _("download.commandNotAllowed"));
if (set.has(this.commands, name))
if (Set.has(this.commands, name))
this.commands[name].call(this);
else
services.downloadManager[name + "Download"](this.id);
@@ -446,7 +446,7 @@ var Downloads = Module("downloads", {
},
completer: function (context, extra) {
let seen = set.has(set(extra.values.map(function (val) val.substr(1))));
let seen = Set.has(Set(extra.values.map(function (val) val.substr(1))));
context.completions = iter(this.values).filter(function ([k, v]) !seen(k))
.map(function ([k, v]) [["+" + k, [v, " (", _("sort.ascending"), ")"].join("")],
@@ -458,8 +458,8 @@ var Downloads = Module("downloads", {
validator: function (value) {
let seen = {};
return value.every(function (val) /^[+-]/.test(val) && set.has(this.values, val.substr(1))
&& !set.add(seen, val.substr(1)),
return value.every(function (val) /^[+-]/.test(val) && Set.has(this.values, val.substr(1))
&& !Set.add(seen, val.substr(1)),
this) && value.length;
}
});

View File

@@ -71,22 +71,22 @@ var JavaScript = Module("javascript", {
if (obj == null)
return;
let seen = isinstance(obj, ["Sandbox"]) ? set(JavaScript.magicalNames) : {};
let seen = isinstance(obj, ["Sandbox"]) ? Set(JavaScript.magicalNames) : {};
let globals = values(toplevel && this.window === obj ? this.globalNames : []);
if (toplevel && isObject(obj) && "wrappedJSObject" in obj)
if (!set.add(seen, "wrappedJSObject"))
if (!Set.add(seen, "wrappedJSObject"))
yield "wrappedJSObject";
for (let key in iter(globals, properties(obj, !toplevel, true)))
if (!set.add(seen, key))
if (!Set.add(seen, key))
yield key;
// Properties aren't visible in an XPCNativeWrapper until
// they're accessed.
for (let key in properties(this.getKey(obj, "wrappedJSObject"), !toplevel, true))
try {
if (key in obj && !set.has(seen, key))
if (key in obj && !Set.has(seen, key))
yield key;
}
catch (e) {}

View File

@@ -45,7 +45,7 @@ var Messages = Module("messages", {
let seen = {};
for (let { key } in this.iterate()) {
if (!set.add(seen, key))
if (!Set.add(seen, key))
this._[key] = this[key] = {
__noSuchMethod__: function __(prop, args) self._.apply(self, [prop].concat(args))
};
@@ -95,7 +95,7 @@ var Messages = Module("messages", {
return { configurable: true, enumerable: true, value: this.default, writable: true };
*/
if (!set.has(obj, "localizedProperties"))
if (!Set.has(obj, "localizedProperties"))
obj.localizedProperties = { __proto__: obj.localizedProperties };
obj.localizedProperties[prop] = true;

View File

@@ -54,7 +54,7 @@ var Option = Class("Option", {
if (extraInfo)
this.update(extraInfo);
if (set.has(this.modules.config.defaults, this.name))
if (Set.has(this.modules.config.defaults, this.name))
defaultValue = this.modules.config.defaults[this.name];
if (defaultValue !== undefined) {
@@ -621,7 +621,7 @@ var Option = Class("Option", {
function uniq(ary) {
let seen = {};
return ary.filter(function (elem) !set.add(seen, elem));
return ary.filter(function (elem) !Set.add(seen, elem));
}
switch (operator) {
@@ -631,11 +631,11 @@ var Option = Class("Option", {
// NOTE: Vim doesn't prepend if there's a match in the current value
return uniq(Array.concat(values, this.value), true);
case "-":
return this.value.filter(function (item) !set.has(this, item), set(values));
return this.value.filter(function (item) !Set.has(this, item), Set(values));
case "=":
if (invert) {
let keepValues = this.value.filter(function (item) !set.has(this, item), set(values));
let addValues = values.filter(function (item) !set.has(this, item), set(this.value));
let keepValues = this.value.filter(function (item) !Set.has(this, item), Set(values));
let addValues = values.filter(function (item) !Set.has(this, item), Set(this.value));
return addValues.concat(keepValues);
}
return values;
@@ -689,12 +689,12 @@ var Option = Class("Option", {
}
if (isArray(acceptable))
acceptable = set(acceptable.map(function ([k]) k));
acceptable = Set(acceptable.map(function ([k]) k));
if (this.type === "regexpmap" || this.type === "sitemap")
return Array.concat(values).every(function (re) set.has(acceptable, re.result));
return Array.concat(values).every(function (re) Set.has(acceptable, re.result));
return Array.concat(values).every(set.has(acceptable));
return Array.concat(values).every(Set.has(acceptable));
},
types: {}
@@ -1026,12 +1026,12 @@ var Options = Module("options", {
let list = [];
function flushList() {
let names = set(list.map(function (opt) opt.option ? opt.option.name : ""));
let names = Set(list.map(function (opt) opt.option ? opt.option.name : ""));
if (list.length)
if (list.some(function (opt) opt.all))
options.list(function (opt) !(list[0].onlyNonDefault && opt.isDefault), list[0].scope);
else
options.list(function (opt) set.has(names, opt.name), list[0].scope);
options.list(function (opt) Set.has(names, opt.name), list[0].scope);
list = [];
}
@@ -1200,12 +1200,12 @@ var Options = Module("options", {
// Fill in the current values if we're removing
if (opt.operator == "-" && isArray(opt.values)) {
let have = set([i.text for (i in values(context.allItems.items))]);
let have = Set([i.text for (i in values(context.allItems.items))]);
context = context.fork("current-values", 0);
context.anchored = optcontext.anchored;
context.maxItems = optcontext.maxItems;
context.filters.push(function (i) !set.has(have, i.text));
context.filters.push(function (i) !Set.has(have, i.text));
modules.completion.optionValue(context, opt.name, opt.operator, null,
function (context) {
context.generate = function () option.value.map(function (o) [o, ""]);
@@ -1251,7 +1251,7 @@ var Options = Module("options", {
util.assert(scope == "g:" || scope == null,
_("command.let.illegalVar", scope + name));
util.assert(set.has(globalVariables, name) || (expr && !op),
util.assert(Set.has(globalVariables, name) || (expr && !op),
_("command.let.undefinedVar", fullName));
if (!expr)
@@ -1349,7 +1349,7 @@ var Options = Module("options", {
function (args) {
for (let [, name] in args) {
name = name.replace(/^g:/, ""); // throw away the scope prefix
if (!set.has(dactyl._globalVariables, name)) {
if (!Set.has(dactyl._globalVariables, name)) {
if (!args.bang)
dactyl.echoerr(_("command.let.noSuch", name));
return;

View File

@@ -206,8 +206,8 @@ var Overlay = Module("Overlay", {
const start = Date.now();
const deferredInit = { load: {} };
const seen = set();
const loaded = set();
const seen = Set();
const loaded = Set();
modules.loaded = loaded;
function load(module, prereq, frame) {
@@ -222,7 +222,7 @@ var Overlay = Module("Overlay", {
return;
if (module.className in seen)
throw Error("Module dependency loop.");
set.add(seen, module.className);
Set.add(seen, module.className);
for (let dep in values(module.requires))
load(Module.constructors[dep], module.className);
@@ -275,9 +275,9 @@ var Overlay = Module("Overlay", {
});
}
defineModule.modules.forEach(function defModule(mod) {
let names = set(Object.keys(mod.INIT));
let names = Set(Object.keys(mod.INIT));
if ("init" in mod.INIT)
set.add(names, "init");
Set.add(names, "init");
keys(names).forEach(function (name) { deferInit(name, mod.INIT, mod); });
});

View File

@@ -245,7 +245,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(function (e) "clear-" + e));
if (params.action)
storage.addObserver("sanitizer",
function (key, event, arg) {
@@ -595,7 +595,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
get values() values(sanitizer.itemMap).toArray(),
has: modules.Option.has.toggleAll,
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))
});
options.add(["sanitizeshutdown", "ss"],
@@ -613,10 +613,10 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
sanitizer.runAtShutdown = false;
else {
sanitizer.runAtShutdown = true;
let have = set(value);
let have = Set(value);
for (let item in values(sanitizer.itemMap))
prefs.set(item.shutdownPref,
Boolean(set.has(have, item.name) ^ set.has(have, "all")));
Boolean(Set.has(have, item.name) ^ Set.has(have, "all")));
}
return value;
}

View File

@@ -174,7 +174,7 @@ var Services = Module("Services", {
*
* @param {string} name The service's cache key.
*/
has: function (name) set.has(this.services, name) && this.services[name].class in Cc &&
has: function (name) Set.has(this.services, name) && this.services[name].class in Cc &&
this.services[name].interfaces.every(function (iface) iface in Ci)
}, {
}, {

View File

@@ -256,7 +256,7 @@ var Styles = Module("Styles", {
services["dactyl:"].providers["style"] = function styleProvider(uri) {
let id = /^\/(\d*)/.exec(uri.path)[1];
if (set.has(styles.allSheets, id))
if (Set.has(styles.allSheets, id))
return ["text/css", styles.allSheets[id].fullCSS];
return null;
};

View File

@@ -119,7 +119,7 @@ var Template = Module("Template", {
"click": function onClick(event) {
event.preventDefault();
if (this.commandAllowed) {
if (set.has(this.target.commands || {}, this.command))
if (Set.has(this.target.commands || {}, this.command))
this.target.commands[this.command].call(this.target);
else
this.target.command(this.command);
@@ -128,7 +128,7 @@ var Template = Module("Template", {
},
get commandAllowed() {
if (set.has(this.target.allowedCommands || {}, this.command))
if (Set.has(this.target.allowedCommands || {}, this.command))
return this.target.allowedCommands[this.command];
if ("commandAllowed" in this.target)
return this.target.commandAllowed(this.command);
@@ -213,7 +213,7 @@ var Template = Module("Template", {
else if (/^n_/.test(topic))
topic = topic.slice(2);
if (services["dactyl:"].initialized && !set.has(services["dactyl:"].HELP_TAGS, topic))
if (services["dactyl:"].initialized && !Set.has(services["dactyl:"].HELP_TAGS, topic))
return <span highlight={type || ""}>{text || token}</span>;
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
@@ -233,7 +233,7 @@ var Template = Module("Template", {
else if (/^n_/.test(topic))
topic = topic.slice(2);
if (services["dactyl:"].initialized && !set.has(services["dactyl:"].HELP_TAGS, topic))
if (services["dactyl:"].initialized && !Set.has(services["dactyl:"].HELP_TAGS, topic))
return <>{token}</>;
XML.ignoreWhitespace = false; XML.prettyPrinting = false;

View File

@@ -120,7 +120,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
obj.observers = obj.observe;
function register(meth) {
for (let target in set(["dactyl-cleanup-modules", "quit-application"].concat(Object.keys(obj.observers))))
for (let target in Set(["dactyl-cleanup-modules", "quit-application"].concat(Object.keys(obj.observers))))
try {
services.observer[meth](obj, target, true);
}
@@ -404,7 +404,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
}
else {
let [, flags, name] = /^((?:[a-z]-)*)(.*)/.exec(macro);
flags = set(flags);
flags = Set(flags);
let quote = util.identity;
if (flags.q)
@@ -412,18 +412,18 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
if (flags.e)
quote = function quote(obj) "";
if (set.has(defaults, name))
if (Set.has(defaults, name))
stack.top.elements.push(quote(defaults[name]));
else {
if (idx) {
idx = Number(idx) - 1;
stack.top.elements.push(update(
function (obj) obj[name] != null && idx in obj[name] ? quote(obj[name][idx]) : set.has(obj, name) ? "" : unknown(full),
function (obj) obj[name] != null && idx in obj[name] ? quote(obj[name][idx]) : Set.has(obj, name) ? "" : unknown(full),
{ test: function (obj) obj[name] != null && idx in obj[name] && obj[name][idx] !== false && (!flags.e || obj[name][idx] != "") }));
}
else {
stack.top.elements.push(update(
function (obj) obj[name] != null ? quote(obj[name]) : set.has(obj, name) ? "" : unknown(full),
function (obj) obj[name] != null ? quote(obj[name]) : Set.has(obj, name) ? "" : unknown(full),
{ test: function (obj) obj[name] != null && obj[name] !== false && (!flags.e || obj[name] != "") }));
}
@@ -678,7 +678,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* The set of input element type attribute values that mark the element as
* an editable field.
*/
editableInputs: set(["date", "datetime", "datetime-local", "email", "file",
editableInputs: Set(["date", "datetime", "datetime-local", "email", "file",
"month", "number", "password", "range", "search",
"tel", "text", "time", "url", "week"]),
@@ -1451,7 +1451,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
elems.push(encode(field.name, field.value));
for (let [, elem] in iter(form.elements)) {
if (set.has(util.editableInputs, elem.type)
if (Set.has(util.editableInputs, elem.type)
|| /^(?:hidden|textarea)$/.test(elem.type)
|| elem.checked && /^(?:checkbox|radio)$/.test(elem.type))
elems.push(encode(elem.name, elem.value, elem === field));
@@ -1545,7 +1545,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
// Replace replacement <tokens>.
if (tokens)
expr = String.replace(expr, /(\(?P)?<(\w+)>/g, function (m, n1, n2) !n1 && set.has(tokens, n2) ? tokens[n2].dactylSource || tokens[n2].source || tokens[n2] : m);
expr = String.replace(expr, /(\(?P)?<(\w+)>/g, function (m, n1, n2) !n1 && Set.has(tokens, n2) ? tokens[n2].dactylSource || tokens[n2].source || tokens[n2] : m);
// Strip comments and white space.
if (/x/.test(flags))
@@ -1962,7 +1962,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
catch (e) {}
Array.forEach(frame.frames, rec);
})(win);
return res.filter(function (h) !set.add(seen, h));
return res.filter(function (h) !Set.add(seen, h));
},
/**
@@ -1981,7 +1981,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
catch (e) {}
Array.forEach(frame.frames, rec);
})(win);
return res.filter(function (h) !set.add(seen, h.spec));
return res.filter(function (h) !Set.add(seen, h.spec));
},
/**