1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-10 09:44:13 +01:00

Convert expression closures to arrow syntax.

This commit is contained in:
Doug Kearns
2013-09-15 00:42:51 +10:00
parent 6eeb0f50a2
commit 6ee830dfad
53 changed files with 702 additions and 703 deletions

View File

@@ -53,7 +53,7 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
this.remaining = addons;
this.upgrade = [];
this.dactyl.echomsg(_("addon.check", addons.map(function (a) a.name).join(", ")));
this.dactyl.echomsg(_("addon.check", addons.map(a => a.name).join(", ")));
for (let addon in values(addons))
addon.findUpdates(this, AddonManager.UPDATE_WHEN_USER_REQUESTED, null, null);
@@ -64,11 +64,11 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
install.install();
},
onUpdateFinished: function (addon, error) {
this.remaining = this.remaining.filter(function (a) a.type != addon.type || a.id != addon.id);
this.remaining = this.remaining.filter(a => a.type != addon.type || a.id != addon.id);
if (!this.remaining.length)
this.dactyl.echomsg(
this.upgrade.length
? _("addon.installingUpdates", this.upgrade.map(function (i) i.name).join(", "))
? _("addon.installingUpdates", this.upgrade.map(i => i.name).join(", "))
: _("addon.noUpdates"));
}
});
@@ -118,7 +118,7 @@ var actions = {
});
},
get filter() {
return function (addon) !addon.userDisabled &&
return addon => !addon.userDisabled &&
!(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE));
},
perm: "disable"
@@ -302,7 +302,7 @@ var AddonList = Class("AddonList", {
addon = Addon(addon, this);
this.addons[addon.id] = addon;
let index = values(this.addons).sort(function (a, b) a.compare(b))
let index = values(this.addons).sort((a, b) => a.compare(b))
.indexOf(addon);
this.nodes.list.insertBefore(addon.nodes.row,
@@ -343,10 +343,10 @@ var AddonList = Class("AddonList", {
});
var Addons = Module("addons", {
errors: Class.Memoize(function ()
errors: Class.Memoize(() =>
array(["ERROR_NETWORK_FAILURE", "ERROR_INCORRECT_HASH",
"ERROR_CORRUPT_FILE", "ERROR_FILE_ACCESS"])
.map(function (e) [AddonManager[e], _("AddonManager." + e)])
.map(e => [AddonManager[e], _("AddonManager." + e)])
.toObject())
}, {
}, {
@@ -360,7 +360,7 @@ var Addons = Module("addons", {
modules.commandline.echo(addons);
if (modules.commandline.savingOutput)
util.waitFor(function () addons.ready);
util.waitFor(() => addons.ready);
},
{
argCount: "?",
@@ -398,7 +398,7 @@ var Addons = Module("addons", {
}, {
argCount: "1",
completer: function (context) {
context.filters.push(function ({ isdir, text }) isdir || /\.xpi$/.test(text));
context.filters.push(({ isdir, text }) => isdir || /\.xpi$/.test(text));
completion.file(context);
},
literal: 0
@@ -420,7 +420,7 @@ var Addons = Module("addons", {
AddonManager.getAddonsByTypes(args["-types"], dactyl.wrapCallback(function (list) {
if (!args.bang || command.bang) {
list = list.filter(function (addon) addon.id == name || addon.name == name);
list = list.filter(addon => addon.id == name || addon.name == name);
dactyl.assert(list.length, _("error.invalidArgument", name));
dactyl.assert(list.some(ok), _("error.invalidOperation"));
list = list.filter(ok);
@@ -429,14 +429,14 @@ var Addons = Module("addons", {
if (command.actions)
command.actions(list, this.modules);
else
list.forEach(function (addon) command.action.call(this.modules, addon, args.bang), this);
list.forEach(addon => command.action.call(this.modules, addon, args.bang));
}));
}, {
argCount: "?", // FIXME: should be "1"
bang: true,
completer: function (context, args) {
completion.addon(context, args["-types"]);
context.filters.push(function ({ item }) ok(item));
context.filters.push(({ item }) => ok(item));
},
literal: 0,
options: [
@@ -455,7 +455,7 @@ var Addons = Module("addons", {
completion.addonType = function addonType(context) {
let base = ["extension", "theme"];
function update(types) {
context.completions = types.map(function (t) [t, util.capitalize(t)]);
context.completions = types.map(t => [t, util.capitalize(t)]);
}
context.generate = function generate() {
@@ -464,7 +464,7 @@ var Addons = Module("addons", {
context.incomplete = true;
AddonManager.getAllAddons(function (addons) {
context.incomplete = false;
update(array.uniq(base.concat(addons.map(function (a) a.type)),
update(array.uniq(base.concat(addons.map(a => a.type)),
true));
});
}

View File

@@ -20,13 +20,13 @@ let { __lookupGetter__, __lookupSetter__, __defineGetter__, __defineSetter__,
if (typeof XPCSafeJSObjectWrapper === "undefined")
this.XPCSafeJSObjectWrapper = XPCNativeWrapper;
let getGlobalForObject = Cu.getGlobalForObject || function (obj) obj.__parent__;
let getGlobalForObject = Cu.getGlobalForObject || (obj => obj.__parent__);
function require(module, target) JSMLoader.load(module, target);
function lazyRequire(module, names, target) {
for each (let name in names)
memoize(target || this, name, function (name) require(module)[name]);
memoize(target || this, name, name => require(module)[name]);
}
let jsmodules = { lazyRequire: lazyRequire };
@@ -167,7 +167,7 @@ function literal(/* comment */) {
// Later...
return cache.get(key, function () {
let source = cache.get("literal:" + file,
function () util.httpGet(file).responseText);
() => util.httpGet(file).responseText);
let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" +
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
@@ -271,7 +271,7 @@ function iterOwnProperties(obj) {
function deprecated(alternative, fn) {
if (isObject(fn))
return Class.Property(iter(fn).map(function ([k, v]) [k, callable(v) ? deprecated(alternative, v) : v])
return Class.Property(iter(fn).map(([k, v]) => [k, callable(v) ? deprecated(alternative, v) : v])
.toObject());
let name, func = callable(fn) ? fn : function () this[fn].apply(this, arguments);
@@ -441,7 +441,7 @@ function curry(fn, length, self, acc) {
return fn;
// Close over function with 'this'
function close(self, fn) function () fn.apply(self, arguments);
function close(self, fn) () => fn.apply(self, arguments);
if (acc == null)
acc = [];
@@ -858,7 +858,7 @@ Class.Memoize = function Memoize(getter, wait)
Object.defineProperty(obj, key, {
configurable: true, enumerable: false,
get: function get() {
util.waitFor(function () done);
util.waitFor(() => done);
return this[key];
}
});
@@ -924,19 +924,19 @@ Class.prototype = {
set instance(val) Class.replaceProperty(this, "instance", val),
withSavedValues: function withSavedValues(names, callback, self) {
let vals = names.map(function (name) this[name], this);
let vals = names.map(name => this[name]);
try {
return callback.call(self || this);
}
finally {
names.forEach(function (name, i) this[name] = vals[i], this);
names.forEach((name, i) => this[name] = vals[i]);
}
},
toString: function C_toString() {
if (this.toStringParams)
var params = "(" + this.toStringParams.map(function (m) isArray(m) ? "[" + m + "]" :
isString(m) ? m.quote() : String(m))
var params = "(" + this.toStringParams.map(m => isArray(m) ? "[" + m + "]" :
isString(m) ? m.quote() : String(m))
.join(", ") + ")";
return "[instance " + this.constructor.className + (params || "") + "]";
},
@@ -1079,7 +1079,7 @@ function XPCOMShim(interfaces) {
getHelperForLanguage: function () null,
getInterfaces: function (count) { count.value = 0; }
});
return (interfaces || []).reduce(function (shim, iface) shim.QueryInterface(Ci[iface]),
return (interfaces || []).reduce((shim, iface) => shim.QueryInterface(Ci[iface]),
ip.data);
};
let stub = Class.Property({
@@ -1172,7 +1172,7 @@ Module.INIT = {
module.isLocalModule = true;
modules.jsmodules[this.constructor.className] = module;
locals.reverse().forEach(function (fn, i) update(objs[i], fn.apply(module, args)));
locals.reverse().forEach((fn, i) => update(objs[i], fn.apply(module, args)));
memoize(module, "closure", Class.makeClosure);
module.instance = module;
@@ -1205,7 +1205,7 @@ function Struct(...args) {
const Struct = Class(className || "Struct", StructBase, {
length: args.length,
members: array.toObject(args.map(function (v, k) [v, k]))
members: array.toObject(args.map((v, k) => [v, k]))
});
args.forEach(function (name, i) {
Struct.prototype.__defineGetter__(name, function () this[i]);
@@ -1384,7 +1384,7 @@ function octal(decimal) parseInt(decimal, 8);
*/
function iter(obj, iface) {
if (arguments.length == 2 && iface instanceof Ci.nsIJSIID)
return iter(obj).map(function (item) item.QueryInterface(iface));
return iter(obj).map(item => item.QueryInterface(iface));
let args = arguments;
let res = Iterator(obj);
@@ -1521,7 +1521,7 @@ update(iter, {
*/
nth: function nth(iter, pred, n, self) {
if (typeof pred === "number")
[pred, n] = [function () true, pred]; // Hack.
[pred, n] = [() => true, pred]; // Hack.
for (let elem in iter)
if (pred.call(self, elem) && n-- === 0)
@@ -1629,7 +1629,7 @@ var array = Class("array", Array, {
* @param {Array} ary
* @returns {Array}
*/
compact: function compact(ary) ary.filter(function (item) item != null),
compact: function compact(ary) ary.filter(item => item != null),
/**
* Returns true if each element of ary1 is equal to the
@@ -1640,7 +1640,7 @@ var array = Class("array", Array, {
* @returns {boolean}
*/
equals: function (ary1, ary2)
ary1.length === ary2.length && Array.every(ary1, function (e, i) e === ary2[i]),
ary1.length === ary2.length && Array.every(ary1, (e, i) => e === ary2[i]),
/**
* Flattens an array, such that all elements of the array are

View File

@@ -27,7 +27,7 @@ update(Bookmark.prototype, {
get extra() [
["keyword", this.keyword, "Keyword"],
["tags", this.tags.join(", "), "Tag"]
].filter(function (item) item[1]),
].filter(item => item[1]),
get uri() newURI(this.url),
set uri(uri) {
@@ -90,7 +90,7 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
keywords: Class.Memoize(function () array.toObject([[b.keyword, b] for (b in this) if (b.keyword)])),
rootFolders: ["toolbarFolder", "bookmarksMenuFolder", "unfiledBookmarksFolder"]
.map(function (s) services.bookmarks[s]),
.map(s => services.bookmarks[s]),
_deleteBookmark: function deleteBookmark(id) {
let result = this.bookmarks[id] || null;

View File

@@ -61,10 +61,10 @@ var Buffer = Module("Buffer", {
*/
get alternateStyleSheets() {
let stylesheets = array.flatten(
this.allFrames().map(function (w) Array.slice(w.document.styleSheets)));
this.allFrames().map(w => Array.slice(w.document.styleSheets)));
return stylesheets.filter(
function (stylesheet) /^(screen|all|)$/i.test(stylesheet.media.mediaText) && !/^\s*$/.test(stylesheet.title)
s => /^(screen|all|)$/i.test(s.media.mediaText) && !/^\s*$/.test(s.title)
);
},
@@ -142,8 +142,8 @@ var Buffer = Module("Buffer", {
*/
get loaded() Math.min.apply(null,
this.allFrames()
.map(function (frame) ["loading", "interactive", "complete"]
.indexOf(frame.document.readyState))),
.map(frame => ["loading", "interactive", "complete"]
.indexOf(frame.document.readyState))),
/**
* @property {Object} The local state store for the currently selected
@@ -275,8 +275,8 @@ var Buffer = Module("Buffer", {
})(win || this.win);
if (focusedFirst)
return frames.filter(function (f) f === this.focusedFrame, this).concat(
frames.filter(function (f) f !== this.focusedFrame, this));
return frames.filter(f => f === this.focusedFrame).concat(
frames.filter(f => f !== this.focusedFrame));
return frames;
},
@@ -435,7 +435,7 @@ var Buffer = Module("Buffer", {
yield elem;
function a(regexp, elem) regexp.test(elem.textContent) === regexp.result ||
Array.some(elem.childNodes, function (child) regexp.test(child.alt) === regexp.result);
Array.some(elem.childNodes, child => regexp.test(child.alt) === regexp.result);
function b(regexp, elem) regexp.test(elem.title) === regexp.result;
let res = Array.filter(frame.document.querySelectorAll(selector), Hints.isVisible);
@@ -541,7 +541,7 @@ var Buffer = Module("Buffer", {
function getRanges(rect) {
let nodes = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.nodesFromRect(rect.x, rect.y, 0, rect.width, rect.height, 0, false, false);
return Array.filter(nodes, function (n) n instanceof Ci.nsIDOMText)
return Array.filter(nodes, n => n instanceof Ci.nsIDOMText)
.map(RangeFind.nodeContents);
}
@@ -565,11 +565,11 @@ var Buffer = Module("Buffer", {
rect = { x: w / 3, y: 0, width: w / 3, height: win.innerHeight };
}
var reduce = function (a, b) DOM(a).rect.top < DOM(b).rect.top ? a : b;
var reduce = (a, b) => DOM(a).rect.top < DOM(b).rect.top ? a : b;
var dir = "forward";
var y = 0;
if (reverse) {
reduce = function (a, b) DOM(b).rect.bottom > DOM(a).rect.bottom ? b : a;
reduce = (a, b) => DOM(b).rect.bottom > DOM(a).rect.bottom ? b : a;
dir = "backward";
y = win.innerHeight - 1;
}
@@ -904,10 +904,10 @@ var Buffer = Module("Buffer", {
let path = options["jumptags"][arg];
util.assert(path, _("error.invalidArgument", arg));
let distance = reverse ? function (rect) -rect.top : function (rect) rect.top;
let distance = reverse ? rect => -rect.top : rect => rect.top;
let elems = [[e, distance(e.getBoundingClientRect())] for (e in path.matcher(this.focusedFrame.document))]
.filter(function (e) e[1] > FUDGE)
.sort(function (a, b) a[1] - b[1]);
.filter(e => e[1] > FUDGE)
.sort((a, b) => a[1] - b[1]);
if (offScreen && !reverse)
elems = elems.filter(function (e) e[1] > this, this.topWindow.innerHeight);
@@ -941,8 +941,8 @@ var Buffer = Module("Buffer", {
return;
// remove all hidden frames
frames = frames.filter(function (frame) !(frame.document.body instanceof Ci.nsIDOMHTMLFrameSetElement))
.filter(function (frame) !frame.frameElement ||
frames = frames.filter(frame => !(frame.document.body instanceof Ci.nsIDOMHTMLFrameSetElement))
.filter(frame => !frame.frameElement ||
let (rect = frame.frameElement.getBoundingClientRect())
rect.width && rect.height);
@@ -1003,7 +1003,7 @@ var Buffer = Module("Buffer", {
let info = template.map(
(sections || options["pageinfo"])
.map((opt) => Buffer.pageInfo[opt].action.call(this)),
function (res) res && iter(res).join(", ") || undefined,
res => res && iter(res).join(", ") || undefined,
", ").join("");
if (bookmarkcache.isBookmarked(this.URL))
@@ -1443,9 +1443,9 @@ var Buffer = Module("Buffer", {
names.push([decodeURIComponent(url.replace(/.*?([^\/]*)\/*$/, "$1")),
_("buffer.save.filename")]);
return names.filter(function ([leaf, title]) leaf)
.map(function ([leaf, title]) [leaf.replace(config.OS.illegalCharacters, encodeURIComponent)
.replace(re, ext), title]);
return names.filter(([leaf, title]) => leaf)
.map(([leaf, title]) => [leaf.replace(config.OS.illegalCharacters, encodeURIComponent)
.replace(re, ext), title]);
},
findScrollableWindow: deprecated("buffer.findScrollableWindow", function findScrollableWindow()
@@ -1801,7 +1801,7 @@ var Buffer = Module("Buffer", {
function (args) {
let arg = args[0] || "";
let titles = buffer.alternateStyleSheets.map(function (stylesheet) stylesheet.title);
let titles = buffer.alternateStyleSheets.map(sheet => sheet.title);
dactyl.assert(!arg || titles.indexOf(arg) >= 0,
_("error.invalidArgument", arg));
@@ -2206,7 +2206,7 @@ var Buffer = Module("Buffer", {
let frames = buffer.allFrames(null, true);
let elements = array.flatten(frames.map(function (win) [m for (m in DOM.XPath(xpath, win.document))]))
let elements = array.flatten(frames.map(win => [m for (m in DOM.XPath(xpath, win.document))]))
.filter(function (elem) {
if (isinstance(elem, [Ci.nsIDOMHTMLFrameElement,
Ci.nsIDOMHTMLIFrameElement]))
@@ -2388,7 +2388,7 @@ var Buffer = Module("Buffer", {
return vals;
},
validator: function (value) DOM.validateMatcher.call(this, value)
&& Object.keys(value).every(function (v) v.length == 1)
&& Object.keys(value).every(v => v.length == 1)
});
options.add(["linenumbers", "ln"],
@@ -2413,7 +2413,7 @@ var Buffer = Module("Buffer", {
var res = dactyl.userEval("(" + Option.dequote(filter.result.substr(5)) + ")")(doc, line);
else
res = iter.nth(filter.matcher(doc),
function (elem) (elem.nodeValue || elem.textContent).trim() == line && DOM(elem).display != "none",
elem => (elem.nodeValue || elem.textContent).trim() == line && DOM(elem).display != "none",
0)
|| iter.nth(filter.matcher(doc), util.identity, line - 1);
if (res)
@@ -2656,9 +2656,9 @@ Buffer.addPageInfoSection("m", "Meta Tags", function (verbose) {
// get meta tag data, sort and put into pageMeta[]
let metaNodes = this.focusedFrame.document.getElementsByTagName("meta");
return Array.map(metaNodes, function (node) [(node.name || node.httpEquiv),
template.highlightURL(node.content)])
.sort(function (a, b) util.compareIgnoreCase(a[0], b[0]));
return Array.map(metaNodes, node => [(node.name || node.httpEquiv),
template.highlightURL(node.content)])
.sort((a, b) => util.compareIgnoreCase(a[0], b[0]));
});
Buffer.addPageInfoSection("s", "Security", function (verbose) {

View File

@@ -219,7 +219,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
_has: function _has(name) Set.has(this.providers, name) || set.has(this.cache, name),
has: function has(name) [this.globalProviders, this.cache, this.localProviders]
.some(function (obj) Set.has(obj, name)),
.some(obj => Set.has(obj, name)),
register: function register(name, callback, self) {
if (this.isLocal)

View File

@@ -46,9 +46,9 @@ lazyRequire("template", ["template"]);
*/
var CommandOption = Struct("names", "type", "validator", "completer", "multiple", "description", "default");
CommandOption.defaultValue("description", function () "");
CommandOption.defaultValue("type", function () CommandOption.NOARG);
CommandOption.defaultValue("multiple", function () false);
CommandOption.defaultValue("description", () => "");
CommandOption.defaultValue("type", () => CommandOption.NOARG);
CommandOption.defaultValue("multiple", () => false);
var ArgType = Struct("description", "parse");
update(CommandOption, {
@@ -64,7 +64,7 @@ update(CommandOption, {
* @property {object} The option doesn't accept an argument.
* @final
*/
NOARG: ArgType("no arg", function (arg) !arg || null),
NOARG: ArgType("no arg", arg => !arg || null),
/**
* @property {object} The option accepts a boolean argument.
* @final
@@ -74,12 +74,12 @@ update(CommandOption, {
* @property {object} The option accepts a string argument.
* @final
*/
STRING: ArgType("string", function (val) val),
STRING: ArgType("string", val => val),
/**
* @property {object} The option accepts a stringmap argument.
* @final
*/
STRINGMAP: ArgType("stringmap", function (val, quoted) Option.parse.stringmap(quoted)),
STRINGMAP: ArgType("stringmap", (val, quoted) => Option.parse.stringmap(quoted)),
/**
* @property {object} The option accepts an integer argument.
* @final
@@ -221,12 +221,12 @@ var Command = Class("Command", {
parsedSpecs: Class.Memoize(function () Command.parseSpecs(this.specs)),
/** @property {[string]} All of this command's short names, e.g., "com" */
shortNames: Class.Memoize(function () array.compact(this.parsedSpecs.map(function (n) n[1]))),
shortNames: Class.Memoize(function () array.compact(this.parsedSpecs.map(n => n[1]))),
/**
* @property {[string]} All of this command's long names, e.g., "command"
*/
longNames: Class.Memoize(function () this.parsedSpecs.map(function (n) n[0])),
longNames: Class.Memoize(function () this.parsedSpecs.map(n => n[0])),
/** @property {string} The command's canonical name. */
name: Class.Memoize(function () this.longNames[0]),
@@ -309,7 +309,7 @@ var Command = Class("Command", {
_options: [],
optionMap: Class.Memoize(function () array(this.options)
.map(function (opt) opt.names.map(function (name) [name, opt]))
.map(opt => opt.names.map(name => [name, opt]))
.flatten().toObject()),
newArgs: function newArgs(base) {
@@ -409,7 +409,7 @@ var Command = Class("Command", {
}
}, {
hasName: function hasName(specs, name)
specs.some(function ([long, short])
specs.some(([long, short]) =>
name.indexOf(short) == 0 && long.indexOf(name) == 0),
// TODO: do we really need more than longNames as a convenience anyway?
@@ -536,7 +536,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
if (this.cached)
this.modules.initDependencies("commands");
this.cached = false;
return array.iterValues(this._list.sort(function (a, b) a.name > b.name));
return array.iterValues(this._list.sort((a, b) => a.name > b.name));
},
/** @property {string} The last executed Ex command line. */
@@ -570,10 +570,10 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
let name = names[0];
if (this.name != "builtin") {
util.assert(!names.some(function (name) name in commands.builtin._map),
util.assert(!names.some(name => name in commands.builtin._map),
_("command.cantReplace", name));
util.assert(replace || names.every(function (name) !(name in this._map), this),
util.assert(replace || names.every(name => !(name in this._map)),
_("command.wontReplace", name));
}
@@ -585,7 +585,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
let closure = () => this._map[name];
memoize(this._map, name, function () commands.Command(specs, description, action, extra));
memoize(this._map, name, () => commands.Command(specs, description, action, extra));
if (!extra.hidden)
memoize(this._list, this._list.length, closure);
for (let alias in values(names.slice(1)))
@@ -623,11 +623,11 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
*/
get: function get(name, full) {
let cmd = this._map[name]
|| !full && array.nth(this._list, function (cmd) cmd.hasName(name), 0)
|| !full && array.nth(this._list, cmd => cmd.hasName(name), 0)
|| null;
if (!cmd && full) {
let name = array.nth(this.specs, function (spec) Command.hasName(spec, name), 0);
let name = array.nth(this.specs, spec => Command.hasName(spec, name), 0);
return name && this.get(name);
}
@@ -648,7 +648,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
util.assert(this.group.modifiable, _("command.cantDelete"));
let cmd = this.get(name);
this._list = this._list.filter(function (c) c !== cmd);
this._list = this._list.filter(c => c !== cmd);
for (let name in values(cmd.names))
delete this._map[name];
}
@@ -684,7 +684,7 @@ var Commands = Module("commands", {
get allHives() contexts.allGroups.commands,
get userHives() this.allHives.filter(function (h) h !== this.builtin, this),
get userHives() this.allHives.filter(h => h !== this.builtin),
/**
* Executes an Ex command script.
@@ -764,9 +764,9 @@ var Commands = Module("commands", {
return "";
}
// TODO: allow matching of aliases?
function cmds(hive) hive._list.filter(function (cmd) cmd.name.indexOf(filter || "") == 0)
function cmds(hive) hive._list.filter(cmd => cmd.name.indexOf(filter || "") == 0)
let hives = (hives || this.userHives).map(function (h) [h, cmds(h)]).filter(function ([h, c]) c.length);
let hives = (hives || this.userHives).map(h => [h, cmds(h)]).filter(([h, c]) => c.length);
let list = ["table", {},
["tr", { highlight: "Title" },
@@ -778,9 +778,9 @@ var Commands = Module("commands", {
["td", { style: "padding-right: 1ex;" }, _("title.Complete")],
["td", { style: "padding-right: 1ex;" }, _("title.Definition")]],
["col", { style: "min-width: 6em; padding-right: 1em;" }],
hives.map(function ([hive, cmds]) let (i = 0) [
hives.map(([hive, cmds]) => let (i = 0) [
["tr", { style: "height: .5ex;" }],
cmds.map(function (cmd)
cmds.map(cmd =>
["tr", {},
["td", { highlight: "Title" }, !i++ ? hive.name : ""],
["td", {}, cmd.bang ? "!" : " "],
@@ -815,7 +815,7 @@ var Commands = Module("commands", {
/** @property {Iterator(Command)} @private */
iterator: function iterator() iter.apply(null, this.hives.array)
.sort(function (a, b) a.serialGroup - b.serialGroup || a.name > b.name)
.sort((a, b) => a.serialGroup - b.serialGroup || a.name > b.name)
.iterValues(),
/** @property {string} The last executed Ex command line. */
@@ -846,7 +846,7 @@ var Commands = Module("commands", {
let defaults = {};
if (args.ignoreDefaults)
defaults = array(this.options).map(function (opt) [opt.names[0], opt.default])
defaults = array(this.options).map(opt => [opt.names[0], opt.default])
.toObject();
for (let [opt, val] in Iterator(args.options || {})) {
@@ -881,7 +881,7 @@ var Commands = Module("commands", {
* any of the command's names.
* @returns {Command}
*/
get: function get(name, full) iter(this.hives).map(function ([i, hive]) hive.get(name, full))
get: function get(name, full) iter(this.hives).map(([i, hive]) => hive.get(name, full))
.nth(util.identity, 0),
/**
@@ -895,7 +895,7 @@ var Commands = Module("commands", {
hasDomain: function hasDomain(command, host) {
try {
for (let [cmd, args] in this.subCommands(command))
if (Array.concat(cmd.domains(args)).some(function (domain) util.isSubdomain(domain, host)))
if (Array.concat(cmd.domains(args)).some(domain => util.isSubdomain(domain, host)))
return true;
}
catch (e) {
@@ -1016,7 +1016,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(opt => opt.multiple || !Set.has(args, opt.names[0]));
};
let resetCompletions = function resetCompletions() {
completeOpts = null;
@@ -1208,7 +1208,7 @@ var Commands = Module("commands", {
context.filter = args.completeFilter;
if (isArray(arg))
context.filters.push(function (item) arg.indexOf(item.text) === -1);
context.filters.push(item => arg.indexOf(item.text) === -1);
if (typeof opt.completer == "function")
var compl = opt.completer(context, args);
@@ -1394,7 +1394,7 @@ var Commands = Module("commands", {
let quote = null;
let len = str.length;
function fixEscapes(str) str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4}|(.))/g, function (m, n1) n1 || m);
function fixEscapes(str) str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4}|(.))/g, (m, n1) => n1 || m);
// Fix me.
if (isString(sep))
@@ -1436,9 +1436,9 @@ var Commands = Module("commands", {
context.title = ["Command"];
context.keys = { text: "longNames", description: "description" };
if (group)
context.generate = function () group._list;
context.generate = () => group._list;
else
context.generate = function () modules.commands.hives.map(function (h) h._list).flatten();
context.generate = () => modules.commands.hives.map(h => h._list).flatten();
};
// provides completions for ex commands, including their arguments
@@ -1577,7 +1577,7 @@ var Commands = Module("commands", {
};
}
else
completerFunc = function (context) modules.completion.closure[config.completers[completer]](context);
completerFunc = context => modules.completion.closure[config.completers[completer]](context);
}
let added = args["-group"].add(cmd.split(","),
@@ -1662,8 +1662,8 @@ var Commands = Module("commands", {
literal: 1,
serialize: function () array(commands.userHives)
.filter(function (h) h.persist)
.map(function (hive) [
.filter(h => h.persist)
.map(hive => [
{
command: this.name,
bang: true,
@@ -1681,7 +1681,7 @@ var Commands = Module("commands", {
ignoreDefaults: true
}
for (cmd in hive) if (cmd.persist)
], this)
])
.flatten().array
});
@@ -1725,7 +1725,7 @@ var Commands = Module("commands", {
]
})),
iterateIndex: function (args) let (tags = help.tags)
this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || Set.has(tags, cmd.helpTag)),
this.iterate(args).filter(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 : "")),
@@ -1779,7 +1779,7 @@ var Commands = Module("commands", {
let quote = function quote(q, list, map) {
map = map || Commands.quoteMap;
let re = RegExp("[" + list + "]", "g");
function quote(str) q + String.replace(str, re, function ($0) $0 in map ? map[$0] : ("\\" + $0)) + q;
function quote(str) q + String.replace(str, re, $0 => $0 in map ? map[$0] : ("\\" + $0)) + q;
quote.list = list;
return quote;
};

View File

@@ -60,10 +60,10 @@ var CompletionContext = Class("CompletionContext", {
*/
self.parent = parent;
["filters", "keys", "process", "title", "quote"].forEach(function fe(key)
self[key] = parent[key] && util.cloneObject(parent[key]));
["anchored", "compare", "editor", "_filter", "filterFunc", "forceAnchored", "top"].forEach(function (key)
self[key] = parent[key]);
["filters", "keys", "process", "title", "quote"]
.forEach(key => self[key] = parent[key] && util.cloneObject(parent[key]));
["anchored", "compare", "editor", "_filter", "filterFunc", "forceAnchored", "top"]
.forEach(key => self[key] = parent[key]);
self.__defineGetter__("value", function get_value() this.top.value);
@@ -171,9 +171,9 @@ var CompletionContext = Class("CompletionContext", {
*/
this.top = this;
this.__defineGetter__("incomplete", function get_incomplete() this._incomplete
|| this.contextList.some(function (c) c.parent && c.incomplete));
|| this.contextList.some(c => c.parent && c.incomplete));
this.__defineGetter__("waitingForTab", function get_waitingForTab() this._waitingForTab
|| this.contextList.some(function (c) c.parent && c.waitingForTab));
|| this.contextList.some(c => c.parent && c.waitingForTab));
this.__defineSetter__("incomplete", function get_incomplete(val) { this._incomplete = val; });
this.__defineSetter__("waitingForTab", function get_waitingForTab(val) { this._waitingForTab = val; });
this.reset();
@@ -214,7 +214,7 @@ var CompletionContext = Class("CompletionContext", {
return this;
},
__title: Class.Memoize(function __title() this._title.map(function (s)
__title: Class.Memoize(function __title() this._title.map(s =>
typeof s == "string" ? messages.get("completion.title." + s, s)
: s)),

View File

@@ -57,10 +57,10 @@ var ConfigBase = Class("ConfigBase", {
"resource://dactyl-content/")));
this.timeout(function () {
cache.register("config.dtd", function () util.makeDTD(config.dtd));
cache.register("config.dtd", () => util.makeDTD(config.dtd));
});
services["dactyl:"].pages["dtd"] = function () [null, cache.get("config.dtd")];
services["dactyl:"].pages["dtd"] = () => [null, cache.get("config.dtd")];
update(services["dactyl:"].providers, {
"locale": function (uri, path) LocaleChannel("dactyl-locale", config.locale, path, uri),
@@ -77,7 +77,7 @@ var ConfigBase = Class("ConfigBase", {
"resource://dactyl-local/config.json"
],
configs: Class.Memoize(function () this.configFiles.map(function (url) JSON.parse(File.readURL(url)))),
configs: Class.Memoize(function () this.configFiles.map(url => JSON.parse(File.readURL(url)))),
loadConfig: function loadConfig(documentURL) {
@@ -152,8 +152,8 @@ var ConfigBase = Class("ConfigBase", {
loadStyles: function loadStyles(force) {
highlight.styleableChrome = this.styleableChrome;
highlight.loadCSS(this.CSS.replace(/__MSG_(.*?)__/g, function (m0, m1) _(m1)));
highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, function (m0, m1) _(m1)));
highlight.loadCSS(this.CSS.replace(/__MSG_(.*?)__/g, (m0, m1) => _(m1)));
highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, (m0, m1) => _(m1)));
if (!this.haveGecko("2b"))
highlight.loadCSS(literal(/*
@@ -169,14 +169,14 @@ var ConfigBase = Class("ConfigBase", {
let hl = highlight.set("Find", "");
hl.onChange = function () {
function hex(val) ("#" + util.regexp.iterate(/\d+/g, val)
.map(function (num) ("0" + Number(num).toString(16)).slice(-2))
.map(num => ("0" + Number(num).toString(16)).slice(-2))
.join("")
).slice(0, 7);
let elem = services.appShell.hiddenDOMWindow.document.createElement("div");
elem.style.cssText = this.cssText;
let keys = iter(Styles.propertyIter(this.cssText)).map(function (p) p.name).toArray();
let keys = iter(Styles.propertyIter(this.cssText)).map(p => p.name).toArray();
let bg = keys.some(bind("test", /^background/));
let fg = keys.indexOf("color") >= 0;
@@ -198,7 +198,7 @@ var ConfigBase = Class("ConfigBase", {
/**
* The current application locale.
*/
appLocale: Class.Memoize(function () services.chromeRegistry.getSelectedLocale("global")),
appLocale: Class.Memoize(() => services.chromeRegistry.getSelectedLocale("global")),
/**
* The current dactyl locale.
@@ -411,8 +411,8 @@ var ConfigBase = Class("ConfigBase", {
get plugins() "http://5digits.org/" + this.name + "/plugins",
get faq() this.home + this.name + "/faq",
"list.mailto": Class.Memoize(function () config.name + "@googlegroups.com"),
"list.href": Class.Memoize(function () "http://groups.google.com/group/" + config.name),
"list.mailto": Class.Memoize(() => config.name + "@googlegroups.com"),
"list.href": Class.Memoize(() => "http://groups.google.com/group/" + config.name),
"hg.latest": Class.Memoize(function () this.code + "source/browse/"), // XXX
"irc": "irc://irc.oftc.net/#pentadactyl"
@@ -478,8 +478,8 @@ var ConfigBase = Class("ConfigBase", {
get commandContainer() document.documentElement.id
}),
browser: Class.Memoize(function () window.gBrowser),
tabbrowser: Class.Memoize(function () window.gBrowser),
browser: Class.Memoize(() => window.gBrowser),
tabbrowser: Class.Memoize(() => window.gBrowser),
get browserModes() [modules.modes.NORMAL],
@@ -573,9 +573,9 @@ var ConfigBase = Class("ConfigBase", {
* @property {string} The default highlighting rules.
* See {@link Highlights#loadCSS} for details.
*/
CSS: Class.Memoize(function () File.readURL("resource://dactyl-skin/global-styles.css")),
CSS: Class.Memoize(() => File.readURL("resource://dactyl-skin/global-styles.css")),
helpCSS: Class.Memoize(function () File.readURL("resource://dactyl-skin/help-styles.css"))
helpCSS: Class.Memoize(() => File.readURL("resource://dactyl-skin/help-styles.css"))
}, {
});
JSMLoader.loadSubScript("resource://dactyl-local-content/config.js", this);
@@ -594,7 +594,7 @@ config.INIT = update(Object.create(config.INIT), config.INIT, {
width: {width}px;
height: {height}px;
}
*/).replace(/\{(.*?)\}/g, function (m, m1) img[m1]));
*/).replace(/\{(.*?)\}/g, (m, m1) => img[m1]));
img = null;
});
},

View File

@@ -70,7 +70,7 @@ var Group = Class("Group", {
default_ = false;
function siteFilter(uri)
let (match = array.nth(siteFilter.filters, function (f) f(uri), 0))
let (match = array.nth(siteFilter.filters, f => f(uri), 0))
match ? match.result : default_;
return update(siteFilter, {
@@ -140,8 +140,8 @@ var Contexts = Module("contexts", {
completer: function (context) modules.completion.group(context)
});
memoize(modules, "userContext", function () contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules, true]));
memoize(modules, "_userContext", function () contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules.userContext]));
memoize(modules, "userContext", () => contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules, true]));
memoize(modules, "_userContext", () => contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules.userContext]));
},
cleanup: function () {
@@ -187,8 +187,8 @@ var Contexts = Module("contexts", {
});
memoize(contexts.hives, name,
function () Object.create(Object.create(contexts.hiveProto,
{ _hive: { value: name } })));
() => Object.create(Object.create(contexts.hiveProto,
{ _hive: { value: name } })));
memoize(contexts.groupsProto, name,
function () [group[name] for (group in values(this.groups)) if (Set.has(group, name))]);
@@ -202,10 +202,10 @@ var Contexts = Module("contexts", {
const { contexts, io, newContext, plugins, userContext } = this.modules;
let isPlugin = array.nth(io.getRuntimeDirectories("plugins"),
function (dir) dir.contains(file, true),
dir => dir.contains(file, true),
0);
let isRuntime = array.nth(io.getRuntimeDirectories(""),
function (dir) dir.contains(file, true),
dir => dir.contains(file, true),
0);
let name = isPlugin ? file.getRelativeDescriptor(isPlugin).replace(File.PATH_SEP, "-")
@@ -305,7 +305,7 @@ var Contexts = Module("contexts", {
var file = File(uri.file);
let isPlugin = array.nth(io.getRuntimeDirectories("plugins"),
function (dir) dir.contains(file, true),
dir => dir.contains(file, true),
0);
let name = isPlugin && file && file.getRelativeDescriptor(isPlugin)
@@ -413,7 +413,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(group => need.some(Set.has(group))),
addGroup: function addGroup(name, description, filter, persist, replace) {
let group = this.getGroup(name);
@@ -515,7 +515,7 @@ var Contexts = Module("contexts", {
for ([i, name] in Iterator(params)));
let rhs = args.literalArg;
let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce(function (a, b) args[b] ? b : a, default_);
let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce((a, b) => args[b] ? b : a, default_);
switch (type) {
case "-builtin":
@@ -544,7 +544,7 @@ var Contexts = Module("contexts", {
action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })");
else
action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg));
process = function (param) isObject(param) && param.valueOf ? param.valueOf() : param;
process = param => isObject(param) && param.valueOf ? param.valueOf() : param;
action.params = params;
action.makeParams = makeParams;
break;
@@ -707,7 +707,7 @@ var Contexts = Module("contexts", {
util.assert(args.bang ^ !!args[0], _("error.argumentOrBang"));
if (args.bang)
contexts.groupList = contexts.groupList.filter(function (g) g.builtin);
contexts.groupList = contexts.groupList.filter(g => g.builtin);
else {
util.assert(contexts.getGroup(args[0]), _("group.noSuch", args[0]));
contexts.removeGroup(args[0]);
@@ -719,7 +719,7 @@ var Contexts = Module("contexts", {
completer: function (context, args) {
if (args.bang)
return;
context.filters.push(function ({ item }) !item.builtin);
context.filters.push(({ item }) => !item.builtin);
modules.completion.group(context);
}
});
@@ -805,7 +805,7 @@ var Contexts = Module("contexts", {
iter({ Active: true, Inactive: false }).forEach(function ([name, active]) {
context.split(name, null, function (context) {
context.title[0] = name + " Groups";
context.filters.push(function ({ item }) !!item.filter(modules.buffer.uri) == active);
context.filters.push(({ item }) => !!item.filter(modules.buffer.uri) == active);
});
});
};

View File

@@ -108,7 +108,7 @@ var DOM = Class("DOM", {
}]
]),
matcher: function matcher(sel) function (elem) elem.mozMatchesSelector && elem.mozMatchesSelector(sel),
matcher: function matcher(sel) elem => elem.mozMatchesSelector && elem.mozMatchesSelector(sel),
each: function each(fn, self) {
let obj = self || this.Empty();
@@ -158,11 +158,11 @@ var DOM = Class("DOM", {
},
find: function find(val) {
return this.map(function (elem) elem.querySelectorAll(val));
return this.map(elem => elem.querySelectorAll(val));
},
findAnon: function findAnon(attr, val) {
return this.map(function (elem) elem.ownerDocument.getAnonymousElementByAttribute(elem, attr, val));
return this.map(elem => elem.ownerDocument.getAnonymousElementByAttribute(elem, attr, val));
},
filter: function filter(val, self) {
@@ -234,7 +234,7 @@ var DOM = Class("DOM", {
return false;
},
get parent() this.map(function (elem) elem.parentNode, this),
get parent() this.map(elem => elem.parentNode, this),
get offsetParent() this.map(function (elem) {
do {
@@ -245,23 +245,23 @@ var DOM = Class("DOM", {
while (parent);
}, this),
get ancestors() this.all(function (elem) elem.parentNode),
get ancestors() this.all(elem => elem.parentNode),
get children() this.map(function (elem) Array.filter(elem.childNodes,
function (e) e instanceof Ci.nsIDOMElement),
get children() this.map(elem => Array.filter(elem.childNodes,
e => e instanceof Ci.nsIDOMElement),
this),
get contents() this.map(function (elem) elem.childNodes, this),
get contents() this.map(elem => elem.childNodes, this),
get siblings() this.map(function (elem) Array.filter(elem.parentNode.childNodes,
function (e) e != elem && e instanceof Ci.nsIDOMElement),
get siblings() this.map(elem => Array.filter(elem.parentNode.childNodes,
e => e != elem && e instanceof Ci.nsIDOMElement),
this),
get siblingsBefore() this.all(function (elem) elem.previousElementSibling),
get siblingsAfter() this.all(function (elem) elem.nextElementSibling),
get siblingsBefore() this.all(elem => elem.previousElementSibling),
get siblingsAfter() this.all(elem => elem.nextElementSibling),
get allSiblingsBefore() this.all(function (elem) elem.previousSibling),
get allSiblingsAfter() this.all(function (elem) elem.nextSibling),
get allSiblingsBefore() this.all(elem => elem.previousSibling),
get allSiblingsAfter() this.all(elem => elem.nextSibling),
get class() let (self = this) ({
toString: function () self[0].className,
@@ -305,7 +305,7 @@ var DOM = Class("DOM", {
}),
remove: function remove(hl) self.each(function () {
this.highlight.list = this.highlight.list.filter(function (h) h != hl);
this.highlight.list = this.highlight.list.filter(h => h != hl);
}),
toggle: function toggle(hl, val, thisObj) self.each(function (elem, i) {
@@ -584,7 +584,7 @@ var DOM = Class("DOM", {
["span", { highlight: "HelpXMLTagStart" },
"<", namespaced(elem), " ",
template.map(array.iterValues(elem.attributes),
function (attr) [
attr => [
["span", { highlight: "HelpXMLAttribute" }, namespaced(attr)],
["span", { highlight: "HelpXMLString" }, attr.value]
],
@@ -660,9 +660,9 @@ var DOM = Class("DOM", {
return this[0].style[css.property(key)];
}, {
name: function (property) property.replace(/[A-Z]/g, function (m0) "-" + m0.toLowerCase()),
name: function (property) property.replace(/[A-Z]/g, m0 => "-" + m0.toLowerCase()),
property: function (name) name.replace(/-(.)/g, function (m0, m1) m1.toUpperCase())
property: function (name) name.replace(/-(.)/g, (m0, m1) => m1.toUpperCase())
}),
append: function append(val) {
@@ -738,7 +738,7 @@ var DOM = Class("DOM", {
},
clone: function clone(deep)
this.map(function (elem) elem.cloneNode(deep)),
this.map(elem => elem.cloneNode(deep)),
toggle: function toggle(val, self) {
if (callable(val))
@@ -749,7 +749,7 @@ var DOM = Class("DOM", {
if (arguments.length)
return this[val ? "show" : "hide"]();
let hidden = this.map(function (elem) elem.style.display == "none");
let hidden = this.map(elem => elem.style.display == "none");
return this.each(function (elem, i) {
this[hidden[i] ? "show" : "hide"]();
});
@@ -784,7 +784,7 @@ var DOM = Class("DOM", {
let [fn, self] = args;
if (!callable(fn))
fn = function () args[0];
fn = () => args[0];
return this.each(function (elem, i) {
set.call(this, elem, fn.call(self || this, elem, i));
@@ -793,19 +793,19 @@ var DOM = Class("DOM", {
html: function html(txt, self) {
return this.getSet(arguments,
function (elem) elem.innerHTML,
elem => elem.innerHTML,
util.wrapCallback(function (elem, val) { elem.innerHTML = val; }));
},
text: function text(txt, self) {
return this.getSet(arguments,
function (elem) elem.textContent,
elem => elem.textContent,
function (elem, val) { elem.textContent = val; });
},
val: function val(txt) {
return this.getSet(arguments,
function (elem) elem.value,
elem => elem.value,
function (elem, val) { elem.value = val == null ? "" : val; });
},
@@ -985,7 +985,7 @@ var DOM = Class("DOM", {
update(params, this.constructor.defaults[type],
iter.toObject([k, opts[k]] for (k in opts) if (k in params)));
evt["init" + t + "Event"].apply(evt, args.map(function (k) params[k]));
evt["init" + t + "Event"].apply(evt, args.map(k => params[k]));
return evt;
}
}, {
@@ -1040,7 +1040,7 @@ var DOM = Class("DOM", {
this.code_nativeKey[v] = k.substr(4);
k = k.substr(7).toLowerCase();
let names = [k.replace(/(^|_)(.)/g, function (m, n1, n2) n2.toUpperCase())
let names = [k.replace(/(^|_)(.)/g, (m, n1, n2) => n2.toUpperCase())
.replace(/^NUMPAD/, "k")];
if (names[0].length == 1)
@@ -1127,7 +1127,7 @@ var DOM = Class("DOM", {
*/
parse: function parse(input, unknownOk) {
if (isArray(input))
return array.flatten(input.map(function (k) this.parse(k, unknownOk), this));
return array.flatten(input.map(k => this.parse(k, unknownOk)));
if (arguments.length === 1)
unknownOk = true;
@@ -1214,7 +1214,7 @@ var DOM = Class("DOM", {
*/
stringify: function stringify(event) {
if (isArray(event))
return event.map(function (e) this.stringify(e), this).join("");
return event.map(e => this.stringify(e)).join("");
if (event.dactylString)
return event.dactylString;
@@ -1338,7 +1338,7 @@ var DOM = Class("DOM", {
submit: { cancelable: true }
},
types: Class.Memoize(function () iter(
types: Class.Memoize(() => iter(
{
Mouse: "click mousedown mouseout mouseover mouseup dblclick " +
"hover " +
@@ -1349,7 +1349,7 @@ var DOM = Class("DOM", {
"load unload pageshow pagehide DOMContentLoaded " +
"resize scroll"
}
).map(function ([k, v]) v.split(" ").map(function (v) [v, k]))
).map(([k, v]) => v.split(" ").map(v => [v, k]))
.flatten()
.toObject()),
@@ -1393,12 +1393,12 @@ var DOM = Class("DOM", {
})
}),
createContents: Class.Memoize(function () services.has("dactyl") && services.dactyl.createContents
|| function (elem) {}),
createContents: Class.Memoize(() => services.has("dactyl") && services.dactyl.createContents
|| (elem => {})),
isScrollable: Class.Memoize(function () services.has("dactyl") && services.dactyl.getScrollable
? function (elem, dir) services.dactyl.getScrollable(elem) & (dir ? services.dactyl["DIRECTION_" + dir.toUpperCase()] : ~0)
: function (elem, dir) true),
isScrollable: Class.Memoize(() => services.has("dactyl") && services.dactyl.getScrollable
? (elem, dir) => services.dactyl.getScrollable(elem) & (dir ? services.dactyl["DIRECTION_" + dir.toUpperCase()] : ~0)
: (elem, dir) => true),
isJSONXML: function isJSONXML(val) isArray(val) && isinstance(val[0], ["String", "Array", "XML", DOM.DOMString])
|| isObject(val) && "toDOM" in val,
@@ -1524,7 +1524,7 @@ var DOM = Class("DOM", {
escapeHTML: function escapeHTML(str, simple) {
let map = { "'": "&apos;", '"': "&quot;", "%": "&#x25;", "&": "&amp;", "<": "&lt;", ">": "&gt;" };
let regexp = simple ? /[<>]/g : /['"&<>]/g;
return str.replace(regexp, function (m) map[m]);
return str.replace(regexp, m => map[m]);
},
/**
@@ -1664,13 +1664,13 @@ var DOM = Class("DOM", {
function isFragment(args) !isString(args[0]) || args.length == 0 || args[0] === "";
function hasString(args) {
return args.some(function (a) isString(a) || isFragment(a) && hasString(a));
return args.some(a => isString(a) || isFragment(a) && hasString(a));
}
function isStrings(args) {
if (!isArray(args))
return util.dump("ARGS: " + {}.toString.call(args) + " " + args), false;
return args.every(function (a) isinstance(a, ["String", DOM.DOMString]) || isFragment(a) && isStrings(a));
return args.every(a => isinstance(a, ["String", DOM.DOMString]) || isFragment(a) && isStrings(a));
}
function tag(args, namespaces, indent) {
@@ -1782,7 +1782,7 @@ var DOM = Class("DOM", {
res.push(">");
if (isStrings(args))
res.push(args.map(function (e) tag(e, namespaces, "")).join(""),
res.push(args.map(e => tag(e, namespaces, "")).join(""),
"</", name, ">");
else {
let contents = [];
@@ -1840,7 +1840,7 @@ var DOM = Class("DOM", {
let resolver = XPath.resolver;
if (namespaces) {
namespaces = update({}, DOM.namespaces, namespaces);
resolver = function (prefix) namespaces[prefix] || null;
resolver = prefix => namespaces[prefix] || null;
}
let result = doc.evaluate(expression, elem,
@@ -1878,8 +1878,8 @@ var DOM = Class("DOM", {
*/
makeXPath: function makeXPath(nodes) {
return array(nodes).map(util.debrace).flatten()
.map(function (node) /^[a-z]+:/.test(node) ? node : [node, "xhtml:" + node]).flatten()
.map(function (node) "//" + node).join(" | ");
.map(node => /^[a-z]+:/.test(node) ? node : [node, "xhtml:" + node]).flatten()
.map(node => "//" + node).join(" | ");
},
namespaces: {
@@ -1891,11 +1891,11 @@ var DOM = Class("DOM", {
},
namespaceNames: Class.Memoize(function ()
iter(this.namespaces).map(function ([k, v]) [v, k]).toObject()),
iter(this.namespaces).map(([k, v]) => [v, k]).toObject()),
});
Object.keys(DOM.Event.types).forEach(function (event) {
let name = event.replace(/-(.)/g, function (m, m1) m1.toUpperCase());
let name = event.replace(/-(.)/g, (m, m1) => m1.toUpperCase());
if (!Set.has(DOM.prototype, name))
DOM.prototype[name] =
function _event(arg, extra) {

View File

@@ -281,7 +281,7 @@ var DownloadList = Class("DownloadList",
return;
this.downloads[id] = download;
let index = values(this.downloads).sort(function (a, b) a.compare(b))
let index = values(this.downloads).sort((a, b) => a.compare(b))
.indexOf(download);
this.nodes.list.insertBefore(download.nodes.row,
@@ -301,7 +301,7 @@ var DownloadList = Class("DownloadList",
},
allowedCommands: Class.Memoize(function () let (self = this) ({
get clear() values(self.downloads).some(function (dl) dl.allowedCommands.remove)
get clear() values(self.downloads).some(dl => dl.allowedCommands.remove)
})),
commands: {
@@ -311,7 +311,7 @@ var DownloadList = Class("DownloadList",
},
sort: function sort() {
let list = values(this.downloads).sort(function (a, b) a.compare(b));
let list = values(this.downloads).sort((a, b) => a.compare(b));
for (let [i, download] in iter(list))
if (this.nodes.list.childNodes[i + 1] != download.nodes.row)
@@ -319,7 +319,7 @@ var DownloadList = Class("DownloadList",
this.nodes.list.childNodes[i + 1]);
},
shouldSort: function shouldSort() Array.some(arguments, function (val) this.sortOrder.some(function (v) v.substr(1) == val), this),
shouldSort: function shouldSort() Array.some(arguments, val => this.sortOrder.some(v => v.substr(1) == val)),
update: function update() {
for (let node in values(this.nodes))
@@ -336,11 +336,11 @@ var DownloadList = Class("DownloadList",
updateProgress: function updateProgress() {
let downloads = values(this.downloads).toArray();
let active = downloads.filter(function (d) d.alive);
let active = downloads.filter(d => d.alive);
let self = Object.create(this);
for (let prop in values(["amountTransferred", "size", "speed", "timeRemaining"]))
this[prop] = active.reduce(function (acc, dl) dl[prop] + acc, 0);
this[prop] = active.reduce((acc, dl) => dl[prop] + acc, 0);
Download.prototype.updateProgress.call(self);
@@ -489,21 +489,21 @@ var Downloads = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), {
},
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(val => val.substr(1))));
context.completions = iter(this.values).filter(function ([k, v]) !seen(k))
.map(function ([k, v]) [["+" + k, [v, " (", _("sort.ascending"), ")"].join("")],
["-" + k, [v, " (", _("sort.descending"), ")"].join("")]])
context.completions = iter(this.values).filter(([k, v]) => !seen(k))
.map(([k, v]) => [["+" + k, [v, " (", _("sort.ascending"), ")"].join("")],
["-" + k, [v, " (", _("sort.descending"), ")"].join("")]])
.flatten().array;
},
has: function () Array.some(arguments, function (val) this.value.some(function (v) v.substr(1) == val)),
has: function () Array.some(arguments, function (val) this.value.some(v => v.substr(1) == val)),
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)),
this) && value.length;
return value.every(val => /^[+-]/.test(val) && Set.has(this.values, val.substr(1))
&& !Set.add(seen, val.substr(1))
) && value.length;
}
});
}

View File

@@ -104,7 +104,7 @@ var RangeFinder = Module("rangefinder", {
return "";
}
this.options["findflags"].forEach(function (f) replacer(f, f));
this.options["findflags"].forEach(function (f) { replacer(f, f); });
let pattern = str.replace(/\\(.|$)/g, replacer);
@@ -430,7 +430,7 @@ var RangeFind = Class("RangeFind", {
findRange: function findRange(range) {
let doc = range.startContainer.ownerDocument;
let win = doc.defaultView;
let ranges = this.ranges.filter(function (r)
let ranges = this.ranges.filter(r =>
r.window === win && RangeFind.sameDocument(r.range, range) && RangeFind.contains(r.range, range));
if (this.backward)
@@ -516,7 +516,7 @@ var RangeFind = Class("RangeFind", {
},
iter: function iter(word) {
let saved = ["lastRange", "lastString", "range", "regexp"].map(function (s) [s, this[s]], this);
let saved = ["lastRange", "lastString", "range", "regexp"].map(s => [s, this[s]]);
let res;
try {
let regexp = this.regexp && word != util.regexp.escape(word);
@@ -542,7 +542,7 @@ var RangeFind = Class("RangeFind", {
}
}
finally {
saved.forEach(function ([k, v]) this[k] = v, this);
saved.forEach(function ([k, v]) { this[k] = v; }, this);
}
},
@@ -611,7 +611,7 @@ var RangeFind = Class("RangeFind", {
this.range = this.findRange(this.startRange) || this.ranges[0];
util.assert(this.range, "Null range", false);
this.ranges.first = this.range;
this.ranges.forEach(function (range) range.save());
this.ranges.forEach(function (range) { range.save(); });
this.forward = null;
this.found = false;
},
@@ -837,7 +837,7 @@ var RangeFind = Class("RangeFind", {
}
return true;
},
selectNodePath: ["a", "xhtml:a", "*[@onclick]"].map(function (p) "ancestor-or-self::" + p).join(" | "),
selectNodePath: ["a", "xhtml:a", "*[@onclick]"].map(p => "ancestor-or-self::" + p).join(" | "),
union: function union(a, b) {
let start = a.compareBoundaryPoints(a.START_TO_START, b) < 0 ? a : b;
let end = a.compareBoundaryPoints(a.END_TO_END, b) > 0 ? a : b;

View File

@@ -27,7 +27,7 @@ var HelpBuilder = Class("HelpBuilder", {
// Scrape the list of help files from all.xml
this.tags["all"] = this.tags["all.xml"] = "all";
let files = this.findHelpFile("all").map(function (doc)
let files = this.findHelpFile("all").map(doc =>
[f.value for (f in DOM.XPath("//dactyl:include/@href", doc))]);
// Scrape the tags from the rest of the help files.
@@ -90,8 +90,8 @@ var Help = Module("Help", {
}
update(services["dactyl:"].providers, {
"help": Loop(function (uri, path) help.files[path]),
"help-overlay": Loop(function (uri, path) help.overlays[path]),
"help": Loop((uri, path) => help.files[path]),
"help-overlay": Loop((uri, path) => help.overlays[path]),
"help-tag": Loop(function (uri, path) {
let tag = decodeURIComponent(path);
if (tag in help.files)
@@ -129,7 +129,7 @@ var Help = Module("Help", {
let betas = util.regexp(/\[((?:b|rc)\d)\]/, "gx");
let beta = array(betas.iterate(NEWS))
.map(function (m) m[1]).uniq().slice(-1)[0];
.map(m => m[1]).uniq().slice(-1)[0];
function rec(text, level, li) {
let res = [];
@@ -151,10 +151,10 @@ var Help = Module("Help", {
else if (match.par) {
let [, par, tags] = /([^]*?)\s*((?:\[[^\]]+\])*)\n*$/.exec(match.par);
let t = tags;
tags = array(betas.iterate(tags)).map(function (m) m[1]);
tags = array(betas.iterate(tags)).map(m => m[1]);
let group = !tags.length ? "" :
!tags.some(function (t) t == beta) ? "HelpNewsOld" : "HelpNewsNew";
let group = !tags.length ? "" :
!tags.some(t => t == beta) ? "HelpNewsOld" : "HelpNewsNew";
if (i === 0 && li) {
li[1]["dactyl:highlight"] = group;
group = "";
@@ -367,7 +367,7 @@ var Help = Module("Help", {
for (let [file, ] in Iterator(help.files)) {
let url = "dactyl://help/" + file;
dactyl.open(url);
util.waitFor(function () content.location.href == url && buffer.loaded
util.waitFor(() => content.location.href == url && buffer.loaded
&& content.document.documentElement instanceof Ci.nsIDOMHTMLHtmlElement,
15000);
events.waitForPageLoad();
@@ -381,9 +381,9 @@ var Help = Module("Help", {
}
let data = [h for (h in highlight) if (Set.has(styles, h.class) || /^Help/.test(h.class))]
.map(function (h) h.selector
.replace(/^\[.*?=(.*?)\]/, ".hl-$1")
.replace(/html\|/g, "") + "\t" + "{" + h.cssText + "}")
.map(h => h.selector
.replace(/^\[.*?=(.*?)\]/, ".hl-$1")
.replace(/html\|/g, "") + "\t" + "{" + h.cssText + "}")
.join("\n");
addDataEntry("help.css", data.replace(/chrome:[^ ")]+\//g, ""));
@@ -444,7 +444,7 @@ var Help = Module("Help", {
},
javascript: function initJavascript(dactyl, modules, window) {
modules.JavaScript.setCompleter([modules.help.exportHelp],
[function (context, args) overlay.activeModules.completion.file(context)]);
[(context, args) => overlay.activeModules.completion.file(context)]);
},
options: function initOptions(dactyl, modules, window) {
const { options } = modules;

View File

@@ -57,22 +57,22 @@ Highlight.defaultValue("sites", function ()
Highlight.defaultValue("style", function ()
styles.system.add("highlight:" + this.class, this.sites, this.css, this.agent, true));
Highlight.defaultValue("defaultExtends", function () []);
Highlight.defaultValue("defaultValue", function () "");
Highlight.defaultValue("defaultExtends", () => []);
Highlight.defaultValue("defaultValue", () => "");
Highlight.defaultValue("extends", function () this.defaultExtends);
Highlight.defaultValue("value", function () this.defaultValue);
update(Highlight.prototype, {
get base() this.baseClass != this.class && highlight.highlight[this.baseClass] || null,
get bases() array.compact(this.extends.map(function (name) highlight.get(name))),
get bases() array.compact(this.extends.map(name => highlight.get(name))),
get inheritedCSS() {
if (this.gettingCSS)
return "";
try {
this.gettingCSS = true;
return this.bases.map(function (b) b.cssText.replace(/;?\s*$/, "; ")).join("");
return this.bases.map(b => b.cssText.replace(/;?\s*$/, "; ")).join("");
}
finally {
this.gettingCSS = false;
@@ -100,7 +100,7 @@ var Highlights = Module("Highlight", {
keys: function keys() Object.keys(this.highlight).sort(),
__iterator__: function () values(this.highlight).sort(function (a, b) String.localeCompare(a.class, b.class))
__iterator__: function () values(this.highlight).sort((a, b) => String.localeCompare(a.class, b.class))
.iterValues(),
_create: function _create(agent, args) {
@@ -282,8 +282,8 @@ var Highlights = Module("Highlight", {
*/
loadCSS: function loadCSS(css, eager) {
String.replace(css, /\\\n/g, "")
.replace(this.groupRegexp, function (m, m1, m2) m1 + " " + m2.replace(/\n\s*/g, " "))
.split("\n").filter(function (s) /\S/.test(s) && !/^\s*\/\//.test(s))
.replace(this.groupRegexp, (m, m1, m2) => m1 + " " + m2.replace(/\n\s*/g, " "))
.split("\n").filter(s => /\S/.test(s) && !/^\s*\/\//.test(s))
.forEach(function (highlight) {
let bang = eager || /^\s*!/.test(highlight);
@@ -352,7 +352,7 @@ var Highlights = Module("Highlight", {
"text-align: center"],
([h.class,
["span", { style: "text-align: center; line-height: 1em;" + h.value + style }, "XXX"],
template.map(h.extends, function (s) template.highlight(s), ","),
template.map(h.extends, s => template.highlight(s), ","),
template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
function (match) ["span", { highlight: match[0] == "/" ? "Comment" : "Key" }, match])
]
@@ -395,7 +395,7 @@ var Highlights = Module("Highlight", {
completer: function (context, args) {
let group = args[0] && highlight.get(args[0]);
if (group)
context.fork("extra", 0, this, function (context) [
context.fork("extra", 0, this, context => [
[String(group.extends), _("option.currentValue")],
[String(group.defaultExtends) || "", _("option.defaultValue")]
]);
@@ -428,8 +428,8 @@ var Highlights = Module("Highlight", {
context.completions =
array.flatten(
io.getRuntimeDirectories("colors").map(
function (dir) dir.readDirectory().filter(
function (file) extRe.test(file.leafName))))
dir => dir.readDirectory().filter(
file => extRe.test(file.leafName))))
.concat([
{ leafName: "default", parent: { path: /*L*/"Revert to builtin colorscheme" } }
]);
@@ -442,10 +442,10 @@ var Highlights = Module("Highlight", {
};
},
javascript: function initJavascript(dactyl, modules, window) {
modules.JavaScript.setCompleter(["get", "set"].map(function (m) highlight[m]),
[ function (context, obj, args) Iterator(highlight.highlight) ]);
modules.JavaScript.setCompleter(["highlightNode"].map(function (m) highlight[m]),
[ null, function (context, obj, args) Iterator(highlight.highlight) ]);
modules.JavaScript.setCompleter(["get", "set"].map(m => highlight[m]),
[ (context, obj, args) => Iterator(highlight.highlight) ]);
modules.JavaScript.setCompleter(["highlightNode"].map(m => highlight[m]),
[ null, (context, obj, args) => Iterator(highlight.highlight) ]);
}
});

View File

@@ -74,8 +74,8 @@ var IO = Module("io", {
*/
getRuntimeDirectories: function getRuntimeDirectories(name) {
return modules.options.get("runtimepath").files
.map(function (dir) dir.child(name))
.filter(function (dir) dir.exists() && dir.isDirectory() && dir.isReadable());
.map(dir => dir.child(name))
.filter(dir => dir.exists() && dir.isDirectory() && dir.isReadable());
},
// FIXME: multiple paths?
@@ -502,7 +502,7 @@ var IO = Module("io", {
function async(status) {
let output = stdout.read();
[stdin, stdout, cmd].forEach(function (f) f.exists() && f.remove(false));
[stdin, stdout, cmd].forEach(f => f.exists() && f.remove(false));
callback(result(status, output));
}
@@ -550,7 +550,7 @@ var IO = Module("io", {
}
finally {
if (!checked || res !== true)
args.forEach(function (f) f.remove(false));
args.forEach(f => f.remove(false));
}
return res;
}
@@ -806,7 +806,7 @@ unlet s:cpo_save
lines.last.push(item, sep);
}
lines.last.pop();
return lines.map(function (l) l.join("")).join("\n").replace(/\s+\n/gm, "\n");
return lines.map(l => l.join("")).join("\n").replace(/\s+\n/gm, "\n");
}//}}}
let params = { //{{{
@@ -904,7 +904,7 @@ unlet s:cpo_save
_("command.run.noPrevious"));
arg = arg.replace(/(\\)*!/g,
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", io._lastRunCommand)
m => /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", io._lastRunCommand)
);
}
@@ -942,21 +942,21 @@ unlet s:cpo_save
}
}
};
context.generate = function () iter(services.charset.getDecoderList());
context.generate = () => iter(services.charset.getDecoderList());
};
completion.directory = function directory(context, full) {
this.file(context, full);
context.filters.push(function (item) item.isdir);
context.filters.push(item => item.isdir);
};
completion.environment = function environment(context) {
context.title = ["Environment Variable", "Value"];
context.generate = function ()
context.generate = () =>
io.system(config.OS.isWindows ? "set" : "env")
.output.split("\n")
.filter(function (line) line.indexOf("=") > 0)
.map(function (line) line.match(/([^=]+)=(.*)/).slice(1));
.filter(line => line.indexOf("=") > 0)
.map(line => line.match(/([^=]+)=(.*)/).slice(1));
};
completion.file = function file(context, full, dir) {
@@ -983,10 +983,10 @@ unlet s:cpo_save
icon: function (f) this.isdir ? "resource://gre/res/html/folder.png"
: "moz-icon://" + f.leafName
};
context.compare = function (a, b) b.isdir - a.isdir || String.localeCompare(a.text, b.text);
context.compare = (a, b) => b.isdir - a.isdir || String.localeCompare(a.text, b.text);
if (modules.options["wildignore"])
context.filters.push(function (item) !modules.options.get("wildignore").getKey(item.path));
context.filters.push(item => !modules.options.get("wildignore").getKey(item.path));
// context.background = true;
context.key = dir;
@@ -1054,7 +1054,7 @@ unlet s:cpo_save
if (!match.path) {
context.key = match.proto;
context.advance(match.proto.length);
context.generate = function () config.chromePackages.map(function (p) [p, match.proto + p + "/"]);
context.generate = () => config.chromePackages.map(p => [p, match.proto + p + "/"]);
}
else if (match.scheme === "chrome") {
context.key = match.prefix;
@@ -1121,8 +1121,8 @@ unlet s:cpo_save
"List of directories searched when executing :cd",
"stringlist", ["."].concat(services.environment.get("CDPATH").split(/[:;]/).filter(util.identity)).join(","),
{
get files() this.value.map(function (path) File(path, modules.io.cwd))
.filter(function (dir) dir.exists()),
get files() this.value.map(path => File(path, modules.io.cwd))
.filter(dir => dir.exists()),
setter: function (value) File.expandPathList(value)
});
@@ -1130,8 +1130,8 @@ unlet s:cpo_save
"List of directories searched for runtime files",
"stringlist", IO.runtimePath,
{
get files() this.value.map(function (path) File(path, modules.io.cwd))
.filter(function (dir) dir.exists())
get files() this.value.map(path => File(path, modules.io.cwd))
.filter(dir => dir.exists())
});
options.add(["shell", "sh"],

View File

@@ -57,7 +57,7 @@ var JavaScript = Module("javascript", {
newContext: function () this.modules.newContext(this.modules.userContext, true, "Dactyl JS Temp Context"),
completers: Class.Memoize(function () Object.create(JavaScript.completers)),
completers: Class.Memoize(() => Object.create(JavaScript.completers)),
// Some object members are only accessible as function calls
getKey: function (obj, key) {
@@ -273,7 +273,7 @@ var JavaScript = Module("javascript", {
// Don't eval any function calls unless the user presses tab.
_checkFunction: function (start, end, key) {
let res = this._functions.some(function (idx) idx >= start && idx < end);
let res = this._functions.some(idx => idx >= start && idx < end);
if (!res || this.context.tabPressed || key in this.cache.evalled)
return false;
this.context.waitingForTab = true;
@@ -345,11 +345,11 @@ var JavaScript = Module("javascript", {
let prefix = last != null ? key : "";
if (last == null) // We're not looking for a quoted string, so filter out anything that's not a valid identifier
base.filters.push(function (item) /^[a-zA-Z_$][\w$]*$/.test(item.text));
base.filters.push(item => /^[a-zA-Z_$][\w$]*$/.test(item.text));
else {
base.quote = [last, function (text) util.escapeString(text, ""), last];
base.quote = [last, text => util.escapeString(text, ""), last];
if (prefix)
base.filters.push(function (item) item.item.indexOf(prefix) === 0);
base.filters.push(item => item.item.indexOf(prefix) === 0);
}
if (!compl) {
@@ -371,7 +371,7 @@ var JavaScript = Module("javascript", {
};
base.keys = {
text: prefix ? function (text) text.substr(prefix.length) : util.identity,
text: prefix ? text => text.substr(prefix.length) : util.identity,
description: function (item) self.getKey(this.obj, item),
key: function (item) {
if (!isNaN(key))
@@ -389,7 +389,7 @@ var JavaScript = Module("javascript", {
objects.forEach(function (obj) {
let context = base.fork(obj[1]);
context.title = [obj[1]];
context.keys.obj = function () obj[0];
context.keys.obj = () => obj[0];
context.key = obj[1] + last;
if (obj[0] == this.cache.evalContext)
context.regenerate = true;
@@ -397,8 +397,8 @@ var JavaScript = Module("javascript", {
obj.ctxt_t = context.fork("toplevel");
if (!compl) {
obj.ctxt_p = context.fork("prototypes");
obj.ctxt_t.generate = function () self.objectKeys(obj[0], true);
obj.ctxt_p.generate = function () self.objectKeys(obj[0], false);
obj.ctxt_t.generate = () => self.objectKeys(obj[0], true);
obj.ctxt_p.generate = () => self.objectKeys(obj[0], false);
}
}, this);
@@ -563,7 +563,7 @@ var JavaScript = Module("javascript", {
for (let [i, idx] in Iterator(this._get(-2).comma)) {
let arg = this._str.substring(prev + 1, idx);
prev = idx;
memoize(args, i, function () self.evalled(arg));
memoize(args, i, () => self.evalled(arg));
}
let key = this._getKey();
args.push(key + string);
@@ -641,7 +641,7 @@ var JavaScript = Module("javascript", {
].concat([k.substr(6) for (k in keys(Ci)) if (/^nsIDOM/.test(k))])
.concat([k.substr(3) for (k in keys(Ci)) if (/^nsI/.test(k))])
.concat(this.magicalNames)
.filter(function (k) k in self.window))),
.filter(k => k in self.window))),
}, {
EVAL_TMP: "__dactyl_eval_tmp",
@@ -775,7 +775,7 @@ var JavaScript = Module("javascript", {
this.js.globals = [
[this.context, /*L*/"REPL Variables"],
[context, /*L*/"REPL Global"]
].concat(this.js.globals.filter(function ([global]) isPrototypeOf.call(global, context)));
].concat(this.js.globals.filter(([global]) => isPrototypeOf.call(global, context)));
if (!isPrototypeOf.call(modules.jsmodules, context))
this.js.toplevel = context;
@@ -783,7 +783,7 @@ var JavaScript = Module("javascript", {
if (!isPrototypeOf.call(window, context))
this.js.window = context;
if (this.js.globals.slice(2).some(function ([global]) global === context))
if (this.js.globals.slice(2).some(([global]) => global === context))
this.js.globals.splice(1);
this.repl = REPL(this.context);

View File

@@ -149,9 +149,9 @@ var Modules = function Modules(window) {
get ownPropertyValues() array.compact(
Object.getOwnPropertyNames(this)
.map(function (name) Object.getOwnPropertyDescriptor(this, name).value, this)),
.map(name => Object.getOwnPropertyDescriptor(this, name).value)),
get moduleList() this.ownPropertyValues.filter(function (mod) mod instanceof this.ModuleBase || mod.isLocalModule, this)
get moduleList() this.ownPropertyValues.filter(mod => mod instanceof this.ModuleBase || mod.isLocalModule)
});
modules.plugins = create(modules);
@@ -179,7 +179,7 @@ overlay.overlayWindow(Object.keys(config.overlays), function _overlay(window) ({
});
config.modules.window
.forEach(function (name) defineModule.time("load", name, modules.load, modules, name));
.forEach(name => defineModule.time("load", name, modules.load, modules, name));
}, this);
},
@@ -224,7 +224,7 @@ overlay.overlayWindow(Object.keys(config.overlays), function _overlay(window) ({
},
cleanup: function cleanup(window) {
overlay.windows = overlay.windows.filter(function (w) w != window);
overlay.windows = overlay.windows.filter(w => w != window);
},
unload: function unload(window) {

View File

@@ -119,11 +119,11 @@ var Messages = Module("messages", {
}()).toArray();
file.write(
array(commands.allHives.map(function (h) properties("command", h)))
.concat(modes.all.map(function (m)
array(commands.allHives.map(h => properties("command", h)))
.concat(modes.all.map(m =>
properties("map", values(mappings.builtin.getStack(m)
.filter(function (map) map.modes[0] == m)))))
.concat(properties("mode", values(modes.all.filter(function (m) !m.hidden))))
.filter(map => map.modes[0] == m)))))
.concat(properties("mode", values(modes.all.filter(m => !m.hidden))))
.concat(properties("option", options))
.concat(properties("hintmode", values(hints.modes), "prompt"))
.concat(properties("pageinfo", values(Buffer.pageInfo), "title"))
@@ -168,7 +168,7 @@ var Messages = Module("messages", {
});
else
iter(value).forEach(function ([k, v]) {
memoize(value, k, function () messages.get([name, k].join("."), v));
memoize(value, k, () => messages.get([name, k].join("."), v));
});
}
@@ -187,7 +187,7 @@ var Messages = Module("messages", {
let { JavaScript } = modules;
JavaScript.setCompleter([this._, this.get, this.format], [
function (context) messages.iterate()
context => messages.iterate()
]);
JavaScript.setCompleter([this.export],

View File

@@ -75,7 +75,7 @@ var Option = Class("Option", {
get helpTag() "'" + this.name + "'",
initValue: function initValue() {
util.trapErrors(function () this.value = this.value, this);
util.trapErrors(() => this.value = this.value, this);
},
get isDefault() this.stringValue === this.stringDefaultValue,
@@ -203,7 +203,7 @@ var Option = Class("Option", {
*
* @returns {boolean}
*/
has: function has() Array.some(arguments, function (val) this.value.indexOf(val) >= 0, this),
has: function has() Array.some(arguments, val => this.value.indexOf(val) >= 0),
/**
* Returns whether this option is identified by *name*.
@@ -318,7 +318,7 @@ var Option = Class("Option", {
* references to a given domain from the given values.
*/
filterDomain: function filterDomain(host, values)
Array.filter(values, function (val) !this.domains([val]).some(function (val) util.isSubdomain(val, host)), this),
Array.filter(values, val => !this.domains([val]).some(val => util.isSubdomain(val, host))),
/**
* @property {value} The option's default value. This value will be used
@@ -344,8 +344,8 @@ var Option = Class("Option", {
if (isArray(defaultValue))
defaultValue = defaultValue.map(Option.quote).join(",");
else if (isObject(defaultValue))
defaultValue = iter(defaultValue).map(function (val) val.map(function (v) Option.quote(v, /:/))
.join(":"))
defaultValue = iter(defaultValue).map(val => val.map(v => Option.quote(v, /:/))
.join(":"))
.join(",");
if (isArray(defaultValue))
@@ -491,7 +491,7 @@ var Option = Class("Option", {
},
domains: {
sitelist: function (vals) array.compact(vals.map(function (site) util.getHost(site.filter))),
sitelist: function (vals) array.compact(vals.map(site => util.getHost(site.filter))),
get sitemap() this.sitelist
},
@@ -520,7 +520,7 @@ var Option = Class("Option", {
regexplist: function regexplist(value) (value === "") ? [] :
Option.splitList(value, true)
.map(function (re) Option.parseRegexp(re, undefined, this.regexpFlags), this),
.map(re => Option.parseRegexp(re, undefined, this.regexpFlags)),
sitelist: function sitelist(value) {
if (value === "")
@@ -558,7 +558,7 @@ var Option = Class("Option", {
},
testValues: {
regexpmap: function regexpmap(vals, validator) vals.every(function (re) validator(re.result)),
regexpmap: function regexpmap(vals, validator) vals.every(re => validator(re.result)),
get sitemap() this.regexpmap,
stringlist: function stringlist(vals, validator) vals.every(validator, this),
stringmap: function stringmap(vals, validator) values(vals).every(validator, this)
@@ -587,7 +587,7 @@ var Option = Class("Option", {
return res;
},
quote: function quote(str, re) isArray(str) ? str.map(function (s) quote(s, re)).join(",") :
quote: function quote(str, re) isArray(str) ? str.map(s => quote(s, re)).join(",") :
Commands.quoteArg[/[\s|"'\\,]|^$/.test(str) || re && re.test && re.test(str)
? (/[\b\f\n\r\t]/.test(str) ? '"' : "'")
: ""](str, re),
@@ -671,7 +671,7 @@ var Option = Class("Option", {
function uniq(ary) {
let seen = {};
return ary.filter(function (elem) !Set.add(seen, elem));
return ary.filter(elem => !Set.add(seen, elem));
}
switch (operator) {
@@ -716,7 +716,7 @@ var Option = Class("Option", {
function completions(extra) {
let context = CompletionContext("");
return context.fork("", 0, this, this.completer, extra) ||
context.allItems.items.map(function (item) [item.text]);
context.allItems.items.map(item => [item.text]);
};
if (isObject(vals) && !isArray(vals)) {
@@ -731,10 +731,10 @@ var Option = Class("Option", {
acceptable = completions.call(this);
if (isArray(acceptable))
acceptable = Set(acceptable.map(function ([k]) k));
acceptable = Set(acceptable.map(([k]) => k));
if (this.type === "regexpmap" || this.type === "sitemap")
return Array.concat(vals).every(function (re) Set.has(acceptable, re.result));
return Array.concat(vals).every(re => Set.has(acceptable, re.result));
return Array.concat(vals).every(Set.has(acceptable));
},
@@ -821,7 +821,7 @@ var Options = Module("options", {
opt.set(opt.globalValue, Option.SCOPE_GLOBAL, true);
}, window);
modules.cache.register("options.dtd", function ()
modules.cache.register("options.dtd", () =>
util.makeDTD(
iter(([["option", o.name, "default"].join("."),
o.type === "string" ? o.defaultValue.replace(/'/g, "''") :
@@ -877,7 +877,7 @@ var Options = Module("options", {
else if (isArray(opt.value) && opt.type != "charlist")
option.value = ["", "=",
template.map(opt.value,
function (v) template.highlight(String(v)),
v => template.highlight(String(v)),
["", ",",
["span", { style: "width: 0; display: inline-block" }, " "]])];
else
@@ -927,7 +927,7 @@ var Options = Module("options", {
let closure = () => this._optionMap[name];
memoize(this._optionMap, name, function () Option.types[type](modules, names, description, defaultValue, extraInfo));
memoize(this._optionMap, name, () => Option.types[type](modules, names, description, defaultValue, extraInfo));
for (let alias in values(names.slice(1)))
memoize(this._optionMap, alias, closure);
@@ -948,7 +948,7 @@ var Options = Module("options", {
/** @property {Iterator(Option)} @private */
__iterator__: function __iterator__()
values(this._options.sort(function (a, b) String.localeCompare(a.name, b.name))),
values(this._options.sort((a, b) => String.localeCompare(a.name, b.name))),
allPrefs: deprecated("prefs.getNames", function allPrefs() prefs.getNames.apply(prefs, arguments)),
getPref: deprecated("prefs.get", function getPref() prefs.get.apply(prefs, arguments)),
@@ -963,7 +963,7 @@ var Options = Module("options", {
setPref: deprecated("prefs.set", function setPref() prefs.set.apply(prefs, arguments)),
withContext: deprecated("prefs.withContext", function withContext() prefs.withContext.apply(prefs, arguments)),
cleanupPrefs: Class.Memoize(function () config.prefs.Branch("cleanup.option.")),
cleanupPrefs: Class.Memoize(() => config.prefs.Branch("cleanup.option.")),
cleanup: function cleanup(reason) {
if (~["disable", "uninstall"].indexOf(reason))
@@ -1059,7 +1059,7 @@ var Options = Module("options", {
*/
remove: function remove(name) {
let opt = this.get(name);
this._options = this._options.filter(function (o) o != opt);
this._options = this._options.filter(o => o != opt);
for (let name in values(opt.names))
delete this._optionMap[name];
},
@@ -1095,12 +1095,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(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);
if (list.some(opt => opt.all))
options.list(opt => !(list[0].onlyNonDefault && opt.isDefault), list[0].scope);
else
options.list(function (opt) Set.has(names, opt.name), list[0].scope);
options.list(opt => Set.has(names, opt.name), list[0].scope);
list = [];
}
@@ -1212,11 +1212,11 @@ var Options = Module("options", {
context.advance(filter.length);
filter = filter.substr(0, filter.length - 1);
context.pushProcessor(0, function (item, text, next) next(item, text.substr(0, 100)));
context.pushProcessor(0, (item, text, next) => next(item, text.substr(0, 100)));
context.completions = [
[prefs.get(filter), _("option.currentValue")],
[prefs.defaults.get(filter), _("option.defaultValue")]
].filter(function (k) k[0] != null);
].filter(k => k[0] != null);
return null;
}
@@ -1229,7 +1229,7 @@ var Options = Module("options", {
context.highlight();
if (context.filter.indexOf("=") == -1) {
if (false && prefix)
context.filters.push(function ({ item }) item.type == "boolean" || prefix == "inv" && isArray(item.values));
context.filters.push(({ item }) => item.type == "boolean" || prefix == "inv" && isArray(item.values));
return completion.option(context, opt.scope, opt.name == "inv" ? opt.name : prefix);
}
@@ -1256,11 +1256,11 @@ var Options = Module("options", {
if (!opt.value && !opt.operator && !opt.invert) {
context.fork("default", 0, this, function (context) {
context.title = ["Extra Completions"];
context.pushProcessor(0, function (item, text, next) next(item, text.substr(0, 100)));
context.pushProcessor(0, (item, text, next) => next(item, text.substr(0, 100)));
context.completions = [
[option.stringValue, _("option.currentValue")],
[option.stringDefaultValue, _("option.defaultValue")]
].filter(function (f) f[0] !== "");
].filter(f => f[0] !== "");
context.quote = ["", util.identity, ""];
});
}
@@ -1275,10 +1275,10 @@ var Options = Module("options", {
context.anchored = optcontext.anchored;
context.maxItems = optcontext.maxItems;
context.filters.push(function (i) !Set.has(have, i.text));
context.filters.push(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, ""]);
context.generate = () => option.value.map(o => [o, ""]);
});
context.title = ["Current values"];
}
@@ -1426,11 +1426,11 @@ var Options = Module("options", {
context.anchored = false;
context.completions = modules.options;
if (prefix == "inv")
context.keys.text = function (opt)
opt.type == "boolean" || isArray(opt.value) ? opt.names.map(function (n) "inv" + n)
context.keys.text = opt =>
opt.type == "boolean" || isArray(opt.value) ? opt.names.map(n => "inv" + n)
: opt.names;
if (scope)
context.filters.push(function ({ item }) item.scope & scope);
context.filters.push(({ item }) => item.scope & scope);
};
completion.optionValue = function (context, name, op, curValue, completer) {
@@ -1484,7 +1484,7 @@ var Options = Module("options", {
function val(obj) {
if (isArray(opt.defaultValue)) {
let val = array.nth(obj, function (re) re.key == extra.key, 0);
let val = array.nth(obj, re => re.key == extra.key, 0);
return val && val.result;
}
if (Set.has(opt.defaultValue, extra.key))
@@ -1496,7 +1496,7 @@ var Options = Module("options", {
context.completions = [
[val(opt.value), _("option.currentValue")],
[val(opt.defaultValue), _("option.defaultValue")]
].filter(function (f) f[0] !== "" && f[0] != null);
].filter(f => f[0] !== "" && f[0] != null);
});
context = context.fork("stuff", 0);
}
@@ -1506,17 +1506,17 @@ var Options = Module("options", {
// Not Vim compatible, but is a significant enough improvement
// that it's worth breaking compatibility.
if (isArray(newValues)) {
context.filters.push(function (i) newValues.indexOf(i.text) == -1);
context.filters.push(i => newValues.indexOf(i.text) == -1);
if (op == "+")
context.filters.push(function (i) curValues.indexOf(i.text) == -1);
context.filters.push(i => curValues.indexOf(i.text) == -1);
if (op == "-")
context.filters.push(function (i) curValues.indexOf(i.text) > -1);
context.filters.push(i => curValues.indexOf(i.text) > -1);
memoize(extra, "values", function () {
if (op == "+")
return curValues.concat(newValues);
if (op == "-")
return curValues.filter(function (v) newValues.indexOf(val) == -1);
return curValues.filter(v => newValues.indexOf(val) == -1);
return newValues;
});
}
@@ -1528,7 +1528,7 @@ var Options = Module("options", {
},
javascript: function initJavascript(dactyl, modules, window) {
const { options, JavaScript } = modules;
JavaScript.setCompleter(Options.prototype.get, [function () ([o.name, o.description] for (o in options))]);
JavaScript.setCompleter(Options.prototype.get, [() => ([o.name, o.description] for (o in options))]);
},
sanitizer: function initSanitizer(dactyl, modules, window) {
const { sanitizer } = modules;

View File

@@ -27,8 +27,8 @@ var Overlay = Class("Overlay", {
this.window = window;
},
cleanups: Class.Memoize(function () []),
objects: Class.Memoize(function () ({})),
cleanups: Class.Memoize(() => []),
objects: Class.Memoize(() => ({})),
get doc() this.window.document,
@@ -52,7 +52,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
this.onWindowVisible = [];
},
id: Class.Memoize(function () config.addon.id),
id: Class.Memoize(() => config.addon.id),
/**
* Adds an event listener for this session and removes it on
@@ -148,7 +148,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
"content-document-global-created": function (window, uri) { this.observe(window, "toplevel-window-ready", null); },
"xul-window-visible": function () {
if (this.onWindowVisible)
this.onWindowVisible.forEach(function (f) f.call(this), this);
this.onWindowVisible.forEach(function (f) { f.call(this); }, this);
this.onWindowVisible = null;
}
},
@@ -281,10 +281,10 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
}
}
insert("before", function (elem, dom) elem.parentNode.insertBefore(dom, elem));
insert("after", function (elem, dom) elem.parentNode.insertBefore(dom, elem.nextSibling));
insert("append", function (elem, dom) elem.appendChild(dom));
insert("prepend", function (elem, dom) elem.insertBefore(dom, elem.firstChild));
insert("before", (elem, dom) => elem.parentNode.insertBefore(dom, elem));
insert("after", (elem, dom) => elem.parentNode.insertBefore(dom, elem.nextSibling));
insert("append", (elem, dom) => elem.appendChild(dom));
insert("prepend", (elem, dom) => elem.insertBefore(dom, elem.firstChild));
if (obj.ready)
util.trapErrors("ready", obj, window);
@@ -412,19 +412,19 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
get activeModules() this.activeWindow && this.activeWindow.dactyl.modules,
get modules() this.windows.map(function (w) w.dactyl.modules),
get modules() this.windows.map(w => w.dactyl.modules),
/**
* The most recently active dactyl window.
*/
get activeWindow() this.windows[0],
set activeWindow(win) this.windows = [win].concat(this.windows.filter(function (w) w != win)),
set activeWindow(win) this.windows = [win].concat(this.windows.filter(w => w != win)),
/**
* A list of extant dactyl windows.
*/
windows: Class.Memoize(function () [])
windows: Class.Memoize(() => [])
});
endModule();

View File

@@ -428,7 +428,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
},
javascript: function init_javascript(dactyl, modules) {
modules.JavaScript.setCompleter([this.get, this.safeSet, this.set, this.reset, this.toggle],
[function (context) (context.anchored=false, this.getNames().map(function (pref) [pref, ""]))]);
[function (context) (context.anchored=false, this.getNames().map(pref => [pref, ""]))]);
}
});

View 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) {
@@ -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,11 @@ 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 +679,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 +698,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 {

View File

@@ -126,7 +126,7 @@ var Services = Module("Services", {
if (!service.interfaces.length)
return res.wrappedJSObject || res;
service.interfaces.forEach(function (iface) res instanceof Ci[iface]);
service.interfaces.forEach(iface => res instanceof Ci[iface]);
if (service.init && args.length) {
if (service.callable)
res[service.init].apply(res, args);
@@ -162,7 +162,7 @@ var Services = Module("Services", {
this.services[name] = { method: meth, class: class_, interfaces: Array.concat(ifaces || []) };
if (name in this && ifaces && !this.__lookupGetter__(name) && !(this[name] instanceof Ci.nsISupports))
throw TypeError();
memoize(this, name, function () self._create(name));
memoize(this, name, () => self._create(name));
},
/**
@@ -206,7 +206,7 @@ var Services = Module("Services", {
* @param {string} name The service's cache key.
*/
has: function has(name) Set.has(this.services, name) && this.services[name].class in Cc &&
this.services[name].interfaces.every(function (iface) iface in Ci)
this.services[name].interfaces.every(iface => iface in Ci)
});
endModule();

View File

@@ -27,8 +27,8 @@ var StoreBase = Class("StoreBase", {
this._load = load;
this._options = options;
this.__defineGetter__("store", function () store);
this.__defineGetter__("name", function () name);
this.__defineGetter__("store", () => store);
this.__defineGetter__("name", () => name);
for (let [k, v] in Iterator(options))
if (this.OPTIONS.indexOf(k) >= 0)
this[k] = v;
@@ -224,7 +224,7 @@ var Storage = Module("Storage", {
delete this.dactylSession[key];
},
infoPath: Class.Memoize(function ()
infoPath: Class.Memoize(() =>
File(IO.runtimePath.replace(/,.*/, ""))
.child("info").child(config.profileName)),
@@ -292,7 +292,7 @@ var Storage = Module("Storage", {
if (!(key in this.observers))
this.observers[key] = [];
if (!this.observers[key].some(function (o) o.callback.get() == callback))
if (!this.observers[key].some(o => o.callback.get() == callback))
this.observers[key].push({ ref: ref && Cu.getWeakReference(ref), callback: callbackRef });
},
@@ -302,7 +302,7 @@ var Storage = Module("Storage", {
if (!(key in this.observers))
return;
this.observers[key] = this.observers[key].filter(function (elem) elem.callback.get() != callback);
this.observers[key] = this.observers[key].filter(elem => elem.callback.get() != callback);
if (this.observers[key].length == 0)
delete obsevers[key];
},
@@ -427,7 +427,7 @@ var File = Class("File", {
return this;
},
charset: Class.Memoize(function () File.defaultEncoding),
charset: Class.Memoize(() => File.defaultEncoding),
/**
* @property {nsIFileURL} Returns the nsIFileURL object for this file.
@@ -495,7 +495,7 @@ var File = Class("File", {
let array = [e for (e in this.iterDirectory())];
if (sort)
array.sort(function (a, b) b.isDirectory() - a.isDirectory() || String.localeCompare(a.path, b.path));
array.sort((a, b) => b.isDirectory() - a.isDirectory() || String.localeCompare(a.path, b.path));
return array;
},
@@ -695,7 +695,7 @@ var File = Class("File", {
function expand(path) path.replace(
!win32 ? /\$(\w+)\b|\${(\w+)}/g
: /\$(\w+)\b|\${(\w+)}|%(\w+)%/g,
function (m, n1, n2, n3) getenv(n1 || n2 || n3) || m
(m, n1, n2, n3) => getenv(n1 || n2 || n3) || m
);
path = expand(path);

View File

@@ -63,7 +63,7 @@ update(Sheet.prototype, {
match: function (uri) {
if (isString(uri))
uri = util.newURI(uri);
return this.sites.some(function (site) Styles.matchFilter(site, uri));
return this.sites.some(site => Styles.matchFilter(site, uri));
},
get fullCSS() {
@@ -74,7 +74,7 @@ update(Sheet.prototype, {
if (filter[0] == "*")
return preamble + css;
let selectors = filter.map(function (part)
let selectors = filter.map(part =>
!/^(?:[a-z-]+[:*]|[a-z-.]+$)/i.test(part) ? "regexp(" + Styles.quote(".*(?:" + part + ").*") + ")" :
(/[*]$/.test(part) ? "url-prefix" :
/[\/:]/.test(part) ? "url"
@@ -102,10 +102,10 @@ var Hive = Class("Hive", {
this.dropRef(null);
},
dropRef: function (obj) {
this.refs = this.refs.filter(function (ref) ref.get() && ref.get() !== obj);
this.refs = this.refs.filter(ref => ref.get() && ref.get() !== obj);
if (!this.refs.length) {
this.cleanup();
styles.hives = styles.hives.filter(function (h) h !== this, this);
styles.hives = styles.hives.filter(h => h !== this);
}
},
@@ -116,7 +116,7 @@ var Hive = Class("Hive", {
__iterator__: function () Iterator(this.sheets),
get sites() array(this.sheets).map(function (s) s.sites).flatten().uniq().array,
get sites() array(this.sheets).map(s => s.sites).flatten().uniq().array,
/**
* Add a new style sheet.
@@ -182,14 +182,14 @@ var Hive = Class("Hive", {
// Grossly inefficient.
let matches = [k for ([k, v] in Iterator(this.sheets))];
if (index)
matches = String(index).split(",").filter(function (i) i in this.sheets, this);
matches = String(index).split(",").filter(i => i in this.sheets);
if (name)
matches = matches.filter(function (i) this.sheets[i].name == name, this);
matches = matches.filter(i => this.sheets[i].name == name);
if (css)
matches = matches.filter(function (i) this.sheets[i].css == css, this);
matches = matches.filter(i => this.sheets[i].css == css);
if (filter)
matches = matches.filter(function (i) this.sheets[i].sites.indexOf(filter) >= 0, this);
return matches.map(function (i) this.sheets[i], this);
matches = matches.filter(i => this.sheets[i].sites.indexOf(filter) >= 0);
return matches.map(i => this.sheets[i]);
},
/**
@@ -222,7 +222,7 @@ var Hive = Class("Hive", {
for (let [, sheet] in Iterator(matches.reverse())) {
if (filter) {
let sites = sheet.sites.filter(function (f) f != filter);
let sites = sheet.sites.filter(f => f != filter);
if (sites.length) {
sheet.sites = sites;
continue;
@@ -233,7 +233,7 @@ var Hive = Class("Hive", {
delete this.names[sheet.name];
delete styles.allSheets[sheet.id];
}
this.sheets = this.sheets.filter(function (s) matches.indexOf(s) == -1);
this.sheets = this.sheets.filter(s => matches.indexOf(s) == -1);
return matches.length;
},
});
@@ -273,7 +273,7 @@ var Styles = Module("Styles", {
},
addHive: function addHive(name, ref, persist) {
let hive = array.nth(this.hives, function (h) h.name === name, 0);
let hive = array.nth(this.hives, h => h.name === name, 0);
if (!hive) {
hive = Hive(name, persist);
this.hives.push(hive);
@@ -304,13 +304,13 @@ var Styles = Module("Styles", {
list: function list(content, sites, name, hives) {
const { commandline, dactyl } = this.modules;
hives = hives || styles.hives.filter(function (h) h.modifiable && h.sheets.length);
hives = hives || styles.hives.filter(h => h.modifiable && h.sheets.length);
function sheets(group)
group.sheets.slice()
.filter(function (sheet) (!name || sheet.name === name) &&
(!sites || sites.every(function (s) sheet.sites.indexOf(s) >= 0)))
.sort(function (a, b) a.name && b.name ? String.localeCompare(a.name, b.name)
.filter(sheet => (!name || sheet.name === name) &&
(!sites || sites.every(s => sheet.sites.indexOf(s) >= 0)))
.sort((a, b) => a.name && b.name ? String.localeCompare(a.name, b.name)
: !!b.name - !!a.name || a.id - b.id);
let uris = util.visibleURIs(content);
@@ -326,9 +326,9 @@ var Styles = Module("Styles", {
["col", { style: "min-width: 1em; text-align: center; color: red; font-weight: bold;" }],
["col", { style: "padding: 0 1em 0 1ex; vertical-align: top;" }],
["col", { style: "padding: 0 1em 0 0; vertical-align: top;" }],
template.map(hives, function (hive) let (i = 0) [
template.map(hives, hive => let (i = 0) [
["tr", { style: "height: .5ex;" }],
template.map(sheets(hive), function (sheet)
template.map(sheets(hive), sheet =>
["tr", {},
["td", { highlight: "Title" }, !i++ ? hive.name : ""],
["td", {}, sheet.enabled ? "" : UTF8("×")],
@@ -369,7 +369,7 @@ var Styles = Module("Styles", {
props[prop.name] = prop.value;
let val = Object.keys(props)[sort ? "sort" : "slice"]()
.map(function (prop) prop + ": " + props[prop] + ";")
.map(prop => prop + ": " + props[prop] + ";")
.join(" ");
if (/^\s*(\/\*.*?\*\/)/.exec(src))
@@ -393,13 +393,13 @@ var Styles = Module("Styles", {
let uris = util.visibleURIs(content);
context.generate = function () values(group.sites);
context.generate = () => values(group.sites);
context.keys.text = util.identity;
context.keys.description = function (site) this.sheets.length + /*L*/" sheet" + (this.sheets.length == 1 ? "" : "s") + ": " +
array.compact(this.sheets.map(function (s) s.name)).join(", ");
context.keys.sheets = function (site) group.sheets.filter(function (s) s.sites.indexOf(site) >= 0);
context.keys.active = function (site) uris.some(Styles.matchFilter(site));
array.compact(this.sheets.map(s => s.name)).join(", ");
context.keys.sheets = site => group.sheets.filter(s => s.sites.indexOf(site) >= 0);
context.keys.active = site => uris.some(Styles.matchFilter(site));
Styles.splitContext(context, "Sites");
},
@@ -445,7 +445,7 @@ var Styles = Module("Styles", {
let [name, active] = item;
context.split(name, null, function (context) {
context.title[0] = /*L*/name + " " + (title || "Sheets");
context.filters.push(function (item) !!item.active == active);
context.filters.push(item => !!item.active == active);
});
}
},
@@ -548,11 +548,11 @@ var Styles = Module("Styles", {
function sheets(context, args, filter) {
let uris = util.visibleURIs(window.content);
context.compare = modules.CompletionContext.Sort.number;
context.generate = function () args["-group"].sheets;
context.keys.active = function (sheet) uris.some(sheet.closure.match);
context.keys.description = function (sheet) [sheet.formatSites(uris), ": ", sheet.css.replace("\n", "\\n")];
context.generate = () => args["-group"].sheets;
context.keys.active = sheet => uris.some(sheet.closure.match);
context.keys.description = sheet => [sheet.formatSites(uris), ": ", sheet.css.replace("\n", "\\n")];
if (filter)
context.filters.push(function ({ item }) filter(item));
context.filters.push(({ item }) => filter(item));
Styles.splitContext(context);
}
@@ -561,8 +561,8 @@ var Styles = Module("Styles", {
description: "The name of this stylesheet",
type: modules.CommandOption.STRING,
completer: function (context, args) {
context.keys.text = function (sheet) sheet.name;
context.filters.unshift(function ({ item }) item.name);
context.keys.text = sheet => sheet.name;
context.filters.unshift(({ item }) => item.name);
sheets(context, args, filter);
}
});
@@ -619,11 +619,11 @@ var Styles = Module("Styles", {
],
serialize: function ()
array(styles.hives)
.filter(function (hive) hive.persist)
.map(function (hive)
hive.sheets.filter(function (style) style.persist)
.sort(function (a, b) String.localeCompare(a.name || "", b.name || ""))
.map(function (style) ({
.filter(hive => hive.persist)
.map(hive =>
hive.sheets.filter(style => style.persist)
.sort((a, b) => String.localeCompare(a.name || "", b.name || ""))
.map(style => ({
command: "style",
arguments: [style.sites.join(",")],
literalArg: style.css,
@@ -673,7 +673,7 @@ var Styles = Module("Styles", {
Styles.completeSite(context, window.content, args["-group"]);
if (cmd.filter)
context.filters.push(function ({ sheets }) sheets.some(cmd.filter));
context.filters.push(({ sheets }) => sheets.some(cmd.filter));
},
literal: 1,
options: [
@@ -682,7 +682,7 @@ var Styles = Module("Styles", {
names: ["-index", "-i"],
type: modules.CommandOption.INT,
completer: function (context, args) {
context.keys.text = function (sheet) args["-group"].sheets.indexOf(sheet);
context.keys.text = sheet => args["-group"].sheets.indexOf(sheet);
sheets(context, args, cmd.filter);
}
},
@@ -728,10 +728,10 @@ var Styles = Module("Styles", {
};
},
javascript: function initJavascript(dactyl, modules, window) {
modules.JavaScript.setCompleter(["get", "add", "remove", "find"].map(function (m) Hive.prototype[m]),
modules.JavaScript.setCompleter(["get", "add", "remove", "find"].map(m => Hive.prototype[m]),
[ // Prototype: (name, filter, css, index)
function (context, obj, args) this.names,
function (context, obj, args) Styles.completeSite(context, window.content),
(context, obj, args) => Styles.completeSite(context, window.content),
null,
function (context, obj, args) this.sheets
]);
@@ -756,7 +756,7 @@ var Styles = Module("Styles", {
if (match.string)
return ["span", { highlight: "String" }, match.string];
return template._highlightRegexp(match.wholeMatch, /^(\d+)(em|ex|px|in|cm|mm|pt|pc)?/g,
function (m, n, u) [
(m, n, u) => [
["span", { highlight: "Number" }, n],
["span", { highlight: "Object" }, u || ""]
]);

View File

@@ -172,7 +172,7 @@ var Template = Module("Template", {
!(item.extra && item.extra.length) ? [] :
["span", { highlight: "URLExtra" },
" (",
template.map(item.extra, function (e)
template.map(item.extra, e =>
["", e[0], ": ",
["span", { highlight: e[2] }, e[1]]],
"\u00a0"),
@@ -278,8 +278,8 @@ var Template = Module("Template", {
}
},
_sandbox: Class.Memoize(function () Cu.Sandbox(Cu.getGlobalForObject(global),
{ wantXrays: false })),
_sandbox: Class.Memoize(() => Cu.Sandbox(Cu.getGlobalForObject(global),
{ wantXrays: false })),
// if "processStrings" is true, any passed strings will be surrounded by " and
// any line breaks are displayed as \n
@@ -403,7 +403,7 @@ var Template = Module("Template", {
["th", {}, _("title.VPos")],
["th", {}, _("title.Title")],
["th", {}, _("title.URI")]],
this.map(Iterator(elems), function ([idx, val])
this.map(Iterator(elems), ([idx, val]) =>
["tr", {},
["td", { class: "indicator" }, idx == index ? ">" : ""],
["td", {}, Math.abs(idx - index)],
@@ -419,7 +419,7 @@ var Template = Module("Template", {
return ["table", {},
["tr", { highlight: "Title", align: "left" },
["th", {}, "--- " + title + " ---"]],
this.map(opts, function (opt)
this.map(opts, opt =>
["tr", {},
["td", {},
["div", { highlight: "Message" },
@@ -446,7 +446,7 @@ var Template = Module("Template", {
let table = ["table", {},
["tr", { highlight: "Title", align: "left" },
["th", { colspan: "2" }, title]],
this.map(data, function (datum)
this.map(data, datum =>
["tr", {},
["td", { style: "font-weight: bold; min-width: 150px; padding-left: " + (indent || "2ex") }, datum[0]],
["td", {}, datum[1]]])];
@@ -463,7 +463,7 @@ var Template = Module("Template", {
["th", {}, h])],
this.map(iter, (row) =>
["tr", {},
this.map(Iterator(row), function ([i, d])
this.map(Iterator(row), ([i, d]) =>
["td", { style: style[i] || "" }, d])])];
},

View File

@@ -161,7 +161,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
}
});
obj.observe.unregister = function () register("removeObserver");
obj.observe.unregister = () => register("removeObserver");
register("addObserver");
}, { dump: dump, Error: Error }),
@@ -185,7 +185,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @param {string} name The name to mangle.
* @returns {string} The mangled name.
*/
camelCase: function camelCase(name) String.replace(name, /-(.)/g, function (m, m1) m1.toUpperCase()),
camelCase: function camelCase(name) String.replace(name, /-(.)/g, (m, m1) => m1.toUpperCase()),
/**
* Capitalizes the first character of the given string.
@@ -262,11 +262,11 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
function frame() update(
function _frame(obj)
_frame === stack.top || _frame.valid(obj) ?
_frame.elements.map(function (e) callable(e) ? e(obj) : e).join("") : "",
_frame.elements.map(e => callable(e) ? e(obj) : e).join("") : "",
{
elements: [],
seen: {},
valid: function valid(obj) this.elements.every(function (e) !e.test || e.test(obj))
valid: function valid(obj) this.elements.every(e => !e.test || e.test(obj))
});
let end = 0;
@@ -295,7 +295,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
char = char.toLowerCase();
stack.top.elements.push(update(
function (obj) obj[char] != null ? quote(obj, char) : "",
obj => obj[char] != null ? quote(obj, char) : "",
{ test: function test(obj) obj[char] != null }));
for (let elem in array.iterValues(stack))
@@ -340,16 +340,16 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
let unknown = util.identity;
if (!keepUnknown)
unknown = function () "";
unknown = () => "";
function frame() update(
function _frame(obj)
_frame === stack.top || _frame.valid(obj) ?
_frame.elements.map(function (e) callable(e) ? e(obj) : e).join("") : "",
_frame.elements.map(e => callable(e) ? e(obj) : e).join("") : "",
{
elements: [],
seen: {},
valid: function valid(obj) this.elements.every(function (e) !e.test || e.test(obj))
valid: function valid(obj) this.elements.every(e => !e.test || e.test(obj))
});
let defaults = { lt: "<", gt: ">" };
@@ -396,7 +396,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
if (idx) {
idx = Number(idx) - 1;
stack.top.elements.push(update(
function (obj) obj[name] != null && idx in obj[name] ? quote(obj[name][idx])
obj => obj[name] != null && idx in obj[name] ? quote(obj[name][idx])
: Set.has(obj, name) ? "" : unknown(full),
{
test: function test(obj) obj[name] != null && idx in obj[name]
@@ -406,7 +406,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
}
else {
stack.top.elements.push(update(
function (obj) obj[name] != null ? quote(obj[name])
obj => obj[name] != null ? quote(obj[name])
: Set.has(obj, name) ? "" : unknown(full),
{
test: function test(obj) obj[name] != null
@@ -491,7 +491,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
fn(match);
}
res.push(pattern.substr(end));
return res.map(function (s) util.dequote(s, dequote));
return res.map(s => util.dequote(s, dequote));
};
let patterns = [];
@@ -539,7 +539,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @returns {string}
*/
dequote: function dequote(pattern, chars)
pattern.replace(/\\(.)/, function (m0, m1) chars.indexOf(m1) >= 0 ? m1 : m0),
pattern.replace(/\\(.)/, (m0, m1) => chars.indexOf(m1) >= 0 ? m1 : m0),
/**
* Returns the nsIDocShell for the given window.
@@ -747,7 +747,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
httpGet: function httpGet(url, callback, self) {
let params = callback;
if (!isObject(params))
params = { callback: params && function () callback.apply(self, arguments) };
params = { callback: params && (() => callback.apply(self, arguments)) };
try {
let xmlhttp = services.Xmlhttp();
@@ -868,7 +868,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* top-level window and sub-frames thereof.
*/
iterDocuments: function iterDocuments(types) {
types = types ? types.map(function (s) "type" + util.capitalize(s))
types = types ? types.map(s => "type" + util.capitalize(s))
: ["typeChrome", "typeContent"];
let windows = services.windowMediator.getXULWindowEnumerator(null);
@@ -887,7 +887,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
},
// ripped from Firefox; modified
unsafeURI: Class.Memoize(function () util.regexp(String.replace(literal(/*
unsafeURI: Class.Memoize(() => util.regexp(String.replace(literal(/*
[
\s
// Invisible characters (bug 452979)
@@ -933,10 +933,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
: val,
isDOM ? /['%]/g
: /['"%&<>]/g,
function (m) map[m]);
m => map[m]);
}
return iter(obj).map(function ([k, v])
return iter(obj).map(([k, v]) =>
["<!ENTITY ", k, " '", escape(v), "'>"].join(""))
.join("\n");
},
@@ -1066,7 +1066,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
return String.localeCompare(a[0], b[0]);
}
let vals = template.map(keys.sort(compare), function (f) f[1], "\n");
let vals = template.map(keys.sort(compare), f => f[1], "\n");
if (color) {
return ["div", { style: "white-space: pre-wrap" }, head, vals];
}
@@ -1245,14 +1245,14 @@ 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);
(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))
expr = String.replace(expr, /(\\.)|\/\/[^\n]*|\/\*[^]*?\*\/|\s+/gm, function (m, m1) m1 || "");
expr = String.replace(expr, /(\\.)|\/\/[^\n]*|\/\*[^]*?\*\/|\s+/gm, (m, m1) => m1 || "");
// Replace (?P<named> parameters)
if (/\(\?P</.test(expr)) {
@@ -1296,7 +1296,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @param {RegExp} re The regexp showable source of which is to be returned.
* @returns {string}
*/
getSource: function regexp_getSource(re) re.source.replace(/\\(.)/g, function (m0, m1) m1 === "/" ? "/" : m0),
getSource: function regexp_getSource(re) re.source.replace(/\\(.)/g, (m0, m1) => m1 === "/" ? "/" : m0),
/**
* Iterates over all matches of the given regexp in the given
@@ -1345,7 +1345,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
},
errorCount: 0,
errors: Class.Memoize(function () []),
errors: Class.Memoize(() => []),
maxErrors: 15,
/**
* Reports an error to the Error Console and the standard output,
@@ -1411,7 +1411,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
let ary = host.split(".");
ary = [ary.slice(i).join(".") for (i in util.range(ary.length, 0, -1))];
return ary.filter(function (h) h.length >= base.length);
return ary.filter(h => h.length >= base.length);
},
/**
@@ -1669,7 +1669,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(h => !Set.add(seen, h));
},
/**
@@ -1688,7 +1688,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(h => !Set.add(seen, h.spec));
},
/**