diff --git a/common/bootstrap.js b/common/bootstrap.js index 76c5437f..a840d7dc 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -357,7 +357,7 @@ function startup(data, reason) { addonData = data; addon = data; name = data.id.replace(/@.*/, ""); - AddonManager.getAddonByID(addon.id, function (a) { + AddonManager.getAddonByID(addon.id, a => { addon = a; updateVersion(); diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index 180c3751..159d21d8 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -432,10 +432,10 @@ var Bookmarks = Module("bookmarks", { names: ["-tags", "-T"], description: "A comma-separated list of tags", completer: function tags(context) { - context.generate = function () Ary(b.tags - for (b of bookmarkcache) - if (b.tags)) - .flatten().uniq().array; + context.generate = () => Ary(b.tags + for (b of bookmarkcache) + if (b.tags)) + .flatten().uniq().array; context.keys = { text: util.identity, description: util.identity }; }, type: CommandOption.LIST @@ -561,7 +561,7 @@ var Bookmarks = Module("bookmarks", { function (args) { if (args.bang) commandline.input(_("bookmark.prompt.deleteAll") + " ").then( - function (resp) { + resp => { if (resp && resp.match(/^y(es)?$/i)) { bookmarks.remove(Object.keys(bookmarkcache.bookmarks)); dactyl.echomsg(_("bookmark.allDeleted")); @@ -680,12 +680,12 @@ var Bookmarks = Module("bookmarks", { let item = keywords[keyword]; if (item && item.url.contains("%s")) - context.fork("keyword/" + keyword, keyword.length + space.length, null, function (context) { + context.fork("keyword/" + keyword, keyword.length + space.length, null, context => { context.format = history.format; context.title = [/*L*/keyword + " Quick Search"]; context.keys = { text: "url", description: "title", icon: "icon" }; context.compare = CompletionContext.Sort.unsorted; - context.generate = function () { + context.generate = () => { let [begin, end] = item.url.split("%s"); let seen = new RealSet; diff --git a/common/content/commandline.js b/common/content/commandline.js index 9de5c705..6697156c 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -271,8 +271,8 @@ var CommandWidgets = Class("CommandWidgets", { active: Class.Memoize(Object), activeGroup: Class.Memoize(Object), - commandbar: Class.Memoize(function () ({ group: "Cmd" })), - statusbar: Class.Memoize(function () ({ group: "Status" })), + commandbar: Class.Memoize(() => ({ group: "Cmd" })), + statusbar: Class.Memoize(() => ({ group: "Status" })), _ready: function _ready(elem) { return elem.contentDocument.documentURI === elem.getAttribute("src") && @@ -505,7 +505,7 @@ var CommandLine = Module("commandline", { init: function init() { this._callbacks = {}; - memoize(this, "_store", function () storage.newMap("command-history", { store: true, privateData: true })); + memoize(this, "_store", () => storage.newMap("command-history", { store: true, privateData: true })); for (let name of ["command", "search"]) if (storage.exists("history-" + name)) { @@ -778,7 +778,7 @@ var CommandLine = Module("commandline", { highlightGroup = highlightGroup || this.HL_NORMAL; - let appendToMessages = (data) => { + let appendToMessages = data => { let message = isObject(data) && !DOM.isJSONXML(data) ? data : { message: data }; // Make sure the memoized message property is an instance property. @@ -1797,7 +1797,7 @@ var CommandLine = Module("commandline", { self.completions.tabTimer.flush(); self.accepted = true; - return function () { modes.pop(); }; + return () => { modes.pop(); }; }); [ @@ -2347,7 +2347,7 @@ var ItemList = Class("ItemList", { var scrollY = this.win.scrollY + rect.bottom - this.win.innerHeight; } - return function () { + return () => { container.style.height = height + "px"; container.scrollTop = scroll; if (scrollY != null) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 38127a74..be80ed05 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -26,9 +26,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { this._observers = {}; util.addObserver(this); - this.commands["dactyl.restart"] = function (event) { - dactyl.restart(); - }; + this.commands["dactyl.restart"] = event => { dactyl.restart(); }; styles.registerSheet("resource://dactyl-skin/dactyl.css"); @@ -852,7 +850,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { event.preventDefault(); if (dactyl.commands[command]) - dactyl.withSavedValues(["forceTarget"], function () { + dactyl.withSavedValues(["forceTarget"], () => { if (event.ctrlKey || event.shiftKey || event.button == 1) dactyl.forceTarget = dactyl.NEW_TAB; dactyl.commands[command](event); @@ -1199,7 +1197,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { let saved = save.map(p => dactyl[p]); return function wrappedCallback() { let args = arguments; - return dactyl.withSavedValues(save, function () { + return dactyl.withSavedValues(save, () => { saved.forEach((p, i) => { dactyl[save[i]] = p; }); try { return callback.apply(self, args); @@ -1222,7 +1220,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { elem.getAttribute("collapsed")) }, { cache: function initCache() { - cache.register("help/plugins.xml", function () { + cache.register("help/plugins.xml", () => { // Process plugin help entries. let body = []; @@ -1268,7 +1266,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { body]); }, true); - cache.register("help/index.xml", function () { + cache.register("help/index.xml", () => { return '\n' + DOM.toXML(["overlay", { xmlns: "dactyl" }, template.map(iter(dactyl.indices), @@ -1278,7 +1276,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { "\n\n")]); }, true); - cache.register("help/gui.xml", function () { + cache.register("help/gui.xml", () => { return '\n' + DOM.toXML(["overlay", { xmlns: "dactyl" }, ["dl", { insertafter: "dialog-list" }, @@ -1291,7 +1289,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { "\n")]]); }, true); - cache.register("help/privacy.xml", function () { + cache.register("help/privacy.xml", () => { return '\n' + DOM.toXML(["overlay", { xmlns: "dactyl" }, ["dl", { insertafter: "sanitize-items" }, @@ -1894,7 +1892,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { && root._lightweightTheme._lastScreenWidth == null) { dactyl.withSavedValues.call(PrivateBrowsingUtils, - ["isWindowPrivate"], function () { + ["isWindowPrivate"], + () => { PrivateBrowsingUtils.isWindowPrivate = () => false; Cu.import("resource://gre/modules/LightweightThemeConsumer.jsm", {}) .LightweightThemeConsumer.call(root._lightweightTheme, document); diff --git a/common/content/editor.js b/common/content/editor.js index c86f5fbd..26e16ca2 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -16,7 +16,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { if (elem) this.element = elem; else - this.__defineGetter__("element", function () { + this.__defineGetter__("element", () => { let elem = dactyl.focusedElement; if (elem) return elem.inputField || elem; @@ -771,17 +771,17 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { context.match = function (r) !this.filter || this.filter.contains(r); - context.fork("clipboard", 0, this, function (ctxt) { + context.fork("clipboard", 0, this, ctxt => { ctxt.match = context.match; ctxt.title = ["Clipboard Registers"]; ctxt.completions = Object.keys(editor.selectionRegisters); }); - context.fork("kill-ring", 0, this, function (ctxt) { + context.fork("kill-ring", 0, this, ctxt => { ctxt.match = context.match; ctxt.title = ["Kill Ring Registers"]; ctxt.completions = Array.slice("0123456789"); }); - context.fork("user", 0, this, function (ctxt) { + context.fork("user", 0, this, ctxt => { ctxt.match = context.match; ctxt.title = ["User Defined Registers"]; ctxt.completions = editor.registers.keys(); @@ -914,7 +914,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { function clear(forward, re) function _clear(editor) { - updateRange(editor, forward, re, function (range) {}); + updateRange(editor, forward, re, range => {}); dactyl.assert(!editor.selection.isCollapsed); editor.selection.deleteFromDocument(); let parent = DOM(editor.rootElement.parentNode); @@ -925,13 +925,12 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { function move(forward, re, sameWord) function _move(editor) { updateRange(editor, forward, re, - function (range) { range.collapse(!forward); }, + range => { range.collapse(!forward); }, sameWord); } function select(forward, re) function _select(editor) { - updateRange(editor, forward, re, - function (range) {}); + updateRange(editor, forward, re, range => {}); } function beginLine(editor_) { editor.executeCommand("cmd_beginLine"); @@ -1319,7 +1318,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { ["~"], "Switch case of the character under the cursor and move the cursor to the right", function ({ count }) { function munger(range) - String(range).replace(/./g, function (c) { + String(range).replace(/./g, c => { let lc = c.toLocaleLowerCase(); return c == lc ? c.toLocaleUpperCase() : lc; }); diff --git a/common/content/events.js b/common/content/events.js index 9f36f6e7..7be3e4ed 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1083,7 +1083,7 @@ var Events = Module("events", { function ({ keypressEvents: [event] }) { dactyl.assert(event.dactylSavedEvents, _("event.nothingToPass")); - return function () { + return () => { events.feedevents(null, event.dactylSavedEvents, { skipmap: true, isMacro: true, isReplay: true }); }; @@ -1150,8 +1150,8 @@ var Events = Module("events", { "Pass certain keys through directly for the given URLs", "sitemap", "", { flush: function flush() { - memoize(this, "filters", function () this.value.filter(function (f) f(buffer.documentURI))); - memoize(this, "pass", function () new RealSet(Ary.flatten(this.filters.map(function (f) f.keys)))); + memoize(this, "filters", function () this.value.filter(f => f(buffer.documentURI))); + memoize(this, "pass", function () new RealSet(Ary.flatten(this.filters.map(f => f.keys)))); memoize(this, "commandHive", function hive() Hive(this.filters, "command")); memoize(this, "inputHive", function hive() Hive(this.filters, "input")); }, diff --git a/common/content/hints.js b/common/content/hints.js index cfa2c93c..e921fca2 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -746,7 +746,7 @@ var HintSession = Class("HintSession", CommandMode, { var Hints = Module("hints", { init: function init() { - this.resizeTimer = Timer(100, 500, function () { + this.resizeTimer = Timer(100, 500, () => { if (isinstance(modes.main, modes.HINTS)) modes.getStack(0).params.onResize(); }); @@ -789,7 +789,7 @@ var Hints = Module("hints", { this.addMode("V", "View hint source in external editor", (elem, loc) => buffer.viewSource(loc, true)); this.addMode("y", "Yank hint location", (elem, loc) => editor.setRegister(null, cleanLoc(loc), true)); this.addMode("Y", "Yank hint description", elem => editor.setRegister(null, elem.textContent || "", true)); - this.addMode("A", "Yank hint anchor url", function (elem) { + this.addMode("A", "Yank hint anchor url", elem => { let uri = elem.ownerDocument.documentURIObject.clone(); uri.ref = elem.id || elem.name; dactyl.clipboardWrite(uri.spec, true); @@ -934,7 +934,7 @@ var Hints = Module("hints", { */ function containsMatcher(hintString) { //{{{ let tokens = tokenize(/\s+/, hintString); - return function (linkText) { + return linkText => { linkText = linkText.toLowerCase(); return tokens.every(token => indexOf(linkText, token) >= 0); }; @@ -1049,7 +1049,7 @@ var Hints = Module("hints", { return true; } - return function (linkText) { + return linkText => { if (hintStrings.length == 1 && hintStrings[0].length == 0) return true; diff --git a/common/content/history.js b/common/content/history.js index f8417a2e..52de03ed 100644 --- a/common/content/history.js +++ b/common/content/history.js @@ -64,7 +64,7 @@ var History = Module("history", { let obj = []; obj.__defineGetter__("index", () => sh.index); - obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val); }); + obj.__defineSetter__("index", val => { webNav.gotoIndex(val); }); obj[Symbol.iterator] = function () this.entries(); for (let item of iter(sh.SHistoryEnumerator, Ci.nsISHEntry)) @@ -111,7 +111,7 @@ var History = Module("history", { var ctxt; var filter = item => true; if (item == "domain") - var filter = function (item) { + var filter = item => { let res = item.URI.hostPort != ctxt; ctxt = item.URI.hostPort; return res; @@ -324,7 +324,7 @@ var History = Module("history", { }, completion: function initCompletion() { - completion.domain = function (context) { + completion.domain = context => { context.anchored = false; context.compare = (a, b) => String.localeCompare(a.key, b.key); context.keys = { text: util.identity, description: util.identity, diff --git a/common/content/mappings.js b/common/content/mappings.js index 0a722fd1..2153a6e5 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -173,7 +173,7 @@ var MapHive = Class("MapHive", Contexts.Hive, { iterate: function (modes) { let stacks = Array.concat(modes).map(this.bound.getStack); return values(stacks.shift().sort((m1, m2) => String.localeCompare(m1.name, m2.name)) - .filter((map) => map.rhs && + .filter(map => map.rhs && stacks.every(stack => stack.some(m => m.rhs && m.rhs === map.rhs && m.name === map.name)))); }, @@ -803,7 +803,7 @@ var Mappings = Module("mappings", { ] }); - iter.forEach(modes.mainModes, function (mode) { + iter.forEach(modes.mainModes, mode => { if (mode.char && !commands.get(mode.char + "listkeys", true)) dactyl.addUsageCommand({ __proto__: args, diff --git a/common/content/modes.js b/common/content/modes.js index 550e32e4..77c0daf0 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -649,7 +649,7 @@ var Modes = Module("modes", { }, prefs: function initPrefs() { prefs.watch("accessibility.browsewithcaret", - function () { apply(modes, "onCaretChange", arguments); }); + () => { apply(modes, "onCaretChange", arguments); }); } }); diff --git a/common/content/quickmarks.js b/common/content/quickmarks.js index ef29c299..8df8e00c 100644 --- a/common/content/quickmarks.js +++ b/common/content/quickmarks.js @@ -14,7 +14,7 @@ var QuickMarks = Module("quickmarks", { init: function () { this._qmarks = storage.newMap("quickmarks", { store: true }); - storage.addObserver("quickmarks", function () { + storage.addObserver("quickmarks", () => { statusline.updateStatus(); }, window); }, @@ -154,7 +154,7 @@ var QuickMarks = Module("quickmarks", { if (args.length == 1) return completion.quickmark(context); if (args.length == 2) { - context.fork("current", 0, this, function (context) { + context.fork("current", 0, this, context => { context.title = ["Extra Completions"]; context.completions = [ [quickmarks.get(args[0]), _("option.currentValue")] @@ -176,7 +176,7 @@ var QuickMarks = Module("quickmarks", { }); }, completion: function initCompletion() { - completion.quickmark = function (context) { + completion.quickmark = context => { context.title = ["QuickMark", "URL"]; context.generate = () => iter(quickmarks._qmarks); }; diff --git a/common/content/tabs.js b/common/content/tabs.js index 81c6a83f..50d36ee4 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -32,7 +32,7 @@ var Tabs = Module("tabs", { "{ visibility: collapse; }", false, true); - dactyl.commands["tabs.select"] = function (event) { + dactyl.commands["tabs.select"] = event => { tabs.switchTo(event.originalTarget.getAttribute("identifier")); }; @@ -1096,7 +1096,7 @@ var Tabs = Module("tabs", { description: function (group) group.getTitle() || group.getChildren().map(t => t.tab.label).join(", ") }; - context.generate = function () { + context.generate = () => { context.incomplete = true; tabs.getGroups(function ({ GroupItems }) { context.incomplete = false; @@ -1120,7 +1120,7 @@ var Tabs = Module("tabs", { "Execute the next mapping in a new tab", function ({ count }) { dactyl.forceTarget = dactyl.NEW_TAB; - mappings.afterCommands((count || 1) + 1, function () { + mappings.afterCommands((count || 1) + 1, () => { dactyl.forceTarget = null; }); }, diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index 80a87a5c..6306c2d8 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -483,9 +483,9 @@ var Addons = Module("addons", { description: "description", icon: "iconURL" }; - context.generate = function () { + context.generate = () => { context.incomplete = true; - AddonManager.getAddonsByTypes(types || ["extension"], function (addons) { + AddonManager.getAddonsByTypes(types || ["extension"], addons => { context.incomplete = false; context.completions = addons; }); diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 0a6b6c10..d7f50c52 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -899,7 +899,7 @@ function Class(...args) { return Constructor; } -Class.objectGlobal = function (object) { +Class.objectGlobal = object => { try { return Cu.getGlobalForObject(object); } @@ -920,7 +920,7 @@ Class.objectGlobal = function (object) { */ Class.Property = function Property(desc) update( Object.create(Property.prototype), desc || { configurable: true, writable: true }); -Class.Property.prototype.init = function () {}; +Class.Property.prototype.init = () => {}; /** * Extends a subclass with a superclass. The subclass's * prototype is replaced with a new object, which inherits @@ -1059,7 +1059,7 @@ Class.prototype = { * @returns {nsITimer} The timer which backs this timeout. */ timeout: function timeout(callback, timeout) { - let timeout_notify = (timer) => { + let timeout_notify = timer => { if (this.stale || util.rehashing && !isinstance(Cu.getGlobalForObject(callback), ["BackstagePass"])) return; @@ -1095,7 +1095,7 @@ Class.prototype = { for (let i = 0; i < arguments.length; i++) { let src = arguments[i]; - Object.getOwnPropertyNames(src || {}).forEach((k) => { + Object.getOwnPropertyNames(src || {}).forEach(k => { if (k.startsWith("@@") && k.slice(2) in Symbol) k = Symbol[k.slice(2)]; diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index c8f24e12..1e5d66ce 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -102,7 +102,7 @@ var Buffer = Module("Buffer", { if (!found) resolve(undefined); }, - handleResult: (pref) => { + handleResult: pref => { found = true; resolve(pref.value); }, @@ -1122,7 +1122,7 @@ var Buffer = Module("Buffer", { let info = template.map( (sections || options["pageinfo"]) - .map((opt) => Buffer.pageInfo[opt].action.call(this)), + .map(opt => Buffer.pageInfo[opt].action.call(this)), res => (res && iter(res).join(", ") || undefined), ", ").join(""); @@ -1134,7 +1134,7 @@ var Buffer = Module("Buffer", { return; } - let list = template.map(sections || options["pageinfo"], (option) => { + let list = template.map(sections || options["pageinfo"], option => { let { action, title } = Buffer.pageInfo[option]; return template.table(title, action.call(this, true)); }, ["br"]); @@ -1824,7 +1824,7 @@ var Buffer = Module("Buffer", { init: function init(dactyl, modules, window) { init.superapply(this, arguments); - dactyl.commands["buffer.viewSource"] = function (event) { + dactyl.commands["buffer.viewSource"] = event => { let elem = event.originalTarget; let obj = { url: elem.getAttribute("href"), line: Number(elem.getAttribute("line")) }; if (elem.hasAttribute("column")) @@ -2543,7 +2543,7 @@ var Buffer = Module("Buffer", { }, validator: function validate(values) { - return this.testValues(values, function (value) { + return this.testValues(values, value => { if (/^func:/.test(value)) return callable(dactyl.userEval("(" + Option.dequote(value.substr(5)) + ")")); else diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 1449aaf9..2e0b9597 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -321,7 +321,7 @@ var Command = Class("Command", { let res = update([], { command: this, - explicitOpts: Class.Memoize(function () ({})), + explicitOpts: Class.Memoize(() => ({})), has: function AP_has(opt) hasOwnProperty(this.explicitOpts, opt) || typeof opt === "number" && hasOwnProperty(this, opt), @@ -1738,7 +1738,7 @@ var Commands = Module("commands", { name: ["listc[ommands]", "lc"], description: "List all Ex commands along with their short descriptions", index: "ex-cmd", - iterate: function (args) commands.iterator().map(function (cmd) ({ + iterate: function (args) commands.iterator().map(cmd => ({ __proto__: cmd, columns: [ cmd.hive == commands.builtin ? "" : ["span", { highlight: "Object", style: "padding-right: 1em;" }, @@ -1826,7 +1826,7 @@ Commands.complQuote = { "": ["", Commands.quoteArg[""], ""] }; -Commands.parseBool = function (arg) { +Commands.parseBool = arg => { if (/^(true|1|on)$/i.test(arg)) return true; if (/^(false|0|off)$/i.test(arg)) diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm index 5914dfd1..ffb9467a 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -134,7 +134,7 @@ var CompletionContext = Class("CompletionContext", { this.filterFunc = function filterFunc(items) { return this.filters .reduce((res, filter) => - res.filter((item) => filter.call(this, item)), + res.filter(item => filter.call(this, item)), items); }; /** @@ -738,9 +738,9 @@ var CompletionContext = Class("CompletionContext", { split: function split(name, obj, fn, ...args) { let context = this.fork(name); - let alias = (prop) => { + let alias = prop => { context.__defineGetter__(prop, () => this[prop]); - context.__defineSetter__(prop, (val) => this[prop] = val); + context.__defineSetter__(prop, val => this[prop] = val); }; alias("_cache"); alias("_completions"); diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm index 71028cf2..026c549b 100644 --- a/common/modules/contexts.jsm +++ b/common/modules/contexts.jsm @@ -126,7 +126,7 @@ var Contexts = Module("contexts", { init: function (name) { this.name = name; - this.type = ArgType("group", function (group) { + this.type = ArgType("group", group => { return isString(group) ? contexts.getGroup(group, name) : group[name]; }); @@ -814,7 +814,7 @@ var Contexts = Module("contexts", { .slice(0, -1); iter({ Active: true, Inactive: false }).forEach(function ([name, active]) { - context.split(name, null, function (context) { + context.split(name, null, context => { context.title[0] = name + " Groups"; context.filters.push(({ item }) => !!item.filter(modules.buffer.uri) == active); }); diff --git a/common/modules/dom.jsm b/common/modules/dom.jsm index 1dd8ad61..23139ced 100644 --- a/common/modules/dom.jsm +++ b/common/modules/dom.jsm @@ -88,7 +88,7 @@ var DOM = Class("DOM", { Empty: function Empty() this.constructor(null, this.document), - nodes: Class.Memoize(function () ({})), + nodes: Class.Memoize(() => ({})), get items() { return function* () { @@ -1567,10 +1567,10 @@ var DOM = Class("DOM", { if (!isString(name) || args.length == 0 || name === "") { var frag = doc.createDocumentFragment(); - Array.forEach(args, function (arg) { + Array.forEach(args, arg => { if (!isArray(arg[0])) arg = [arg]; - arg.forEach(function (arg) { + arg.forEach(arg => { frag.appendChild(tag(arg, namespaces)); }); }); @@ -1710,12 +1710,12 @@ var DOM = Class("DOM", { if (isFragment(args)) { let res = []; let join = isArray(args) && isStrings(args) ? "" : "\n"; - Array.forEach(args, function (arg) { + Array.forEach(args, arg => { if (!isArray(arg[0])) arg = [arg]; let contents = []; - arg.forEach(function (arg) { + arg.forEach(arg => { let string = tag(arg, namespaces, indent); if (string) contents.push(string); diff --git a/common/modules/downloads.jsm b/common/modules/downloads.jsm index dbe69339..74400acc 100644 --- a/common/modules/downloads.jsm +++ b/common/modules/downloads.jsm @@ -57,7 +57,7 @@ var Download = Class("Download", { this.source.url]]], this.list.document, this.nodes); - this.nodes.launch.addEventListener("click", (event) => { + this.nodes.launch.addEventListener("click", event => { if (event.button == 0) { event.preventDefault(); this.command("launch"); @@ -122,7 +122,7 @@ var Download = Class("Download", { let file = io.File(this.targetFile); if (file.isExecutable() && prefs.get("browser.download.manager.alertOnEXEOpen", true)) this.list.modules.commandline.input(_("download.prompt.launchExecutable") + " ", - (resp) => { + resp => { if (/^a(lways)$/i.test(resp)) { prefs.set("browser.download.manager.alertOnEXEOpen", false); resp = "yes"; diff --git a/common/modules/help.jsm b/common/modules/help.jsm index 8a361b6c..b001549f 100644 --- a/common/modules/help.jsm +++ b/common/modules/help.jsm @@ -103,7 +103,7 @@ var Help = Module("Help", { cache.register("help.json", HelpBuilder); - cache.register("help/versions.xml", function () { + cache.register("help/versions.xml", () => { let NEWS = util.httpGet(config.addon.getResourceURI("NEWS").spec, { mimeType: "text/plain;charset=UTF-8" }) .responseText; @@ -223,7 +223,7 @@ var Help = Module("Help", { Local: function Local(dactyl, modules, window) ({ init: function init() { - dactyl.commands["dactyl.help"] = function (event) { + dactyl.commands["dactyl.help"] = event => { let elem = event.originalTarget; modules.help.help(elem.getAttribute("tag") || elem.textContent); }; diff --git a/common/modules/io.jsm b/common/modules/io.jsm index d99554c3..9f84c998 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -494,7 +494,7 @@ var IO = Module("io", { } let timer = services.Timer( - function () { + () => { if (!process.isRunning) { timer.cancel(); deferred.resolve(process.exitValue); @@ -974,7 +974,7 @@ unlet s:cpo_save completion: function initCompletion(dactyl, modules, window) { const { completion, io } = modules; - completion.charset = function (context) { + completion.charset = context => { context.anchored = false; context.keys = { text: util.identity, @@ -1062,7 +1062,7 @@ unlet s:cpo_save completion.shellCommand = function shellCommand(context) { context.title = ["Shell Command", "Path"]; - context.generate = function () { + context.generate = () => { let dirNames = services.environment.get("PATH").split(config.OS.pathListSep); let commands = []; @@ -1099,7 +1099,7 @@ unlet s:cpo_save else if (match.scheme === "chrome") { context.key = match.prefix; context.advance(match.prefix.length + 1); - context.generate = function () iter({ + context.generate = () => iter({ content: /*L*/"Chrome content", locale: /*L*/"Locale-specific content", skin: /*L*/"Theme-specific content" diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index 1d80e70b..c228ba81 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -405,7 +405,7 @@ var JavaScript = Module("javascript", { // TODO: Make this a generic completion helper function. objects.forEach(function (obj) { - obj.ctxt_t.split(obj[1] + "/anchored", this, function (context) { + obj.ctxt_t.split(obj[1] + "/anchored", this, context => { context.anchored = true; if (compl) compl(context, obj[0]); @@ -416,14 +416,14 @@ var JavaScript = Module("javascript", { return; objects.forEach(function (obj) { - obj.ctxt_p.split(obj[1] + "/anchored", this, function (context) { + obj.ctxt_p.split(obj[1] + "/anchored", this, context => { context.anchored = true; context.title[0] += /*L*/" (prototypes)"; }); }); objects.forEach(function (obj) { - obj.ctxt_t.split(obj[1] + "/unanchored", this, function (context) { + obj.ctxt_t.split(obj[1] + "/unanchored", this, context => { context.anchored = false; context.title[0] += /*L*/" (substrings)"; context.filters.push(unanchored); @@ -431,7 +431,7 @@ var JavaScript = Module("javascript", { }); objects.forEach(function (obj) { - obj.ctxt_p.split(obj[1] + "/unanchored", this, function (context) { + obj.ctxt_p.split(obj[1] + "/unanchored", this, context => { context.anchored = false; context.title[0] += /*L*/" (prototype substrings)"; context.filters.push(unanchored); diff --git a/common/modules/main.jsm b/common/modules/main.jsm index 15af6260..b57d57bd 100644 --- a/common/modules/main.jsm +++ b/common/modules/main.jsm @@ -241,7 +241,7 @@ overlay.overlayWindow(Object.keys(config.overlays), this.initDependencies(className); } else - modules.__defineGetter__(className, function () { + modules.__defineGetter__(className, () => { let module = modules.jsmodules[className]; Class.replaceProperty(modules, className, module); if (module.reallyInit) @@ -350,14 +350,14 @@ overlay.overlayWindow(Object.keys(config.overlays), } }; - INIT[name].require = function (name) { init[name](); }; + INIT[name].require = name => { init[name](); }; } }, scanModules: function scanModules() { let { Module, modules } = this.modules; - defineModule.modules.forEach((mod) => { + defineModule.modules.forEach(mod => { let names = new RealSet(Object.keys(mod.INIT)); if ("init" in mod.INIT) names.add("init"); @@ -366,14 +366,14 @@ overlay.overlayWindow(Object.keys(config.overlays), this.deferInit(name, mod.INIT, mod); }); - Module.list.forEach((mod) => { + Module.list.forEach(mod => { if (!mod.frobbed) { modules.__defineGetter__(mod.className, () => { delete modules[mod.className]; return this.loadModule(mod.className, null, Components.stack.caller); }); Object.keys(mod.prototype.INIT) - .forEach((name) => { this.deferInit(name, mod.prototype.INIT, mod); }); + .forEach(name => { this.deferInit(name, mod.prototype.INIT, mod); }); } mod.frobbed = true; }); diff --git a/common/modules/messages.jsm b/common/modules/messages.jsm index 7db782c8..3a1b73ed 100644 --- a/common/modules/messages.jsm +++ b/common/modules/messages.jsm @@ -204,9 +204,8 @@ var Messages = Module("messages", { javascript: function initJavascript(dactyl, modules, window) { let { JavaScript } = modules; - JavaScript.setCompleter([this._, this.get, this.format], [ - context => messages.iterate() - ]); + JavaScript.setCompleter([this._, this.get, this.format], + [context => messages.iterate()]); JavaScript.setCompleter([this.export], [function (context, obj, args) { diff --git a/common/modules/options.jsm b/common/modules/options.jsm index 86fd59c9..cebe29aa 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -758,7 +758,7 @@ var Option = Class("Option", { acceptable = completions.call(this); if (isArray(acceptable)) - acceptable = new RealSet(acceptable.map((v) => v[0])); + acceptable = new RealSet(acceptable.map(v => v[0])); else acceptable = new RealSet(this.parseKey(k) for (k of Object.keys(acceptable))); @@ -964,7 +964,7 @@ var Options = Module("options", { let closure = () => this._optionMap[name]; memoize(this._optionMap, name, - function () Option.types[type](modules, names, description, defaultValue, extraInfo)); + () => Option.types[type](modules, names, description, defaultValue, extraInfo)); for (let alias of names.slice(1)) memoize(this._optionMap, alias, closure); @@ -1165,7 +1165,7 @@ var Options = Module("options", { name = Option.dequote(name); if (name == "all" && reset) modules.commandline.input(_("pref.prompt.resetAll", config.host) + " ", - function (resp) { + resp => { if (resp == "yes") for (let pref of prefs.getNames()) prefs.reset(pref); @@ -1299,7 +1299,7 @@ var Options = Module("options", { return null; if (!opt.value && !opt.operator && !opt.invert) { - context.fork("default", 0, this, function (context) { + context.fork("default", 0, this, context => { context.title = ["Extra Completions"]; context.pushProcessor(0, (item, text, next) => next(item, text.substr(0, 100))); context.completions = [ @@ -1322,7 +1322,7 @@ var Options = Module("options", { context.filters.push(i => !have.has(i.text)); modules.completion.optionValue(context, opt.name, opt.operator, null, - function (context) { + context => { context.generate = () => option.value.map(o => [o, ""]); }); context.title = ["Current values"]; @@ -1539,7 +1539,7 @@ var Options = Module("options", { } if (extra.key && extra.value != null) { - context.fork("default", 0, this, function (context) { + context.fork("default", 0, this, context => { context.completions = [ [val(opt.value), _("option.currentValue")], [val(opt.defaultValue), _("option.defaultValue")] @@ -1559,7 +1559,7 @@ var Options = Module("options", { if (op == "-") context.filters.push(i => curValues.indexOf(i.text) > -1); - memoize(extra, "values", function () { + memoize(extra, "values", () => { if (op == "+") return curValues.concat(newValues); if (op == "-") diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index f9a97c96..1c0eb10a 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -193,7 +193,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef let branch = Item.PREFIX + Item.SHUTDOWN_BRANCH; overlay.overlayWindow("chrome://browser/content/preferences/sanitize.xul", - function (win) { + win => { let items = ourItems(true); return prefOverlay(branch, true, { @@ -472,7 +472,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef && !args["-host"]) modules.commandline.input(_("sanitize.prompt.deleteAll") + " ", - function (resp) { + resp => { if (resp.match(/^y(es)?$/i)) { sanitize(items); dactyl.echomsg(_("command.sanitize.allDeleted")); diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm index ae2d4d92..3904790b 100644 --- a/common/modules/storage.jsm +++ b/common/modules/storage.jsm @@ -690,7 +690,7 @@ var File = Class("File", { /** * @property {string} The current platform's path separator. */ - PATH_SEP: Class.Memoize(function () /foo(.)bar/.exec(OS.Path.join("foo", "bar"))[1]), + PATH_SEP: Class.Memoize(() => /foo(.)bar/.exec(OS.Path.join("foo", "bar"))[1]), pathSplit: Class.Memoize(function () util.regexp("[/" + util.regexp.escape(this.PATH_SEP) + "]", "g")), diff --git a/common/modules/styles.jsm b/common/modules/styles.jsm index 12193e59..360b295a 100644 --- a/common/modules/styles.jsm +++ b/common/modules/styles.jsm @@ -394,7 +394,7 @@ var Styles = Module("Styles", { completeSite: function (context, content, group=styles.user) { context.anchored = false; try { - context.fork("current", 0, this, function (context) { + context.fork("current", 0, this, context => { context.title = ["Current Site"]; context.completions = [ [content.location.host, /*L*/"Current Host"], @@ -456,7 +456,7 @@ var Styles = Module("Styles", { splitContext: function splitContext(context, title) { for (let item of iter({ Active: true, Inactive: false })) { let [name, active] = item; - context.split(name, null, function (context) { + context.split(name, null, context => { context.title[0] = /*L*/name + " " + (title || "Sheets"); context.filters.push(item => !!item.active == active); }); @@ -728,7 +728,7 @@ var Styles = Module("Styles", { }, completion: function initCompletion(dactyl, modules, window) { const names = Array.slice(DOM(["div"], window.document).style); - modules.completion.css = function (context) { + modules.completion.css = context => { context.title = ["CSS Property"]; context.keys = { text: function (p) p + ":", description: function () "" }; @@ -755,12 +755,12 @@ var Styles = Module("Styles", { let patterns = Styles.patterns; template.highlightCSS = function highlightCSS(css) { - return this.highlightRegexp(css, patterns.property, function (match) { + return this.highlightRegexp(css, patterns.property, match => { if (!match.length) return []; return ["", match.preSpace, template.filter(match.name), ": ", - template.highlightRegexp(match.value, patterns.token, function (match) { + template.highlightRegexp(match.value, patterns.token, match => { if (match.function) return ["", template.filter(match.word), template.highlightRegexp(match.function, patterns.string, diff --git a/common/modules/template.jsm b/common/modules/template.jsm index 981ddfc6..b9ffb1e6 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -303,8 +303,9 @@ var Template = Module("Template", { if (processStrings && false) str = template._highlightFilter(str, "\n", - function () ["span", { highlight: "NonText" }, - "^J"]); + () => ["span", + { highlight: "NonText" }, + "^J"]); return ["span", { highlight: "Object" }, str]; case "xml": return arg; @@ -446,7 +447,7 @@ var Template = Module("Template", { ["tr", { highlight: "Title", align: "left" }, this.map(headings, function (h) ["th", {}, h])], - this.map(iter, (row) => + this.map(iter, row => ["tr", {}, this.map(Iterator(row), ([i, d]) => ["td", { style: style[i] || "" }, d])])]; @@ -455,7 +456,7 @@ var Template = Module("Template", { usage: function usage(iter, format={}) { let desc = format.description || (item => this.linkifyHelp(item.description)); let help = format.help || (item => item.name); - let sourceLink = (frame) => { + let sourceLink = frame => { let source = this.sourceLink(frame); source[1]["dactyl:hint"] = source[2]; return source; @@ -464,14 +465,14 @@ var Template = Module("Template", { format.headings ? ["thead", { highlight: "UsageHead" }, ["tr", { highlight: "Title", align: "left" }, - this.map(format.headings, (h) => ["th", {}, h])]] : + this.map(format.headings, h => ["th", {}, h])]] : [], format.columns ? ["colgroup", {}, - this.map(format.columns, (c) => ["col", { style: c }])] : + this.map(format.columns, c => ["col", { style: c }])] : [], ["tbody", { highlight: "UsageBody" }, - this.map(iter, (item) => { + this.map(iter, item => { // Urgh. let name = item.name || item.names[0]; let frame = item.definedAt; @@ -484,7 +485,7 @@ var Template = Module("Template", { ["span", { highlight: "LinkInfo" }, _("io.definedAt"), " ", sourceLink(frame)]]]], - item.columns ? this.map(item.columns, (c) => ["td", {}, c]) : [], + item.columns ? this.map(item.columns, c => ["td", {}, c]) : [], ["td", {}, desc(item)]]; })]]; } diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 33f6c094..c0bedd82 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -299,8 +299,8 @@ 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 of stack) @@ -505,7 +505,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), let patterns = []; let substrings = split(pattern, /((?:[^\\{]|\\.)*)\{((?:[^\\}]|\\.)*)\}/gy, - function (match) { + match => { patterns.push(split(match[2], /((?:[^\\,]|\\.)*),/gy, null, ",{}")); }, "{}"); @@ -972,7 +972,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), return iter(obj) .map(([k, v]) => ["]/g, - function (m) map[m]), + m => map[m]), "'>"].join("")) .join("\n"); }, @@ -1590,8 +1590,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), let done = false; var promise = test, retVal; - promise.then((arg) => { retVal = arg; done = true; }, - (arg) => { retVal = arg; done = true; }); + promise.then(arg => { retVal = arg; done = true; }, + arg => { retVal = arg; done = true; }); test = () => done; } diff --git a/melodactyl/content/config.js b/melodactyl/content/config.js index baa5b3b6..1bd282fc 100644 --- a/melodactyl/content/config.js +++ b/melodactyl/content/config.js @@ -24,7 +24,7 @@ const Config = Module("config", ConfigBase, { // TODO: mention this to SB devs, they seem keen to provide these // functions to make porting from FF as simple as possible. - window.toJavaScriptConsole = function () { + window.toJavaScriptConsole = () => { toOpenWindowByType("global:console", "chrome://global/content/console.xul"); }; }, @@ -36,42 +36,42 @@ const Config = Module("config", ConfigBase, { dialogs: { about: ["About Songbird", - function () { window.openDialog("chrome://songbird/content/xul/about.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], + () => { window.openDialog("chrome://songbird/content/xul/about.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], addons: ["Manage Add-ons", - function () { window.SBOpenPreferences("paneAddons"); }], + () => { window.SBOpenPreferences("paneAddons"); }], checkupdates: ["Check for updates", - function () { window.checkForUpdates(); }], + () => { window.checkForUpdates(); }], cookies: ["List your cookies", - function () { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }], + () => { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }], console: ["JavaScript console", - function () { window.toJavaScriptConsole(); }], + () => { window.toJavaScriptConsole(); }], dominspector: ["DOM Inspector", - function () { window.inspectDOMDocument(window.content.document); }, + () => { window.inspectDOMDocument(window.content.document); }, () => "inspectDOMDocument" in window], downloads: ["Manage Downloads", - function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }], + () => { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }], newsmartplaylist: ["Open the file selector dialog", - function () { window.SBNewSmartPlaylist(); }], + () => { window.SBNewSmartPlaylist(); }], openfile: ["Open the file selector dialog", - function () { window.SBFileOpen(); }], + () => { window.SBFileOpen(); }], pagesource: ["View page source", - function () { window.BrowserViewSourceOfDocument(window.content.document); }], + () => { window.BrowserViewSourceOfDocument(window.content.document); }], preferences: ["Show Songbird preferences dialog", - function () { window.openPreferences(); }], + () => { window.openPreferences(); }], printsetup: ["Setup the page size and orientation before printing", - function () { window.PrintUtils.showPageSetup(); }], + () => { window.PrintUtils.showPageSetup(); }], print: ["Show print dialog", - function () { window.PrintUtils.print(); }], + () => { window.PrintUtils.print(); }], saveframe: ["Save frame to disk", - function () { window.saveFrameDocument(); }], + () => { window.saveFrameDocument(); }], savepage: ["Save page to disk", - function () { window.saveDocument(window.content.document); }], + () => { window.saveDocument(window.content.document); }], searchengines: ["Manage installed search engines", - function () { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], + () => { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], selectionsource: ["View selection source", - function () { modules.buffer.viewSelectionSource(); }], + () => { modules.buffer.viewSelectionSource(); }], subscribe: ["Add a new subscription", - function () { window.SBSubscribe(); }] + () => { window.SBSubscribe(); }] }, // TODO: clean this up @@ -278,7 +278,7 @@ const Config = Module("config", ConfigBase, { completion: function initCompletion(dactyl, modules, window) { const completion = require("completion"); - completion.displayPane = function (context) { + completion.displayPane = context => { context.title = ["Display Pane"]; context.completions = Config.displayPanes; // FIXME: useful description etc }; diff --git a/pentadactyl/content/config.js b/pentadactyl/content/config.js index 7d615d71..5c8477cb 100644 --- a/pentadactyl/content/config.js +++ b/pentadactyl/content/config.js @@ -12,55 +12,55 @@ var Config = Module("config", ConfigBase, { dialogs: { about: ["About Firefox", - function () { window.openDialog("chrome://browser/content/aboutDialog.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], + () => { window.openDialog("chrome://browser/content/aboutDialog.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], addbookmark: ["Add bookmark for the current page", - function () { window.PlacesCommandHook.bookmarkCurrentPage(true, window.PlacesUtils.bookmarksRootId); }], + () => { window.PlacesCommandHook.bookmarkCurrentPage(true, window.PlacesUtils.bookmarksRootId); }], addons: ["Manage Add-ons", - function () { window.BrowserOpenAddonsMgr(); }], + () => { window.BrowserOpenAddonsMgr(); }], bookmarks: ["List your bookmarks", - function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }], + () => { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }], checkupdates: ["Check for updates", - function () { window.checkForUpdates(); }, + () => { window.checkForUpdates(); }, () => "checkForUpdates" in window], cookies: ["List your cookies", - function () { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }], + () => { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }], console: ["Browser console", - function () { window.HUDService.toggleBrowserConsole(); }], + () => { window.HUDService.toggleBrowserConsole(); }], customizetoolbar: ["Customize the Toolbar", - function () { window.BrowserCustomizeToolbar(); }], + () => { window.BrowserCustomizeToolbar(); }], dominspector: ["DOM Inspector", - function () { window.inspectDOMDocument(window.content.document); }, + () => { window.inspectDOMDocument(window.content.document); }, () => "inspectDOMDocument" in window], downloads: ["Manage Downloads", - function () { window.BrowserDownloadsUI(); }], + () => { window.BrowserDownloadsUI(); }], history: ["List your history", - function () { window.openDialog("chrome://browser/content/history/history-panel.xul", "History", "dialog,centerscreen,width=600,height=600"); }], + () => { window.openDialog("chrome://browser/content/history/history-panel.xul", "History", "dialog,centerscreen,width=600,height=600"); }], openfile: ["Open the file selector dialog", - function () { window.BrowserOpenFileWindow(); }], + () => { window.BrowserOpenFileWindow(); }], pageinfo: ["Show information about the current page", - function () { window.BrowserPageInfo(); }], + () => { window.BrowserPageInfo(); }], pagesource: ["View page source", - function () { window.BrowserViewSourceOfDocument(window.content.document); }], + () => { window.BrowserViewSourceOfDocument(window.content.document); }], passwords: ["Passwords dialog", - function () { window.openDialog("chrome://passwordmgr/content/passwordManager.xul"); }], + () => { window.openDialog("chrome://passwordmgr/content/passwordManager.xul"); }], places: ["Places Organizer: Manage your bookmarks and history", - function () { window.PlacesCommandHook.showPlacesOrganizer(window.ORGANIZER_ROOT_BOOKMARKS); }], + () => { window.PlacesCommandHook.showPlacesOrganizer(window.ORGANIZER_ROOT_BOOKMARKS); }], preferences: ["Show Firefox preferences dialog", - function () { window.openPreferences(); }], + () => { window.openPreferences(); }], printpreview: ["Preview the page before printing", - function () { window.PrintUtils.printPreview(window.PrintPreviewListener || window.onEnterPrintPreview, window.onExitPrintPreview); }], + () => { window.PrintUtils.printPreview(window.PrintPreviewListener || window.onEnterPrintPreview, window.onExitPrintPreview); }], printsetup: ["Setup the page size and orientation before printing", - function () { window.PrintUtils.showPageSetup(); }], + () => { window.PrintUtils.showPageSetup(); }], print: ["Show print dialog", - function () { window.PrintUtils.print(); }], + () => { window.PrintUtils.print(); }], saveframe: ["Save frame to disk", - function () { window.saveFrameDocument(); }], + () => { window.saveFrameDocument(); }], savepage: ["Save page to disk", - function () { window.saveDocument(window.content.document); }], + () => { window.saveDocument(window.content.document); }], searchengines: ["Manage installed search engines", - function () { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], + () => { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], selectionsource: ["View selection source", - function () { modules.buffer.viewSelectionSource(); }] + () => { modules.buffer.viewSelectionSource(); }] }, removeTab: function removeTab(tab) { @@ -215,7 +215,7 @@ var Config = Module("config", ConfigBase, { }; }, events: function initEvents(dactyl, modules, window) { - modules.events.listen(window, "SidebarFocused", function (event) { + modules.events.listen(window, "SidebarFocused", event => { modules.config.lastSidebar = window.document.getElementById("sidebar-box") .getAttribute("sidebarcommand"); }, false); diff --git a/teledactyl/content/compose/compose.js b/teledactyl/content/compose/compose.js index fd883339..825b59a6 100644 --- a/teledactyl/content/compose/compose.js +++ b/teledactyl/content/compose/compose.js @@ -26,14 +26,14 @@ var Compose = Module("compose", { NotifyDocumentWillBeDestroyed: function () {} }; - events.listen(window.document, "load", function () { + events.listen(window.document, "load", () => { if (window.messageWasEditedExternally === undefined) { window.messageWasEditedExternally = false; GetCurrentEditor().addDocumentStateListener(stateListener); } }, true); - events.listen(window, "compose-window-close", function () { + events.listen(window, "compose-window-close", () => { window.messageWasEditedExternally = false; }, true); } diff --git a/teledactyl/content/config.js b/teledactyl/content/config.js index c9ff8842..cd66c5ef 100644 --- a/teledactyl/content/config.js +++ b/teledactyl/content/config.js @@ -75,29 +75,29 @@ var Config = Module("config", ConfigBase, { dialogs: { about: ["About Thunderbird", - function () { window.openAboutDialog(); }], + () => { window.openAboutDialog(); }], addons: ["Manage Add-ons", - function () { window.openAddonsMgr(); }], + () => { window.openAddonsMgr(); }], addressbook: ["Address book", - function () { window.toAddressBook(); }], + () => { window.toAddressBook(); }], checkupdates: ["Check for updates", - function () { window.checkForUpdates(); }], + () => { window.checkForUpdates(); }], console: ["JavaScript console", - function () { window.toJavaScriptConsole(); }], + () => { window.toJavaScriptConsole(); }], dominspector: ["DOM Inspector", - function () { window.inspectDOMDocument(content.document); }], + () => { window.inspectDOMDocument(content.document); }], downloads: ["Manage Downloads", - function () { window.toOpenWindowByType('Download:Manager', 'chrome://mozapps/content/downloads/downloads.xul', 'chrome,dialog=no,resizable'); }], + () => { window.toOpenWindowByType('Download:Manager', 'chrome://mozapps/content/downloads/downloads.xul', 'chrome,dialog=no,resizable'); }], preferences: ["Show Thunderbird preferences dialog", - function () { window.openOptionsDialog(); }], + () => { window.openOptionsDialog(); }], printsetup: ["Setup the page size and orientation before printing", - function () { window.PrintUtils.showPageSetup(); }], + () => { window.PrintUtils.showPageSetup(); }], print: ["Show print dialog", - function () { window.PrintUtils.print(); }], + () => { window.PrintUtils.print(); }], saveframe: ["Save frame to disk", - function () { window.saveFrameDocument(); }], + () => { window.saveFrameDocument(); }], savepage: ["Save page to disk", - function () { window.saveDocument(window.content.document); }], + () => { window.saveDocument(window.content.document); }], }, focusChange: function focusChange(win) {