From 52993ec78106a775dbfd05e6a7f7a5c39aa9012d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 25 Apr 2015 23:57:57 +1000 Subject: [PATCH] Remove more unused vars. --- common/content/bookmarks.js | 3 +-- common/content/commandline.js | 3 --- common/content/editor.js | 1 - common/content/events.js | 2 -- common/content/history.js | 2 +- common/content/key-processors.js | 1 - common/content/mow.js | 2 +- common/content/statusline.js | 1 - common/content/tabs.js | 9 ++++----- common/modules/addons.jsm | 4 ++-- common/modules/bookmarkcache.jsm | 2 +- common/modules/buffer.jsm | 14 ++++++-------- common/modules/commands.jsm | 8 ++++---- common/modules/completion.jsm | 2 +- common/modules/contexts.jsm | 6 +++--- common/modules/help.jsm | 2 +- common/modules/highlight.jsm | 4 +--- common/modules/io.jsm | 2 +- common/modules/javascript.jsm | 3 --- common/modules/main.jsm | 2 +- common/modules/styles.jsm | 4 ---- common/modules/template.jsm | 2 +- 22 files changed, 29 insertions(+), 50 deletions(-) diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index 2876d43b..f77432c4 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -216,7 +216,6 @@ var Bookmarks = Module("bookmarks", { * use in completion functions. */ get searchEngines() { - let searchEngines = []; let aliases = {}; return iter(services.browserSearch.getVisibleEngines({})).map(function ([, engine]) { let alias = engine.alias; @@ -430,7 +429,7 @@ var Bookmarks = Module("bookmarks", { const tags = { names: ["-tags", "-T"], description: "A comma-separated list of tags", - completer: function tags(context, args) { + completer: function tags(context) { context.generate = function () Ary(b.tags for (b of bookmarkcache) if (b.tags)) diff --git a/common/content/commandline.js b/common/content/commandline.js index 586140b3..7e4fb94e 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -1351,7 +1351,6 @@ var CommandLine = Module("commandline", { return; } - let value = this.editor.selection.focusNode.textContent; this.saveInput(); if (this.itemList.visible) @@ -1788,8 +1787,6 @@ var CommandLine = Module("commandline", { if (self.completions) self.completions.tabTimer.flush(); - let command = commandline.command; - self.accepted = true; return function () { modes.pop(); }; }); diff --git a/common/content/editor.js b/common/content/editor.js index 307d671e..40583ca8 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -846,7 +846,6 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { count = count || 1; let caret = !dactyl.focusedElement; - let controller = buffer.selectionController; while (count-- && modes.main == modes.VISUAL) { if (caret) diff --git a/common/content/events.js b/common/content/events.js index ea6453c5..447a0479 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -374,7 +374,6 @@ var Events = Module("events", { commandline.quiet = quiet; for (let evt_obj of DOM.Event.parse(keys)) { - let now = Date.now(); let key = DOM.Event.stringify(evt_obj); for (let type of values(["keydown", "keypress", "keyup"])) { let evt = update({}, evt_obj, { type: type }); @@ -1109,7 +1108,6 @@ var Events = Module("events", { mappings.add([modes.COMMAND], ["s", ""], "Sleep for {count} milliseconds before continuing macro playback", function ({ command, count }) { - let now = Date.now(); dactyl.assert(count, _("error.countRequired", command)); if (events.feedingKeys) util.sleep(count); diff --git a/common/content/history.js b/common/content/history.js index 6542358c..80584059 100644 --- a/common/content/history.js +++ b/common/content/history.js @@ -274,7 +274,7 @@ var History = Module("history", { names: ["-sort", "-s"], type: CommandOption.STRING, description: "The sort order of the results", - completer: function (context, args) { + completer: function (context) { context.compare = CompletionContext.Sort.unsorted; return Ary.flatten([ "annotation", diff --git a/common/content/key-processors.js b/common/content/key-processors.js index 152450ce..23cc200e 100644 --- a/common/content/key-processors.js +++ b/common/content/key-processors.js @@ -68,7 +68,6 @@ var ProcessorStack = Class("ProcessorStack", { events.dbg("EXECUTE(" + this._result(result) + ", " + force + ") events:" + this.events.length + " processors:" + this.processors.length + " actions:" + this.actions.length); - let processors = this.processors; let length = 1; if (force) diff --git a/common/content/mow.js b/common/content/mow.js index 0f8e2b70..8e063a01 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -35,7 +35,7 @@ var MOW = Module("mow", { events.listen(window, this, "windowEvents"); modules.mow = this; - let fontSize = DOM(document.documentElement).style.fontSize; + //let fontSize = DOM(document.documentElement).style.fontSize; styles.system.add("font-size", "dactyl://content/buffer.xhtml", // "body { font-size: " + fontSize + "; } \ "html|html > xul|scrollbar { visibility: collapse !important; }", diff --git a/common/content/statusline.js b/common/content/statusline.js index 529c06a7..da537d4d 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -75,7 +75,6 @@ var StatusLine = Module("statusline", { */$)); } - let _commandline = "if (window.dactyl) return dactyl.modules.commandline"; let prepend = [ ["button", { id: "appmenu-button", label: "", image: "chrome://branding/content/icon16.png", highlight: "AppmenuButton", xmlns: "xul" }], ["toolbarbutton", { id: "appmenu-toolbar-button", label: "", image: "chrome://branding/content/icon16.png" }], diff --git a/common/content/tabs.js b/common/content/tabs.js index e38d037e..bd0d7f57 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -666,7 +666,7 @@ var Tabs = Module("tabs", { { argCount: "?", count: true, - completer: function (context, args) { + completer: function (context) { context.filters.push(({ item }) => item.tab.pinned); completion.buffer(context); } @@ -819,7 +819,7 @@ var Tabs = Module("tabs", { commands.add(["quita[ll]", "qa[ll]"], "Quit this " + config.appName + " window", - function (args) { window.close(); }, + function () { window.close(); }, { argCount: "0" }); commands.add(["reloada[ll]"], @@ -850,7 +850,7 @@ var Tabs = Module("tabs", { }, { argCount: "1", bang: true, - completer: function (context, args) completion.buffer(context, true), + completer: function (context) completion.buffer(context, true), literal: 0 }); @@ -1008,10 +1008,9 @@ var Tabs = Module("tabs", { commands.add(["undoa[ll]"], "Undo closing of all closed tabs", - function (args) { + function () { for (let i of iter(tabs.closedTabs)) window.undoCloseTab(0); - }, { argCount: "0" }); diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index 149382ee..b838f3be 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -371,7 +371,7 @@ var Addons = Module("addons", { names: ["-types", "-type", "-t"], description: "The add-on types to list", default: ["extension"], - completer: function (context, args) completion.addonType(context), + completer: function (context) completion.addonType(context), type: CommandOption.LIST } ] @@ -446,7 +446,7 @@ var Addons = Module("addons", { names: ["-types", "-type", "-t"], description: "The add-on types to operate on", default: ["extension"], - completer: function (context, args) completion.addonType(context), + completer: function (context) completion.addonType(context), type: CommandOption.LIST } ] diff --git a/common/modules/bookmarkcache.jsm b/common/modules/bookmarkcache.jsm index e11e82b4..c74ec74c 100644 --- a/common/modules/bookmarkcache.jsm +++ b/common/modules/bookmarkcache.jsm @@ -48,7 +48,7 @@ update(Bookmark.prototype, { let res = []; res.toString = function () this.join("/"); - let id = this.id, parent, title; + let id = this.id, title; while ((id = services.bookmarks.getFolderIdForItem(id)) && (title = services.bookmarks.getItemTitle(id))) res.push(title); diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index 01021bb9..78108344 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -772,7 +772,6 @@ var Buffer = Module("Buffer", { let self = this; let doc = elem.ownerDocument; let uri = util.newURI(elem.href || elem.src, null, util.newURI(elem.baseURI)); - let referrer = util.newURI(doc.documentURI, doc.characterSet); try { services.security.checkLoadURIWithPrincipal(doc.nodePrincipal, uri, @@ -1186,7 +1185,7 @@ var Buffer = Module("Buffer", { * @param {boolean} useExternalEditor View the source in the external editor. */ viewSource: function viewSource(loc, useExternalEditor) { - let { dactyl, editor, history, options } = this.modules; + let { dactyl, history, options } = this.modules; let window = this.topWindow; @@ -1315,7 +1314,7 @@ var Buffer = Module("Buffer", { * closed range [Buffer.ZOOM_MIN, Buffer.ZOOM_MAX]. */ setZoom: function setZoom(value, fullZoom) { - let { dactyl, statusline, storage } = this.modules; + let { dactyl, statusline } = this.modules; let { ZoomManager } = this; if (fullZoom === undefined) @@ -1333,7 +1332,6 @@ var Buffer = Module("Buffer", { } if (prefs.get("browser.zoom.siteSpecific")) { - var privacy = sanitizer.getContext(this.win); if (value == 1) { this.prefs.clear("browser.content.full-zoom"); this.prefs.clear("dactyl.content.full-zoom"); @@ -1829,7 +1827,7 @@ var Buffer = Module("Buffer", { commands.add(["frameo[nly]"], "Show only the current frame's page", - function (args) { + function () { dactyl.open(buffer.focusedFrame.location.href); }, { argCount: "0" }); @@ -2041,7 +2039,7 @@ var Buffer = Module("Buffer", { }); }, completion: function initCompletion(dactyl, modules, window) { - let { CompletionContext, buffer, completion } = modules; + let { buffer, completion } = modules; completion.alternateStyleSheet = function alternateStylesheet(context) { context.title = ["Stylesheet", "Location"]; @@ -2100,7 +2098,7 @@ var Buffer = Module("Buffer", { mappings.add([modes.NORMAL], ["y", ""], "Yank current location to the clipboard", function () { - let { doc, uri } = buffer; + let { uri } = buffer; if (uri instanceof Ci.nsIURL) uri.query = uri.query.replace(/(?:^|&)utm_[^&]+/g, "") .replace(/^&/, ""); @@ -2438,7 +2436,7 @@ var Buffer = Module("Buffer", { function () { buffer.showPageInfo(true); }); }, options: function initOptions(dactyl, modules, window) { - let { Option, buffer, completion, config, options } = modules; + let { Option, buffer, completion, options } = modules; options.add(["encoding", "enc"], "The current buffer's character encoding", diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index cd0cb650..3d6bc8fe 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -660,7 +660,7 @@ var Commands = Module("commands", { lazyDepends: true, Local: function Local(dactyl, modules, window) { - let { Group, contexts } = modules; + let { contexts } = modules; return { init: function init() { this.Command = Class("Command", Command, { modules: modules }); @@ -1550,10 +1550,10 @@ var Commands = Module("commands", { const { commands, contexts } = modules; commands.add(["(", "-("], "", - function (args) { dactyl.echoerr(_("dactyl.cheerUp")); }, + function () { dactyl.echoerr(_("dactyl.cheerUp")); }, { hidden: true }); commands.add([")", "-)"], "", - function (args) { dactyl.echoerr(_("dactyl.somberDown")); }, + function () { dactyl.echoerr(_("dactyl.somberDown")); }, { hidden: true }); commands.add(["com[mand]"], @@ -1769,7 +1769,7 @@ var Commands = Module("commands", { }); }, javascript: function initJavascript(dactyl, modules, window) { - const { JavaScript, commands } = modules; + const { JavaScript } = modules; JavaScript.setCompleter([CommandHive.prototype.get, CommandHive.prototype.remove], [function () [[c.names, c.description] for (c of this)]]); diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm index 9efd530a..aa8845d8 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -1123,7 +1123,7 @@ var Completion = Module("completion", { const { commands, completion } = modules; commands.add(["contexts"], "List the completion contexts used during completion of an Ex command", - function (args) { + function () { modules.commandline.commandOutput( ["div", { highlight: "Completions" }, template.completionRow(["Context", "Title"], "CompTitle"), diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm index 7e1f76e9..8109479e 100644 --- a/common/modules/contexts.jsm +++ b/common/modules/contexts.jsm @@ -769,7 +769,7 @@ var Contexts = Module("contexts", { }); commands.add(["elsei[f]", "elif"], "Execute commands until the next :elseif, :else, or :endif only if the argument returns true", - function (args) {}, + function () {}, { always: function (args) { checkStack("if"); @@ -781,7 +781,7 @@ var Contexts = Module("contexts", { }); commands.add(["el[se]"], "Execute commands until the next :endif only if the previous conditionals were not executed", - function (args) {}, + function () {}, { always: function (args) { checkStack("if"); @@ -792,7 +792,7 @@ var Contexts = Module("contexts", { }); commands.add(["en[dif]", "fi"], "End a string of :if/:elseif/:else conditionals", - function (args) {}, + function () {}, { always: function (args) { args.context.noExecute = pop("if"); }, argCount: "0" diff --git a/common/modules/help.jsm b/common/modules/help.jsm index ccca2694..a9cb0dee 100644 --- a/common/modules/help.jsm +++ b/common/modules/help.jsm @@ -133,7 +133,7 @@ var Help = Module("Help", { function rec(text, level, li) { let res = []; - let list, space, i = 0; + let list, i = 0; for (let match of re.iterate(text)) { if (match.comment) diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm index c6f6064c..6f15826b 100644 --- a/common/modules/highlight.jsm +++ b/common/modules/highlight.jsm @@ -154,8 +154,6 @@ var Highlights = Module("Highlight", { get: function get(k) this.highlight[k], set: function set(key, newStyle, force, append, extend) { - let [, class_, selectors] = key.match(/^([a-zA-Z_-]+)(.*)/); - let highlight = this.highlight[key] || this._create(false, [key]); let bases = extend || highlight.extends; @@ -316,7 +314,7 @@ var Highlights = Module("Highlight", { if (scheme == "default") highlight.clear(); else { - lastScheme = modules.io.sourceFromRuntimePath(["colors/" + scheme + "." + config.fileExtension]); + lastScheme = io.sourceFromRuntimePath(["colors/" + scheme + "." + config.fileExtension]); dactyl.assert(lastScheme, _("command.colorscheme.notFound", scheme)); } autocommands.trigger("ColorScheme", { name: scheme }); diff --git a/common/modules/io.jsm b/common/modules/io.jsm index cbff066b..97cd7c4f 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -34,7 +34,7 @@ var IO = Module("io", { }, Local: function Local(dactyl, modules, window) { - let { io, plugins } = modules; + let { io } = modules; return { init: function init() { diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index e565c010..42067822 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -4,8 +4,6 @@ // given in the LICENSE.txt file included with this file. "use strict"; -let { getOwnPropertyNames } = Object; - try { defineModule("javascript", { @@ -694,7 +692,6 @@ var JavaScript = Module("javascript", { modules.JavaScript = Class("JavaScript", JavaScript, { modules: modules, window: window }); }, completion: function (dactyl, modules, window) { - const { completion } = modules; update(modules.completion, { get javascript() modules.javascript.bound.complete, javascriptCompleter: JavaScript // Backwards compatibility diff --git a/common/modules/main.jsm b/common/modules/main.jsm index f876e725..25a41092 100644 --- a/common/modules/main.jsm +++ b/common/modules/main.jsm @@ -209,7 +209,7 @@ overlay.overlayWindow(Object.keys(config.overlays), load: function onLoad(document) { let self = this; - var { modules, Module } = this.modules; + var { modules } = this.modules; delete window.dactyl; this.startTime = Date.now(); diff --git a/common/modules/styles.jsm b/common/modules/styles.jsm index e04cf945..5f5d17fd 100644 --- a/common/modules/styles.jsm +++ b/common/modules/styles.jsm @@ -12,7 +12,6 @@ defineModule("styles", { lazyRequire("contexts", ["Contexts"]); lazyRequire("template", ["template"]); -function cssUri(css) "chrome-data:text/css," + encodeURI(css); var namespace = "@namespace html " + JSON.stringify(XHTML) + ";\n" + "@namespace xul " + JSON.stringify(XUL) + ";\n" + "@namespace dactyl " + JSON.stringify(NS) + ";\n"; @@ -608,7 +607,6 @@ var Styles = Module("Styles", { }, { completer: function (context, args) { - let compl = []; let sheet = args["-group"].get(args["-name"]); if (args.completeArg == 0) { if (sheet) @@ -685,8 +683,6 @@ var Styles = Module("Styles", { }, { bang: true, completer: function (context, args) { - let uris = util.visibleURIs(window.content); - Styles.completeSite(context, window.content, args["-group"]); if (cmd.filter) context.filters.push(({ sheets }) => sheets.some(cmd.filter)); diff --git a/common/modules/template.jsm b/common/modules/template.jsm index fa33ddc9..b5185e9c 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -351,7 +351,7 @@ var Template = Module("Template", { let s = [""]; let start = 0; - let n = 0, _i; + let _i; // XXX for (let [i, length, args] of iter_) { if (i == _i || i < _i) break;