mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-28 05:52:27 +01:00
Remove unnecessary use of values() when iterating over arrays.
This commit is contained in:
@@ -172,7 +172,7 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, {
|
||||
* @param {Array} modes List of modes.
|
||||
*/
|
||||
clear: function (modes) {
|
||||
for (let mode of values(modes)) {
|
||||
for (let mode of modes) {
|
||||
for (let abbr of values(this._store[mode]))
|
||||
abbr.removeMode(mode);
|
||||
delete this._store[mode];
|
||||
|
||||
@@ -38,7 +38,7 @@ var AutoCmdHive = Class("AutoCmdHive", Contexts.Hive, {
|
||||
if (!callable(pattern))
|
||||
pattern = Group.compileFilter(pattern);
|
||||
|
||||
for (let event of values(events))
|
||||
for (let event of events)
|
||||
this._store.push(AutoCommand(event, pattern, cmd));
|
||||
},
|
||||
|
||||
@@ -144,10 +144,10 @@ var AutoCommands = Module("autocommands", {
|
||||
var { uri, doc } = buffer;
|
||||
|
||||
event = event.toLowerCase();
|
||||
for (let hive of values(this.matchingHives(uri, doc))) {
|
||||
for (let hive of this.matchingHives(uri, doc)) {
|
||||
let args = hive.makeArgs(doc, null, arguments[1]);
|
||||
|
||||
for (let autoCmd of values(hive._store))
|
||||
for (let autoCmd of hive._store)
|
||||
if (autoCmd.eventName === event && autoCmd.filter(uri, doc)) {
|
||||
if (!lastPattern || lastPattern !== String(autoCmd.filter))
|
||||
dactyl.echomsg(_("autocmd.executing", event, autoCmd.filter), 8);
|
||||
|
||||
@@ -160,7 +160,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
let oldURI = overlay.getData(win.document)["uri"];
|
||||
if (overlay.getData(win.document)["load-idx"] === webProgress.loadedTransIndex
|
||||
|| !oldURI || uri.spec.replace(/#.*/, "") !== oldURI.replace(/#.*/, ""))
|
||||
for (let frame of values(buffer.allFrames(win)))
|
||||
for (let frame of buffer.allFrames(win))
|
||||
overlay.setData(frame.document, "focus-allowed", false);
|
||||
|
||||
overlay.setData(win.document, "uri", uri.spec);
|
||||
|
||||
@@ -635,7 +635,7 @@ var CommandLine = Module("commandline", {
|
||||
},
|
||||
|
||||
hideCompletions: function hideCompletions() {
|
||||
for (let nodeSet of values([this.widgets.statusbar, this.widgets.commandbar]))
|
||||
for (let nodeSet of [this.widgets.statusbar, this.widgets.commandbar])
|
||||
if (nodeSet.commandline.completionList)
|
||||
nodeSet.commandline.completionList.visible = false;
|
||||
},
|
||||
@@ -2090,7 +2090,7 @@ var ItemList = Class("ItemList", {
|
||||
updateOffsets: function updateOffsets() {
|
||||
let total = this.itemCount;
|
||||
let count = 0;
|
||||
for (let group of values(this.activeGroups)) {
|
||||
for (let group of this.activeGroups) {
|
||||
group.offsets = { start: count, end: total - count - group.itemCount };
|
||||
count += group.itemCount;
|
||||
}
|
||||
@@ -2105,7 +2105,8 @@ var ItemList = Class("ItemList", {
|
||||
|
||||
let container = DOM(this.nodes.completions);
|
||||
let groups = this.activeGroups;
|
||||
for (let group of values(groups)) {
|
||||
|
||||
for (let group of groups) {
|
||||
group.reset();
|
||||
container.append(group.nodes.root);
|
||||
}
|
||||
@@ -2148,7 +2149,7 @@ var ItemList = Class("ItemList", {
|
||||
* @private
|
||||
*/
|
||||
draw: function draw() {
|
||||
for (let group of values(this.activeGroups))
|
||||
for (let group of this.activeGroups)
|
||||
group.draw();
|
||||
|
||||
// We need to collect all of the rescrolling functions in
|
||||
|
||||
@@ -47,7 +47,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
},
|
||||
|
||||
cleanup: function () {
|
||||
for (let cleanup of values(this.cleanups))
|
||||
for (let cleanup of this.cleanups)
|
||||
cleanup.call(this);
|
||||
|
||||
delete window.dactyl;
|
||||
@@ -87,7 +87,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
"dactyl-cleanup": function dactyl_cleanup(subject, reason) {
|
||||
let modules = dactyl.modules;
|
||||
|
||||
for (let mod of values(modules.moduleList.reverse())) {
|
||||
for (let mod of modules.moduleList.reverse()) {
|
||||
mod.stale = true;
|
||||
if ("cleanup" in mod)
|
||||
this.trapErrors("cleanup", mod, reason);
|
||||
@@ -97,7 +97,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
modules.moduleManager.initDependencies("cleanup");
|
||||
|
||||
for (let name of values(Object.getOwnPropertyNames(modules).reverse()))
|
||||
for (let name of Object.getOwnPropertyNames(modules).reverse())
|
||||
try {
|
||||
delete modules[name];
|
||||
}
|
||||
@@ -272,7 +272,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
let results = Ary((params.iterateIndex || params.iterate).call(params, commands.get(name).newArgs()))
|
||||
.array.sort((a, b) => String.localeCompare(a.name, b.name));
|
||||
|
||||
for (let obj of values(results)) {
|
||||
for (let obj of results) {
|
||||
let res = dactyl.generateHelp(obj, null, null, true);
|
||||
if (!hasOwnProperty(help.tags, obj.helpTag))
|
||||
res[0][1].tag = obj.helpTag;
|
||||
@@ -1402,7 +1402,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
.flatten(),
|
||||
|
||||
setter: function (value) {
|
||||
for (let group of values(groups))
|
||||
for (let group of groups)
|
||||
group.setter(value);
|
||||
events.checkFocus();
|
||||
return value;
|
||||
@@ -1991,7 +1991,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
// after sourcing the initialization files, this function will set
|
||||
// all gui options to their default values, if they have not been
|
||||
// set before by any RC file
|
||||
for (let option of values(options.needInit))
|
||||
for (let option of options.needInit)
|
||||
option.initValue();
|
||||
|
||||
if (dactyl.commandLineOptions.postCommands)
|
||||
|
||||
@@ -447,7 +447,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
if (!keepFocus)
|
||||
dactyl.focus(textBox);
|
||||
|
||||
for (let group of values(blink.concat(blink, ""))) {
|
||||
for (let group of blink.concat(blink, "")) {
|
||||
highlight.highlightNode(textBox, origGroup + " " + group);
|
||||
|
||||
yield promises.sleep(100);
|
||||
|
||||
@@ -375,7 +375,7 @@ var Events = Module("events", {
|
||||
|
||||
for (let evt_obj of DOM.Event.parse(keys)) {
|
||||
let key = DOM.Event.stringify(evt_obj);
|
||||
for (let type of values(["keydown", "keypress", "keyup"])) {
|
||||
for (let type of ["keydown", "keypress", "keyup"]) {
|
||||
let evt = update({}, evt_obj, { type: type });
|
||||
if (type !== "keypress" && !evt.keyCode)
|
||||
evt.keyCode = evt._keyCode || 0;
|
||||
@@ -480,7 +480,7 @@ var Events = Module("events", {
|
||||
let needed = { ctrlKey: event.ctrlKey, altKey: event.altKey, shiftKey: event.shiftKey, metaKey: event.metaKey };
|
||||
|
||||
let modifiers = (key.getAttribute("modifiers") || "").trim().split(/[\s,]+/);
|
||||
for (let modifier of values(modifiers))
|
||||
for (let modifier of modifiers)
|
||||
switch (modifier) {
|
||||
case "access": update(keys, access); break;
|
||||
case "accel": keys[accel] = true; break;
|
||||
@@ -780,7 +780,7 @@ var Events = Module("events", {
|
||||
if (this.feedingKeys)
|
||||
this.duringFeed = this.duringFeed.concat(duringFeed);
|
||||
else
|
||||
for (let event of values(duringFeed))
|
||||
for (let event of duringFeed)
|
||||
try {
|
||||
DOM.Event.dispatch(event.originalTarget, event, event);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ var ProcessorStack = Class("ProcessorStack", {
|
||||
// those waiting on further arguments. Execute actions as
|
||||
// long as they continue to return PASS.
|
||||
|
||||
for (var action of values(this.actions)) {
|
||||
for (var action of this.actions) {
|
||||
while (callable(action)) {
|
||||
length = action.eventLength;
|
||||
action = dactyl.trapErrors(action);
|
||||
@@ -196,14 +196,14 @@ var ProcessorStack = Class("ProcessorStack", {
|
||||
this._actions = actions;
|
||||
this.actions = actions.concat(this.actions);
|
||||
|
||||
for (let action of values(actions))
|
||||
for (let action of actions)
|
||||
if (!("eventLength" in action))
|
||||
action.eventLength = this.events.length;
|
||||
|
||||
if (result === Events.KILL)
|
||||
this.actions = [];
|
||||
else if (!this.actions.length && !processors.length)
|
||||
for (let input of values(this.processors))
|
||||
for (let input of this.processors)
|
||||
if (input.fallthrough) {
|
||||
if (result === Events.KILL)
|
||||
break;
|
||||
|
||||
@@ -201,7 +201,7 @@ var MapHive = Class("MapHive", Contexts.Hive, {
|
||||
for (let mode of map.modes)
|
||||
this.remove(mode, name);
|
||||
|
||||
for (let mode of values(map.modes))
|
||||
for (let mode of map.modes)
|
||||
this.getStack(mode).add(map);
|
||||
return map;
|
||||
},
|
||||
@@ -301,7 +301,7 @@ var MapHive = Class("MapHive", Contexts.Hive, {
|
||||
};
|
||||
|
||||
for (let map of this)
|
||||
for (let name of values(map.keys)) {
|
||||
for (let name of map.keys) {
|
||||
states.mappings[name] = map;
|
||||
let state = "";
|
||||
for (let key of DOM.Event.iterKeys(name)) {
|
||||
@@ -674,7 +674,7 @@ var Mappings = Module("mappings", {
|
||||
let mapmodes = Ary.uniq(args["-modes"].map(findMode));
|
||||
|
||||
let found = 0;
|
||||
for (let mode of values(mapmodes))
|
||||
for (let mode of mapmodes)
|
||||
if (args.bang)
|
||||
args["-group"].clear(mode);
|
||||
else if (args["-group"].has(mode, args[0])) {
|
||||
@@ -707,13 +707,13 @@ var Mappings = Module("mappings", {
|
||||
type: CommandOption.STRING,
|
||||
validator: function (value) Array.concat(value).every(findMode),
|
||||
completer: function () [[Ary.compact([mode.name.toLowerCase().replace(/_/g, "-"), mode.char]), mode.description]
|
||||
for (mode of values(modes.all))
|
||||
for (mode of modes.all)
|
||||
if (!mode.hidden)]
|
||||
};
|
||||
|
||||
function findMode(name) {
|
||||
if (name)
|
||||
for (let mode of values(modes.all))
|
||||
for (let mode of modes.all)
|
||||
if (name == mode || name == mode.char
|
||||
|| String.toLowerCase(name).replace(/-/g, "_") == mode.name.toLowerCase())
|
||||
return mode;
|
||||
@@ -762,7 +762,7 @@ var Mappings = Module("mappings", {
|
||||
for (let [i, mode] of iter(modes))
|
||||
for (let hive of mappings.hives.iterValues())
|
||||
for (let map of Ary.iterValues(hive.getStack(mode)))
|
||||
for (let name of values(map.names))
|
||||
for (let name of map.names)
|
||||
if (!seen.add(name))
|
||||
yield {
|
||||
name: name,
|
||||
|
||||
@@ -150,7 +150,7 @@ var Modes = Module("modes", {
|
||||
dactyl.focusContent(true);
|
||||
if (prev.main == modes.NORMAL) {
|
||||
dactyl.focusContent(true);
|
||||
for (let frame of values(buffer.allFrames())) {
|
||||
for (let frame of buffer.allFrames()) {
|
||||
// clear any selection made
|
||||
let selection = frame.getSelection();
|
||||
if (selection && !selection.isCollapsed)
|
||||
@@ -539,15 +539,15 @@ var Modes = Module("modes", {
|
||||
|
||||
let tree = {};
|
||||
|
||||
for (let mode of values(list))
|
||||
for (let mode of list)
|
||||
tree[mode.name] = {};
|
||||
|
||||
for (let mode of values(list))
|
||||
for (let base of values(mode.bases))
|
||||
for (let mode of list)
|
||||
for (let base of mode.bases)
|
||||
tree[base.name][mode.name] = tree[mode.name];
|
||||
|
||||
let roots = iter([m.name, tree[m.name]]
|
||||
for (m of values(list))
|
||||
for (m of list)
|
||||
if (!m.bases.length)).toObject();
|
||||
|
||||
function rec(obj) {
|
||||
@@ -634,7 +634,7 @@ var Modes = Module("modes", {
|
||||
.every(k => hasOwnProperty(this.values, k)),
|
||||
|
||||
get values() Ary.toObject([[m.name.toLowerCase(), m.description]
|
||||
for (m of values(modes._modes)) if (!m.hidden)])
|
||||
for (m of modes._modes) if (!m.hidden)])
|
||||
};
|
||||
|
||||
options.add(["passunknown", "pu"],
|
||||
|
||||
@@ -95,7 +95,7 @@ var MOW = Module("mow", {
|
||||
|
||||
leave: stack => {
|
||||
if (stack.pop)
|
||||
for (let message of values(this.messages))
|
||||
for (let message of this.messages)
|
||||
if (message.leave)
|
||||
message.leave(stack);
|
||||
},
|
||||
|
||||
@@ -63,7 +63,7 @@ var Tabs = Module("tabs", {
|
||||
cleanup: function cleanup() {
|
||||
for (let tab of this.allTabs) {
|
||||
let node = function node(class_) document.getAnonymousElementByAttribute(tab, "class", class_);
|
||||
for (let elem of values(["dactyl-tab-icon-number", "dactyl-tab-number"].map(node)))
|
||||
for (let elem of ["dactyl-tab-icon-number", "dactyl-tab-number"].map(node))
|
||||
if (elem)
|
||||
elem.parentNode.parentNode.removeChild(elem.parentNode);
|
||||
|
||||
@@ -369,7 +369,7 @@ var Tabs = Module("tabs", {
|
||||
else
|
||||
var matcher = Styles.matchFilter(filter);
|
||||
|
||||
for (let tab of values(tabs[all ? "allTabs" : "visibleTabs"])) {
|
||||
for (let tab of tabs[all ? "allTabs" : "visibleTabs"]) {
|
||||
let browser = tab.linkedBrowser;
|
||||
let uri = browser.currentURI;
|
||||
let title;
|
||||
@@ -719,7 +719,7 @@ var Tabs = Module("tabs", {
|
||||
commands.add(["tabd[o]", "bufd[o]"],
|
||||
"Execute a command in each tab",
|
||||
function (args) {
|
||||
for (let tab of values(tabs.visibleTabs)) {
|
||||
for (let tab of tabs.visibleTabs) {
|
||||
tabs.select(tab);
|
||||
dactyl.execute(args[0], null, true);
|
||||
}
|
||||
@@ -1256,13 +1256,13 @@ var Tabs = Module("tabs", {
|
||||
];
|
||||
options.add(["activate", "act"],
|
||||
"Define when newly created tabs are automatically activated",
|
||||
"stringlist", [g[0] for (g of values(activateGroups.slice(1))) if (!g[2] || !prefs.get("browser.tabs." + g[2]))].join(","),
|
||||
"stringlist", [g[0] for (g of activateGroups.slice(1)) if (!g[2] || !prefs.get("browser.tabs." + g[2]))].join(","),
|
||||
{
|
||||
values: activateGroups,
|
||||
has: Option.has.toggleAll,
|
||||
setter: function (newValues) {
|
||||
let valueSet = new RealSet(newValues);
|
||||
for (let group of values(activateGroups))
|
||||
for (let group of activateGroups)
|
||||
if (group[2])
|
||||
prefs.safeSet("browser.tabs." + group[2],
|
||||
!(valueSet.has("all") ^ valueSet.has(group[0])),
|
||||
|
||||
@@ -54,7 +54,7 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
|
||||
this.remaining = addons;
|
||||
this.upgrade = [];
|
||||
this.dactyl.echomsg(_("addon.check", addons.map(a => a.name).join(", ")));
|
||||
for (let addon of values(addons))
|
||||
for (let addon of addons)
|
||||
addon.findUpdates(this, AddonManager.UPDATE_WHEN_USER_REQUESTED, null, null);
|
||||
|
||||
},
|
||||
|
||||
@@ -377,7 +377,7 @@ deprecated.warn = function warn(func, name, alternative, frame) {
|
||||
* object.
|
||||
*
|
||||
* @param {object} obj The object to inspect.
|
||||
* @returns {Generator}
|
||||
* @returns {Iter}
|
||||
*/
|
||||
function keys(obj) {
|
||||
if (isinstance(obj, ["Map"]))
|
||||
@@ -392,7 +392,7 @@ function keys(obj) {
|
||||
* object.
|
||||
*
|
||||
* @param {object} obj The object to inspect.
|
||||
* @returns {Generator}
|
||||
* @returns {Iter}
|
||||
*/
|
||||
function values(obj) {
|
||||
if (isinstance(obj, ["Map"]))
|
||||
@@ -458,7 +458,7 @@ Object.defineProperty(RealSet.prototype, "union", {
|
||||
this.Set = deprecated("RealSet", function Set(ary) {
|
||||
let obj = {};
|
||||
if (ary)
|
||||
for (let val of values(ary))
|
||||
for (let val of ary)
|
||||
obj[val] = true;
|
||||
return obj;
|
||||
});
|
||||
@@ -1528,7 +1528,7 @@ function iter(obj, iface) {
|
||||
res = Ary.iterItems(obj);
|
||||
else if (obj.constructor instanceof ctypes.StructType)
|
||||
res = (function* () {
|
||||
for (let prop of values(obj.constructor.fields)) {
|
||||
for (let prop of obj.constructor.fields) {
|
||||
let [name, type] = Iterator(prop).next();
|
||||
yield [name, obj[name]];
|
||||
}
|
||||
@@ -1849,7 +1849,7 @@ var Ary = Class("Ary", Array, {
|
||||
* given predicate.
|
||||
*/
|
||||
nth: function nth(ary, pred, n, self) {
|
||||
for (let elem of values(ary))
|
||||
for (let elem of ary)
|
||||
if (pred.call(self, elem) && n-- === 0)
|
||||
return elem;
|
||||
return undefined;
|
||||
|
||||
@@ -125,7 +125,7 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
|
||||
|
||||
get: function (url) {
|
||||
let ids = services.bookmarks.getBookmarkIdsForURI(newURI(url), {});
|
||||
for (let id of values(ids))
|
||||
for (let id of ids)
|
||||
if (id in this.bookmarks)
|
||||
return this.bookmarks[id];
|
||||
return null;
|
||||
|
||||
@@ -525,13 +525,13 @@ var Buffer = Module("Buffer", {
|
||||
Hints.isVisible);
|
||||
|
||||
for (let test of [a, b])
|
||||
for (let regexp of values(regexps))
|
||||
for (let regexp of regexps)
|
||||
for (let i of util.range(res.length, 0, -1))
|
||||
if (test(regexp, res[i]))
|
||||
yield res[i];
|
||||
}
|
||||
|
||||
for (let frame of values(this.allFrames(null, true)))
|
||||
for (let frame of this.allFrames(null, true))
|
||||
for (let elem of followFrame(frame))
|
||||
if (count-- === 0) {
|
||||
if (follow)
|
||||
@@ -2045,7 +2045,7 @@ var Buffer = Module("Buffer", {
|
||||
context.title = ["Stylesheet", "Location"];
|
||||
|
||||
// unify split style sheets
|
||||
let styles = iter([s.title, []] for (s of values(buffer.alternateStyleSheets))).toObject();
|
||||
let styles = iter([s.title, []] for (s of buffer.alternateStyleSheets)).toObject();
|
||||
|
||||
buffer.alternateStyleSheets.forEach(function (style) {
|
||||
styles[style.title].push(style.href || _("style.inline"));
|
||||
@@ -2506,7 +2506,7 @@ var Buffer = Module("Buffer", {
|
||||
{
|
||||
getLine: function getLine(doc, line) {
|
||||
let uri = util.newURI(doc.documentURI);
|
||||
for (let filter of values(this.value))
|
||||
for (let filter of this.value)
|
||||
if (filter(uri, doc)) {
|
||||
if (/^func:/.test(filter.result))
|
||||
var res = dactyl.userEval("(" + Option.dequote(filter.result.substr(5)) + ")")(doc, line);
|
||||
@@ -2613,7 +2613,7 @@ Buffer.addPageInfoSection("e", "Search Engines", function* (verbose) {
|
||||
let n = 1;
|
||||
let nEngines = 0;
|
||||
|
||||
for (let { document: doc } of values(this.allFrames())) {
|
||||
for (let { document: doc } of this.allFrames()) {
|
||||
let engines = DOM("link[href][rel=search][type='application/opensearchdescription+xml']", doc);
|
||||
nEngines += engines.length;
|
||||
|
||||
|
||||
@@ -576,7 +576,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
_("command.wontReplace", name));
|
||||
}
|
||||
|
||||
for (let name of values(names)) {
|
||||
for (let name of names) {
|
||||
ex.__defineGetter__(name, function () this._run(name));
|
||||
if (name in this._map && !this._map[name].isPlaceholder)
|
||||
this.remove(name);
|
||||
@@ -587,7 +587,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
memoize(this._map, name, () => commands.Command(specs, description, action, extra));
|
||||
if (!extra.hidden)
|
||||
memoize(this._list, this._list.length, closure);
|
||||
for (let alias of values(names.slice(1)))
|
||||
for (let alias of names.slice(1))
|
||||
memoize(this._map, alias, closure);
|
||||
|
||||
return name;
|
||||
@@ -647,7 +647,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
|
||||
let cmd = this.get(name);
|
||||
this._list = this._list.filter(c => c !== cmd);
|
||||
for (let name of values(cmd.names))
|
||||
for (let name of cmd.names)
|
||||
delete this._map[name];
|
||||
}
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ var Group = Class("Group", {
|
||||
modifiable: true,
|
||||
|
||||
cleanup: function cleanup(reason) {
|
||||
for (let hive of values(this.hives))
|
||||
for (let hive of this.hives)
|
||||
util.trapErrors("cleanup", hive);
|
||||
|
||||
this.hives = [];
|
||||
@@ -46,7 +46,7 @@ var Group = Class("Group", {
|
||||
this.children.splice(0).forEach(this.contexts.bound.removeGroup);
|
||||
},
|
||||
destroy: function destroy(reason) {
|
||||
for (let hive of values(this.hives))
|
||||
for (let hive of this.hives)
|
||||
util.trapErrors("destroy", hive);
|
||||
|
||||
if (reason != "shutdown")
|
||||
@@ -154,7 +154,7 @@ var Contexts = Module("contexts", {
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
for (let hive of values(this.groupList.slice()))
|
||||
for (let hive of this.groupList.slice())
|
||||
util.trapErrors("destroy", hive, "shutdown");
|
||||
|
||||
for (let plugin of values(this.modules.plugins.contexts)) {
|
||||
@@ -706,7 +706,7 @@ var Contexts = Module("contexts", {
|
||||
arguments: [group.name],
|
||||
ignoreDefaults: true
|
||||
}
|
||||
for (group of values(contexts.initializedGroups()))
|
||||
for (group of contexts.initializedGroups())
|
||||
if (!group.builtin && group.persist)
|
||||
].concat([{ command: this.name, arguments: ["user"] }])
|
||||
});
|
||||
|
||||
@@ -1048,7 +1048,7 @@ var DOM = Class("DOM", {
|
||||
this.code_nativeKey = {};
|
||||
|
||||
for (let list of values(this.keyTable))
|
||||
for (let v of values(list)) {
|
||||
for (let v of list) {
|
||||
if (v.length == 1)
|
||||
v = v.toLowerCase();
|
||||
this.key_key[v.toLowerCase()] = v;
|
||||
@@ -1477,7 +1477,7 @@ var DOM = Class("DOM", {
|
||||
*/
|
||||
compileMatcher: function compileMatcher(list) {
|
||||
let xpath = [], css = [];
|
||||
for (let elem of values(list))
|
||||
for (let elem of list)
|
||||
if (/^xpath:/.test(elem))
|
||||
xpath.push(elem.substr(6));
|
||||
else
|
||||
|
||||
@@ -357,7 +357,7 @@ var DownloadList = Class("DownloadList",
|
||||
let active = downloads.filter(d => d.active);
|
||||
|
||||
let self = Object.create(this);
|
||||
for (let prop of values(["currentBytes", "totalBytes", "speed", "timeRemaining"]))
|
||||
for (let prop of ["currentBytes", "totalBytes", "speed", "timeRemaining"])
|
||||
this[prop] = active.reduce((acc, dl) => dl[prop] + acc, 0);
|
||||
|
||||
this.hasProgress = active.every(d => d.hasProgress);
|
||||
@@ -368,7 +368,7 @@ var DownloadList = Class("DownloadList",
|
||||
|
||||
if (active.length)
|
||||
this.nodes.total.textContent = _("download.nActive", active.length);
|
||||
else for (let key of values(["total", "percent", "speed", "time"]))
|
||||
else for (let key of ["total", "percent", "speed", "time"])
|
||||
this.nodes[key].textContent = "";
|
||||
|
||||
if (this.shouldSort("complete", "size", "speed", "time"))
|
||||
|
||||
@@ -52,7 +52,7 @@ var HelpBuilder = Class("HelpBuilder", {
|
||||
// Find the tags in the document.
|
||||
addTags: function addTags(file, doc) {
|
||||
for (let elem of DOM.XPath("//@tag|//dactyl:tags/text()|//dactyl:tag/text()", doc))
|
||||
for (let tag of values((elem.value || elem.textContent).split(/\s+/)))
|
||||
for (let tag of (elem.value || elem.textContent).split(/\s+/))
|
||||
this.tags[tag] = file;
|
||||
},
|
||||
|
||||
@@ -61,7 +61,7 @@ var HelpBuilder = Class("HelpBuilder", {
|
||||
// Find help and overlay files with the given name.
|
||||
findHelpFile: function findHelpFile(file) {
|
||||
let result = [];
|
||||
for (let base of values(this.bases)) {
|
||||
for (let base of this.bases) {
|
||||
let url = [base, file, ".xml"].join("");
|
||||
let res = util.httpGet(url, { quiet: true });
|
||||
if (res) {
|
||||
@@ -211,7 +211,7 @@ var Help = Module("Help", {
|
||||
flush: function flush(entries, time) {
|
||||
cache.flushEntry("help.json", time);
|
||||
|
||||
for (let entry of values(Array.concat(entries || [])))
|
||||
for (let entry of Array.concat(entries || []))
|
||||
cache.flushEntry(entry, time);
|
||||
},
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ var IO = Module("io", {
|
||||
dactyl.echomsg(_("io.searchingFor", JSON.stringify(paths.join(" ")), modules.options.get("runtimepath").stringValue), 2);
|
||||
|
||||
outer:
|
||||
for (let dir of values(dirs)) {
|
||||
for (let dir of dirs) {
|
||||
for (let path of paths) {
|
||||
let file = dir.child(path);
|
||||
|
||||
@@ -627,7 +627,7 @@ var IO = Module("io", {
|
||||
}
|
||||
else {
|
||||
let dirs = modules.options.get("cdpath").files;
|
||||
for (let dir of values(dirs)) {
|
||||
for (let dir of dirs) {
|
||||
dir = dir.child(arg);
|
||||
|
||||
if (dir.exists() && dir.isDirectory() && dir.isReadable()) {
|
||||
|
||||
@@ -288,7 +288,7 @@ overlay.overlayWindow(Object.keys(config.overlays),
|
||||
if (seen.add(module.className))
|
||||
throw Error("Module dependency loop.");
|
||||
|
||||
for (let dep of values(module.requires))
|
||||
for (let dep of module.requires)
|
||||
this.loadModule(Module.constructors[dep], module.className);
|
||||
|
||||
defineModule.loadLog.push(
|
||||
|
||||
@@ -489,7 +489,7 @@ var Option = Class("Option", {
|
||||
get charlist() this.stringlist,
|
||||
|
||||
regexplist: function regexplist(k, default_=null) {
|
||||
for (let re of values(this.value))
|
||||
for (let re of this.value)
|
||||
if ((re.test || re).call(re, k))
|
||||
return re.result;
|
||||
return default_;
|
||||
@@ -814,7 +814,7 @@ var Option = Class("Option", {
|
||||
|
||||
update(BooleanOption.prototype, {
|
||||
names: Class.Memoize(function ()
|
||||
Ary.flatten([[name, "no" + name] for (name of values(this.realNames))]))
|
||||
Ary.flatten([[name, "no" + name] for (name of this.realNames)]))
|
||||
});
|
||||
|
||||
var OptionHive = Class("OptionHive", Contexts.Hive, {
|
||||
@@ -966,7 +966,7 @@ var Options = Module("options", {
|
||||
memoize(this._optionMap, name,
|
||||
function () Option.types[type](modules, names, description, defaultValue, extraInfo));
|
||||
|
||||
for (let alias of values(names.slice(1)))
|
||||
for (let alias of names.slice(1))
|
||||
memoize(this._optionMap, alias, closure);
|
||||
|
||||
if (extraInfo.setter && (!extraInfo.scope || extraInfo.scope & Option.SCOPE_GLOBAL))
|
||||
@@ -1099,7 +1099,7 @@ var Options = Module("options", {
|
||||
remove: function remove(name) {
|
||||
let opt = this.get(name);
|
||||
this._options = this._options.filter(o => o != opt);
|
||||
for (let name of values(opt.names))
|
||||
for (let name of opt.names)
|
||||
delete this._optionMap[name];
|
||||
},
|
||||
|
||||
@@ -1167,7 +1167,7 @@ var Options = Module("options", {
|
||||
modules.commandline.input(_("pref.prompt.resetAll", config.host) + " ",
|
||||
function (resp) {
|
||||
if (resp == "yes")
|
||||
for (let pref of values(prefs.getNames()))
|
||||
for (let pref of prefs.getNames())
|
||||
prefs.reset(pref);
|
||||
},
|
||||
{ promptHighlight: "WarningMsg" });
|
||||
@@ -1315,7 +1315,7 @@ var Options = Module("options", {
|
||||
|
||||
// Fill in the current values if we're removing
|
||||
if (opt.operator == "-" && isArray(opt.values)) {
|
||||
let have = new RealSet(i.text for (i of values(context.allItems.items)));
|
||||
let have = new RealSet(i.text for (i of context.allItems.items));
|
||||
context = context.fork("current-values", 0);
|
||||
context.anchored = optcontext.anchored;
|
||||
context.maxItems = optcontext.maxItems;
|
||||
@@ -1582,7 +1582,7 @@ var Options = Module("options", {
|
||||
description: "Options containing hostname data",
|
||||
action: function sanitize_action(timespan, host) {
|
||||
if (host)
|
||||
for (let opt of values(modules.options._options))
|
||||
for (let opt of modules.options._options)
|
||||
if (timespan.contains(opt.lastSet * 1000) && opt.domains)
|
||||
try {
|
||||
opt.value = opt.filterDomain(host, opt.value);
|
||||
|
||||
@@ -57,7 +57,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
|
||||
if (this == prefs) {
|
||||
if (~["uninstall", "disable"].indexOf(reason)) {
|
||||
for (let name of values(this.branches.saved.getNames()))
|
||||
for (let name of this.branches.saved.getNames())
|
||||
this.safeReset(name, null, true);
|
||||
|
||||
this.branches.original.resetBranch();
|
||||
|
||||
@@ -20,7 +20,7 @@ var Binding = Class("Binding", {
|
||||
|
||||
Object.defineProperties(node, this.constructor.properties);
|
||||
|
||||
for (let [event, handler] of values(this.constructor.events))
|
||||
for (let [event, handler] of this.constructor.events)
|
||||
node.addEventListener(event, util.wrapCallback(handler, true), false);
|
||||
},
|
||||
|
||||
@@ -74,7 +74,7 @@ var Binding = Class("Binding", {
|
||||
for (let prop of properties(obj)) {
|
||||
let desc = Object.getOwnPropertyDescriptor(obj, prop);
|
||||
if (desc.enumerable) {
|
||||
for (let k of values(["get", "set", "value"]))
|
||||
for (let k of ["get", "set", "value"])
|
||||
if (typeof desc[k] === "function")
|
||||
desc[k] = this.bind(desc[k]);
|
||||
res[prop] = desc;
|
||||
|
||||
@@ -1173,7 +1173,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
"dactyl-cleanup-modules": function cleanupModules(subject, reason) {
|
||||
defineModule.loadLog.push("dactyl: util: observe: dactyl-cleanup-modules " + reason);
|
||||
|
||||
for (let module of values(defineModule.modules))
|
||||
for (let module of defineModule.modules)
|
||||
if (module.cleanup) {
|
||||
util.dump("cleanup: " + module.constructor.className);
|
||||
util.trapErrors(module.cleanup, module, reason);
|
||||
|
||||
Reference in New Issue
Block a user