]> git.donarmstrong.com Git - dactyl.git/commitdiff
Import r6948 from upstream hg supporting Firefox up to 24.* upstream/1.0+hg6948
authorMichael Schutte <michi@uiae.at>
Mon, 9 Sep 2013 08:31:35 +0000 (10:31 +0200)
committerMichael Schutte <michi@uiae.at>
Mon, 9 Sep 2013 08:32:04 +0000 (10:32 +0200)
68 files changed:
.hg_archival.txt
common/bootstrap.js
common/components/commandline-handler.js
common/content/abbreviations.js
common/content/autocommands.js
common/content/bookmarks.js
common/content/browser.js
common/content/commandline.js
common/content/dactyl.js
common/content/disable-acr.jsm
common/content/editor.js
common/content/eval.js
common/content/events.js
common/content/help.js
common/content/hints.js
common/content/history.js
common/content/key-processors.js
common/content/mappings.js
common/content/marks.js
common/content/modes.js
common/content/mow.js
common/content/quickmarks.js
common/content/statusline.js
common/content/tabs.js
common/locale/en-US/autocommands.xml
common/locale/en-US/options.xml
common/locale/en-US/privacy.xml
common/modules/addons.jsm
common/modules/base.jsm
common/modules/bookmarkcache.jsm
common/modules/bootstrap.jsm
common/modules/buffer.jsm
common/modules/cache.jsm
common/modules/commands.jsm
common/modules/completion.jsm
common/modules/config.jsm
common/modules/contexts.jsm
common/modules/dom-e4x.jsm
common/modules/dom.jsm
common/modules/downloads.jsm
common/modules/finder.jsm
common/modules/help.jsm
common/modules/highlight.jsm
common/modules/io.jsm
common/modules/javascript.jsm
common/modules/main.jsm
common/modules/messages.jsm
common/modules/options.jsm
common/modules/overlay.jsm
common/modules/prefs.jsm
common/modules/protocol.jsm
common/modules/sanitizer.jsm
common/modules/services.jsm
common/modules/storage.jsm
common/modules/styles.jsm
common/modules/template.jsm
common/modules/util.jsm
common/tests/functional/dactyl.jsm
common/tests/functional/testCommands.js
melodactyl/content/config.js
melodactyl/content/library.js
melodactyl/content/player.js
pentadactyl/content/config.js
pentadactyl/install.rdf
teledactyl/content/addressbook.js
teledactyl/content/compose/compose.js
teledactyl/content/config.js
teledactyl/content/mail.js

index af226a22887a7cdae38d93ccb2ab4613fec6c51c..19d75fba70a2b0cb672b10732fd6393300efa82d 100644 (file)
@@ -1,5 +1,5 @@
 repo: 373f1649c80dea9be7b5bc9c57e8395f94f93ab1
-node: ddb20953fcebb277dc5a68679d69f39873e3a866
+node: dd11a1a668d0ac31de134e00a8149fe044dad758
 branch: default
 latesttag: pentadactyl-1.0rc1
-latesttagdistance: 195
+latesttagdistance: 219
index d0dd98a809265f8e95fc3ef420cdb286a89ab02b..de289ee03f849a39bc0af3e2575bfd388ade2a69 100755 (executable)
@@ -37,9 +37,9 @@ function reportError(e) {
     Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService)
                                        .logStringMessage(stack);
 }
-function debug() {
+function debug(...args) {
     if (DEBUG)
-        dump(name + ": " + Array.join(arguments, ", ") + "\n");
+        dump(name + ": " + args.join(", ") + "\n");
 }
 
 function httpGet(uri) {
@@ -103,7 +103,7 @@ let JSMLoader = {
             return resourceProto.resolveURI(uri);
 
         let chan = Services.io.newChannelFromURI(uri);
-        try { chan.cancel(Cr.NS_BINDING_ABORTED) } catch (e) {}
+        try { chan.cancel(Cr.NS_BINDING_ABORTED); } catch (e) {}
         return chan.name;
     },
 
index 0be89de64a918892be2ac2a70af94beccbefe6eb..481cbcde083f3cb31895827ea49a9fa83e1ffd6f 100644 (file)
@@ -91,4 +91,4 @@ else
     var NSGetModule = XPCOMUtils.generateNSGetModule([CommandLineHandler]);
 var EXPORTED_SYMBOLS = ["NSGetFactory", "global"];
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 4b646446aa607139f3c151137b818571d8f8eb72..4013be29f68b27361e2b16a6b17b07b5d5d2179c 100644 (file)
@@ -347,7 +347,7 @@ var Abbreviations = Module("abbreviations", {
                             arguments: [abbr.lhs],
                             literalArg: abbr.rhs,
                             options: {
-                                "-javascript": abbr.rhs ? null : undefined
+                                "-javascript": callable(abbr.rhs) ? null : undefined
                             }
                         }
                         for ([, abbr] in Iterator(abbreviations.user.merged))
@@ -380,4 +380,4 @@ var Abbreviations = Module("abbreviations", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index b1419028b76320b4d9472e8af0dc25e993cdfb38..eaaa1c785e1613b2c04ab535fc1f34d5d7f2d19f 100644 (file)
@@ -122,7 +122,7 @@ var AutoCommands = Module("autocommands", {
                                 ["td", {}, item.filter.toJSONXML ? item.filter.toJSONXML(modules) : String(item.filter)],
                                 ["td", {}, String(item.command)]]),
                         ["tr", { style: "height: .5ex;" }]]).toArray(),
-                    ["tr", { style: "height: .5ex;" }],
+                    ["tr", { style: "height: .5ex;" }]
                 ])]);
         commandline.commandOutput(table);
     },
@@ -246,7 +246,7 @@ var AutoCommands = Module("autocommands", {
                         return void dactyl.echomsg(_("autocmd.noMatching"));
 
                     let [event, url] = args;
-                    let defaultURL = url || buffer.uri.spec;
+                    let uri = util.createURI(url) || buffer.uri;
                     let validEvents = Object.keys(config.autocommands);
 
                     // TODO: add command validators
@@ -254,7 +254,7 @@ var AutoCommands = Module("autocommands", {
                                   _("autocmd.cantExecuteAll"));
                     dactyl.assert(validEvents.indexOf(event) >= 0,
                                   _("autocmd.noGroup", args));
-                    dactyl.assert(autocommands.get(event).some(function (c) c.patterns.some(function (re) re.test(defaultURL) ^ !re.result)),
+                    dactyl.assert(autocommands.get(event).some(function (c) c.filter(uri)),
                                   _("autocmd.noMatching"));
 
                     if (this.name == "doautoall" && dactyl.has("tabs")) {
@@ -263,13 +263,13 @@ var AutoCommands = Module("autocommands", {
                         for (let i = 0; i < tabs.count; i++) {
                             tabs.select(i);
                             // if no url arg is specified use the current buffer's URL
-                            autocommands.trigger(event, { url: url || buffer.uri.spec });
+                            autocommands.trigger(event, { url: uri.spec });
                         }
 
                         tabs.select(current);
                     }
                     else
-                        autocommands.trigger(event, { url: defaultURL });
+                        autocommands.trigger(event, { url: uri.spec });
                 }, {
                     argCount: "*", // FIXME: kludged for proper error message should be "1".
                     completer: function (context) completion.autocmdEvent(context),
@@ -296,4 +296,4 @@ var AutoCommands = Module("autocommands", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 65ec1150733c7681fc97d963c435c5f82f7d6aa5..d92c62476e5939647b790017da70e96cb907e457 100644 (file)
@@ -118,7 +118,7 @@ var Bookmarks = Module("bookmarks", {
      * @param {Element} elem A form element for which to add a keyword.
      */
     addSearchKeyword: function addSearchKeyword(elem) {
-        if (elem instanceof HTMLFormElement || elem.form)
+        if (elem instanceof Ci.nsIDOMHTMLFormElement || elem.form)
             var { url, postData, charset } = DOM(elem).formData;
         else
             var [url, postData, charset] = [elem.href || elem.src, null, elem.ownerDocument.characterSet];
@@ -730,4 +730,4 @@ var Bookmarks = Module("bookmarks", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index a1b111094fd986cd1bb80763c2d9d862365fe984..79d98d2df8fbe57b2b024b557a0307d349d0beef 100644 (file)
@@ -66,7 +66,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
     events: {
         DOMContentLoaded: function onDOMContentLoaded(event) {
             let doc = event.originalTarget;
-            if (doc instanceof HTMLDocument)
+            if (doc instanceof Ci.nsIDOMHTMLDocument)
                 this._triggerLoadAutocmd("DOMLoad", doc);
         },
 
@@ -78,7 +78,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
             if (doc instanceof Document)
                 dactyl.initDocument(doc);
 
-            if (doc instanceof HTMLDocument) {
+            if (doc instanceof Ci.nsIDOMHTMLDocument) {
                 if (doc.defaultView.frameElement) {
                     // document is part of a frameset
 
@@ -222,7 +222,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
             if (dactyl.forceTarget in openModes)
                 mode = openModes[dactyl.forceTarget];
 
-            CommandExMode().open(mode + "open " + (args || ""))
+            CommandExMode().open(mode + "open " + (args || ""));
         }
 
         function decode(uri) util.losslessDecodeURI(uri)
@@ -282,4 +282,4 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index f01cbb0b33b9f31a84b8d7af8bfd8ca3c5438037..9ea1fc33ba78d13920b7979c8f0430e5fee2756b 100644 (file)
@@ -54,7 +54,7 @@ var CommandWidgets = Class("CommandWidgets", {
                     ["vbox", { id: "dactyl-completions-" + s + "commandline-container", class: "dactyl-container", hidden: "false", collapsed: "true" },
                         ["iframe", { class: "dactyl-completions", id: "dactyl-completions-" + s + "commandline", src: "dactyl://content/buffer.xhtml",
                                      contextmenu: "dactyl-contextmenu", flex: "1", hidden: "false", collapsed: "false", highlight: "Events",
-                                     events: "mowEvents" }]]]],
+                                     events: "mowEvents" }]]]]
         });
 
         this.elements = {};
@@ -167,11 +167,11 @@ var CommandWidgets = Class("CommandWidgets", {
 
         function get(prefix, map, id) (obj.getElement || util.identity)(map[id] || document.getElementById(prefix + id));
 
-        this.active.__defineGetter__(obj.name, function () self.activeGroup[obj.name][obj.name]);
-        this.activeGroup.__defineGetter__(obj.name, function () self.getGroup(obj.name));
+        this.active.__defineGetter__(obj.name, () => this.activeGroup[obj.name][obj.name]);
+        this.activeGroup.__defineGetter__(obj.name, () => this.getGroup(obj.name));
 
-        memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
-        memoize(this.commandbar, obj.name, function () get("dactyl-", {}, (obj.id || obj.name)));
+        memoize(this.statusbar, obj.name, () => get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
+        memoize(this.commandbar, obj.name, () => get("dactyl-", {}, (obj.id || obj.name)));
 
         if (!(obj.noValue || obj.getValue)) {
             Object.defineProperty(this, obj.name, Modes.boundProperty({
@@ -488,9 +488,9 @@ var CommandPromptMode = Class("CommandPromptMode", CommandMode, {
         init.supercall(this);
     },
 
-    complete: function CPM_complete(context) {
+    complete: function CPM_complete(context, ...args) {
         if (this.completer)
-            context.forkapply("prompt", 0, this, "completer", Array.slice(arguments, 1));
+            context.forkapply("prompt", 0, this, "completer", args);
     },
 
     get mode() modes.PROMPT
@@ -504,8 +504,6 @@ var CommandPromptMode = Class("CommandPromptMode", CommandMode, {
  */
 var CommandLine = Module("commandline", {
     init: function init() {
-        const self = this;
-
         this._callbacks = {};
 
         memoize(this, "_store", function () storage.newMap("command-history", { store: true, privateData: true }));
@@ -634,7 +632,7 @@ var CommandLine = Module("commandline", {
 
             node.completionList = ItemList(elem);
             node.completionList.isAboveMow = node.id ==
-                this.widgets.statusbar.commandline.id
+                this.widgets.statusbar.commandline.id;
         }
         return node.completionList;
     },
@@ -741,7 +739,7 @@ var CommandLine = Module("commandline", {
         if (val)
             this.widgets["message-pre"] = _("commandline.moreMessages", val) + " ";
         else
-            this.widgets["message-pre"] = null
+            this.widgets["message-pre"] = null;
     },
 
     _lastEcho: null,
@@ -777,13 +775,12 @@ var CommandLine = Module("commandline", {
 
         highlightGroup = highlightGroup || this.HL_NORMAL;
 
-        let self = this;
-        function 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.
             message.message;
-            self._messageHistory.add(update({ highlight: highlightGroup }, message));
+            this._messageHistory.add(update({ highlight: highlightGroup }, message));
             return message.message;
         }
 
@@ -802,7 +799,7 @@ var CommandLine = Module("commandline", {
         if ((flags & this.FORCE_MULTILINE) || (/\n/.test(data) || !isinstance(data, [_, "String"])) && !(flags & this.FORCE_SINGLELINE))
             action = mow.closure.echo;
 
-        let single = function () action == self._echoLine;
+        let checkSingleLine = () => action == this._echoLine;
 
         if (forceSingle) {
             this._lastEcho = null;
@@ -810,11 +807,11 @@ var CommandLine = Module("commandline", {
         }
         else {
             // So complicated...
-            if (single() && !this.widgets.mowContainer.collapsed) {
+            if (checkSingleLine() && !this.widgets.mowContainer.collapsed) {
                 highlightGroup += " Message";
                 action = mow.closure.echo;
             }
-            else if (!single() && this.widgets.mowContainer.collapsed) {
+            else if (!checkSingleLine() && this.widgets.mowContainer.collapsed) {
                 if (this._lastEcho && this.widgets.message && this.widgets.message[1] == this._lastEcho.msg) {
                     if (!(this._lastEcho.flags & this.APPEND_TO_MESSAGES))
                         appendToMessages(this._lastEcho.data);
@@ -832,20 +829,20 @@ var CommandLine = Module("commandline", {
             else if (this._lastEcho && this.widgets.message && this.widgets.message[1] == this._lastEcho.msg) {
                 if (!(this._lastEcho.flags & this.APPEND_TO_MESSAGES))
                     appendToMessages(this._lastEcho.data);
-                if (single() && !(flags & this.APPEND_TO_MESSAGES))
+                if (checkSingleLine() && !(flags & this.APPEND_TO_MESSAGES))
                     appendToMessages(data);
 
                 flags |= this.APPEND_TO_MESSAGES;
                 this.hiddenMessages++;
             }
-            this._lastEcho = single() && { flags: flags, msg: data, data: arguments[0] };
+            this._lastEcho = checkSingleLine() && { flags: flags, msg: data, data: arguments[0] };
         }
 
         this._lastClearable = action === this._echoLine && String(data);
         this._lastEchoTime = (flags & this.FORCE_SINGLELINE) && Date.now();
 
         if (action)
-            action.call(this, data, highlightGroup, single);
+            action.call(this, data, highlightGroup, checkSingleLine());
     },
     _lastEchoTime: 0,
 
@@ -958,7 +955,7 @@ var CommandLine = Module("commandline", {
 
     updateOutputHeight: deprecated("mow.resize", function updateOutputHeight(open, extra) mow.resize(open, extra)),
 
-    withOutputToString: function withOutputToString(fn, self) {
+    withOutputToString: function withOutputToString(fn, self, ...args) {
         dactyl.registerObserver("echoLine", observe, true);
         dactyl.registerObserver("echoMultiline", observe, true);
 
@@ -968,7 +965,7 @@ var CommandLine = Module("commandline", {
         }
 
         this.savingOutput = true;
-        dactyl.trapErrors.apply(dactyl, [fn, self].concat(Array.slice(arguments, 2)));
+        dactyl.trapErrors.apply(dactyl, [fn, self].concat(args));
         this.savingOutput = false;
         return output.map(function (elem) elem instanceof Node ? DOM.stringify(elem) : elem)
                      .join("\n");
@@ -1013,7 +1010,7 @@ var CommandLine = Module("commandline", {
 
             this.store = this.store.filter(function (line) (line.value || line) != str);
             dactyl.trapErrors(function () {
-                this.store.push({ value: str, timestamp: Date.now()*1000, privateData: privateData });
+                this.store.push({ value: str, timestamp: Date.now() * 1000, privateData: privateData });
             }, this);
             this.store = this.store.slice(Math.max(0, this.store.length - options["history"]));
         },
@@ -1767,8 +1764,7 @@ var CommandLine = Module("commandline", {
                 return Events.PASS;
             });
 
-        let bind = function bind()
-            mappings.add.apply(mappings, [[modes.COMMAND_LINE]].concat(Array.slice(arguments)))
+        let bind = function bind(...args) mappings.add.apply(mappings, [[modes.COMMAND_LINE]].concat(args));
 
         bind(["<Esc>", "<C-[>"], "Stop waiting for completions or exit Command Line mode",
              function ({ self }) {
@@ -2030,7 +2026,7 @@ var ItemList = Class("ItemList", {
         if (start < 0 || start >= this.itemCount)
             return null;
 
-        group = array.nth(groups, function (g) let (i = start - g.offsets.start) i >= 0 && i < g.itemCount, 0)
+        group = array.nth(groups, function (g) let (i = start - g.offsets.start) i >= 0 && i < g.itemCount, 0);
         return [group.context, start - group.offsets.start];
     },
 
@@ -2342,7 +2338,7 @@ var ItemList = Class("ItemList", {
                 container.scrollTop = scroll;
                 if (scrollY != null)
                     win.scrollTo(0, Math.max(scrollY, 0));
-            }
+            };
         },
 
         /**
@@ -2455,4 +2451,4 @@ var ItemList = Class("ItemList", {
     })
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 02ce9bd177eec85c419f7875c35bdd8caac1e2be..64aa91358d46886bd9cbe3e492cf8cb991a054df 100644 (file)
@@ -1,6 +1,6 @@
 // Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
 // Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -83,7 +83,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
         }
     },
 
-
     observers: {
         "dactyl-cleanup": function dactyl_cleanup(subject, reason) {
             let modules = dactyl.modules;
@@ -236,8 +235,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
             });
     },
 
-    triggerObserver: function triggerObserver(type) {
-        return this.applyTriggerObserver(type, Array.slice(arguments, 1));
+    triggerObserver: function triggerObserver(type, ...args) {
+        return this.applyTriggerObserver(type, args);
     },
 
     addUsageCommand: function (params) {
@@ -524,10 +523,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
      * Acts like the Function builtin, but the code executes in the
      * userContext global.
      */
-    userFunc: function userFunc() {
+    userFunc: function userFunc(...args) {
         return this.userEval(
-            "(function userFunction(" + Array.slice(arguments, 0, -1).join(", ") + ")" +
-            " { " + arguments[arguments.length - 1] + " })");
+            "(function userFunction(" + args.slice(0, -1).join(", ") + ")" +
+            " { " + args.pop() + " })");
     },
 
     /**
@@ -600,7 +599,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
                     if (win.frameElement)
                         win.frameElement.blur();
                     // Grr.
-                    if (content.document.activeElement instanceof HTMLIFrameElement)
+                    if (content.document.activeElement instanceof Ci.nsIDOMHTMLIFrameElement)
                         content.document.activeElement.blur();
                 });
             }
@@ -682,7 +681,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
             tag = function (map) [
                 let (c = obj.modes[0].char) c ? c + "_" : "",
                 map
-            ]
+            ];
             link = function (map) {
                 let [, mode, name, extra] = /^(?:(.)_)?(?:<([^>]+)>)?(.*)$/.exec(map);
                 let k = ["k", {}, extra];
@@ -710,7 +709,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
         let description = ["description", {},
             obj.description ? ["p", {}, template.linkifyHelp(obj.description.replace(/\.?$/, "."), true)] : "",
             extraHelp ? extraHelp : "",
-            !(extraHelp || obj.description) ? ["p", {}, /*L*/ "Sorry, no help available."] : ""]
+            !(extraHelp || obj.description) ? ["p", {}, /*L*/ "Sorry, no help available."] : ""];
 
         res.push(
             ["item", {},
@@ -1117,11 +1116,11 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
      * @param {function} func The function to call
      * @param {object} self The 'this' object for the function.
      */
-    trapErrors: function trapErrors(func, self) {
+    trapErrors: function trapErrors(func, self, ...args) {
         try {
             if (isString(func))
                 func = self[func];
-            return func.apply(self || this, Array.slice(arguments, 2));
+            return func.apply(self || this, args);
         }
         catch (e) {
             try {
@@ -1200,7 +1199,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
                     dactyl.reportError(e, true);
                 }
             });
-        }
+        };
     },
 
     /**
@@ -1404,10 +1403,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
                         groups.every(function (g) !g.validator || g.validator(val))
             });
 
-        options.add(["helpfile", "hf"],
-            "Name of the main help file",
-            "string", "intro");
-
         options.add(["loadplugins", "lpl"],
             "A regexp list that defines which plugins are loaded at startup and via :loadplugins",
             "regexplist", "'\\.(js|" + config.fileExtension + ")$'");
@@ -1829,7 +1824,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
                     commandline.commandOutput([
                         ["div", {}, [config.appName, " ", config.version, date, " running on: "].join("")],
                         ["div", {}, [window.navigator.userAgent].join("")]
-                    ])
+                    ]);
                 }
             }, {
                 argCount: "0",
@@ -2003,4 +1998,4 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 5f5b4feac44bd6f47c21e97aa1ed412ef8182f1f..86e55c4a4a05021f1131e2a5a175ea98e6c1b376 100644 (file)
@@ -64,7 +64,7 @@ function chromeDocuments() {
                                                                   Ci.nsIDocShell.ENUMERATE_FORWARDS);
             while (docShells.hasMoreElements())
                 try {
-                yield docShells.getNext().QueryInterface(Ci.nsIDocShell).contentViewer.DOMDocument;
+                    yield docShells.getNext().QueryInterface(Ci.nsIDocShell).contentViewer.DOMDocument;
                 }
                 catch (e) {}
         }
@@ -73,4 +73,4 @@ function chromeDocuments() {
 
 var EXPORTED_SYMBOLS = ["cleanup", "init"];
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index eef3c1ded03f38f4fecd42e038b8c192b47dafa3..01a25ebddb60346e5412d735ae2422b5716a99e1 100644 (file)
@@ -470,7 +470,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
         }
 
         try {
-            var tmpfile = io.createTempFile();
+            var tmpfile = io.createTempFile("txt", "." + buffer.uri.host);
             if (!tmpfile)
                 throw Error(_("io.cantCreateTempFile"));
 
@@ -870,7 +870,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
         function addBeginInsertModeMap(keys, commands, description) {
             mappings.add([modes.TEXT_EDIT], keys, description || "",
                 function () {
-                    commands.forEach(function (cmd) { editor.executeCommand(cmd, 1) });
+                    commands.forEach(function (cmd) { editor.executeCommand(cmd, 1); });
                     modes.push(modes.INSERT);
                 },
                 { type: "editor" });
@@ -1148,26 +1148,25 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
             mappings.add([modes.TEXT_EDIT], names, description,
                          action, update({ type: "editor" }, params));
 
-
         bind(["<C-a>"], "Increment the next number",
-             function ({ count }) { editor.modifyNumber(count || 1) },
+             function ({ count }) { editor.modifyNumber(count || 1); },
              { count: true });
 
         bind(["<C-x>"], "Decrement the next number",
-             function ({ count }) { editor.modifyNumber(-(count || 1)) },
+             function ({ count }) { editor.modifyNumber(-(count || 1)); },
              { count: true });
 
         // text edit mode
         bind(["u"], "Undo changes",
-             function (args) {
-                 editor.editor.undo(Math.max(args.count, 1));
+             function ({ count }) {
+                 editor.editor.undo(Math.max(count, 1));
                  editor.deselect();
              },
              { count: true, noTransaction: true });
 
         bind(["<C-r>"], "Redo undone changes",
-             function (args) {
-                 editor.editor.redo(Math.max(args.count, 1));
+             function ({ count }) {
+                 editor.editor.redo(Math.max(count, 1));
                  editor.deselect();
              },
              { count: true, noTransaction: true });
@@ -1325,8 +1324,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
             },
             { count: true });
 
-        let bind = function bind() mappings.add.apply(mappings,
-                                                      [[modes.AUTOCOMPLETE]].concat(Array.slice(arguments)))
+        let bind = function bind(...args) mappings.add.apply(mappings, [[modes.AUTOCOMPLETE]].concat(args));
 
         bind(["<Esc>"], "Return to Insert mode",
              function () Events.PASS_THROUGH);
@@ -1407,4 +1405,4 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 9e10d9f5a37e44c0450239e534d4bda4a092315d..5ef095192ef5811b3fe3fb3f977a38b5af4f4b23 100644 (file)
@@ -9,4 +9,4 @@ catch (e) { __dactyl_eval_error = e; }
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 98dc0281f512df5362a4c5f6528498d3576c68c2..ffa279bb1fd41ebc1b362bdee56d9908dffba44c 100644 (file)
@@ -611,7 +611,10 @@ var Events = Module("events", {
             if (!(services.focus.getLastFocusMethod(win) & 0x3000)
                 && events.isContentNode(elem)
                 && !buffer.focusAllowed(elem)
-                && isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
+                && isinstance(elem, [Ci.nsIDOMHTMLInputElement,
+                                     Ci.nsIDOMHTMLSelectElement,
+                                     Ci.nsIDOMHTMLTextAreaElement,
+                                     Ci.nsIDOMWindow])) {
 
                 if (elem.frameElement)
                     dactyl.focusContent(true);
@@ -673,7 +676,7 @@ var Events = Module("events", {
 
                 // Hack to deal with <BS> and so forth not dispatching input
                 // events
-                if (key && event.originalTarget instanceof HTMLInputElement && !modes.main.passthrough) {
+                if (key && event.originalTarget instanceof Ci.nsIDOMHTMLInputElement && !modes.main.passthrough) {
                     let elem = event.originalTarget;
                     elem.dactylKeyPress = elem.value;
                     util.timeout(function () {
@@ -844,7 +847,7 @@ var Events = Module("events", {
     // access to the real focus target
     // Huh? --djk
     onFocusChange: util.wrapCallback(function onFocusChange(event) {
-        function hasHTMLDocument(win) win && win.document && win.document instanceof HTMLDocument
+        function hasHTMLDocument(win) win && win.document && win.document instanceof Ci.nsIDOMHTMLDocument
         if (dactyl.ignoreFocus)
             return;
 
@@ -861,7 +864,7 @@ var Events = Module("events", {
             if (elem && elem.readOnly)
                 return;
 
-            if (isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
+            if (isinstance(elem, [Ci.nsIDOMHTMLEmbedElement, Ci.nsIDOMHTMLEmbedElement])) {
                 if (!modes.main.passthrough && modes.main != modes.EMBED)
                     modes.push(modes.EMBED);
                 return;
@@ -965,8 +968,9 @@ var Events = Module("events", {
 
     isInputElement: function isInputElement(elem) {
         return DOM(elem).isEditable ||
-               isinstance(elem, [HTMLEmbedElement, HTMLObjectElement,
-                                 HTMLSelectElement])
+               isinstance(elem, [Ci.nsIDOMHTMLEmbedElement,
+                                 Ci.nsIDOMHTMLObjectElement,
+                                 Ci.nsIDOMHTMLSelectElement]);
     },
 
     kill: function kill(event) {
@@ -1168,4 +1172,4 @@ var Events = Module("events", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 70c37533c366c66dc9ebc00aa6f68edfb5c39a82..1d921fac5c4c1e49f0266aed435545401cef5b51 100644 (file)
@@ -24,4 +24,4 @@ function checkFragment() {
 document.addEventListener("load", checkFragment, true);
 document.addEventListener("hashChange", checkFragment, true);
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index a9154e88fcea43a9b57b84d53df8df9d25ea7f9f..d151c2c3d688f439cc802ea732309d23ec896495 100644 (file)
@@ -337,9 +337,11 @@ var HintSession = Class("HintSession", CommandMode, {
 
                 if (elem.hasAttributeNS(NS, "hint"))
                     [hint.text, hint.showText] = [elem.getAttributeNS(NS, "hint"), true];
-                else if (isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement]))
+                else if (isinstance(elem, [Ci.nsIDOMHTMLInputElement,
+                                           Ci.nsIDOMHTMLSelectElement,
+                                           Ci.nsIDOMHTMLTextAreaElement]))
                     [hint.text, hint.showText] = hints.getInputHint(elem, doc);
-                else if (elem.firstElementChild instanceof HTMLImageElement && /^\s*$/.test(elem.textContent))
+                else if (elem.firstElementChild instanceof Ci.nsIDOMHTMLImageElement && /^\s*$/.test(elem.textContent))
                     [hint.text, hint.showText] = [elem.firstElementChild.alt || elem.firstElementChild.title, true];
                 else
                     hint.text = elem.textContent.toLowerCase();
@@ -349,7 +351,7 @@ var HintSession = Class("HintSession", CommandMode, {
                 let leftPos = Math.max((rect.left + offsetX), offsetX);
                 let topPos  = Math.max((rect.top + offsetY), offsetY);
 
-                if (elem instanceof HTMLAreaElement)
+                if (elem instanceof Ci.nsIDOMHTMLAreaElement)
                     [leftPos, topPos] = this.getAreaOffset(elem, leftPos, topPos);
 
                 hint.span.setAttribute("style", ["display: none; left:", leftPos, "px; top:", topPos, "px"].join(""));
@@ -596,7 +598,7 @@ var HintSession = Class("HintSession", CommandMode, {
                 if (!hint.valid)
                     continue inner;
 
-                if (hint.text == "" && hint.elem.firstChild && hint.elem.firstChild instanceof HTMLImageElement) {
+                if (hint.text == "" && hint.elem.firstChild && hint.elem.firstChild instanceof Ci.nsIDOMHTMLImageElement) {
                     if (!hint.imgSpan) {
                         let rect = hint.elem.firstChild.getBoundingClientRect();
                         if (!rect)
@@ -614,7 +616,7 @@ var HintSession = Class("HintSession", CommandMode, {
 
                 let str = this.getHintString(hintnum);
                 let text = [];
-                if (hint.elem instanceof HTMLInputElement)
+                if (hint.elem instanceof Ci.nsIDOMHTMLInputElement)
                     if (hint.elem.type === "radio")
                         text.push(UTF8(hint.elem.checked ? "⊙" : "â—‹"));
                     else if (hint.elem.type === "checkbox")
@@ -781,7 +783,8 @@ var Hints = Module("hints", {
         this.addMode("i", "Show image",                           function (elem) dactyl.open(elem.src));
         this.addMode("I", "Show image in a new tab",              function (elem) dactyl.open(elem.src, dactyl.NEW_TAB));
 
-        function isScrollable(elem) isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]) ||
+        function isScrollable(elem) isinstance(elem, [Ci.nsIDOMHTMLFrameElement,
+                                                      Ci.nsIDOMHTMLIFrameElement]) ||
             Buffer.isScrollable(elem, 0, true) || Buffer.isScrollable(elem, 0, false);
     },
 
@@ -850,7 +853,7 @@ var Hints = Module("hints", {
         else {
             for (let [, option] in Iterator(options["hintinputs"])) {
                 if (option == "value") {
-                    if (elem instanceof HTMLSelectElement) {
+                    if (elem instanceof Ci.nsIDOMHTMLSelectElement) {
                         if (elem.selectedIndex >= 0)
                             return [elem.item(elem.selectedIndex).text.toLowerCase(), false];
                     }
@@ -1349,7 +1352,7 @@ var Hints = Module("hints", {
             {
                 values: {
                     "0": "Follow the first hint as soon as typed text uniquely identifies it. Follow the selected hint on <Return>.",
-                    "1": "Follow the selected hint on <Return>.",
+                    "1": "Follow the selected hint on <Return>."
                 }
             });
 
@@ -1386,4 +1389,4 @@ var Hints = Module("hints", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index c69237f1fc16403d0e6a7028f838b32dccfface8..f19b1e2458bb9c52f749651eb649c1519165872d 100644 (file)
@@ -61,12 +61,12 @@ var History = Module("history", {
     },
 
     get session() {
-        let webNav = window.getWebNavigation()
+        let webNav = window.getWebNavigation();
         let sh = webNav.sessionHistory;
 
         let obj = [];
         obj.__defineGetter__("index", function () sh.index);
-        obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val) });
+        obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val); });
         obj.__iterator__ = function () array.iterItems(this);
 
         for (let item in iter(sh.SHistoryEnumerator, Ci.nsIHistoryEntry))
@@ -352,7 +352,7 @@ var History = Module("history", {
         completion.addUrlCompleter("history", "History", completion.history);
     },
     mappings: function initMappings() {
-        function bind() mappings.add.apply(mappings, [config.browserModes].concat(Array.slice(arguments)));
+        function bind(...args) mappings.add.apply(mappings, [config.browserModes].concat(args));
 
         bind(["<C-o>"], "Go to an older position in the jump list",
              function ({ count }) { history.stepTo(-Math.max(count, 1), true); },
@@ -371,13 +371,13 @@ var History = Module("history", {
              { count: true });
 
         bind(["[d"], "Go back to the previous domain in the browser history",
-             function ({ count }) { history.search("domain", -Math.max(count, 1)) },
+             function ({ count }) { history.search("domain", -Math.max(count, 1)); },
              { count: true });
 
         bind(["]d"], "Go forward to the next domain in the browser history",
-             function ({ count }) { history.search("domain", Math.max(count, 1)) },
+             function ({ count }) { history.search("domain", Math.max(count, 1)); },
              { count: true });
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index aa1e016df8d8ae3db8ce6ae5b387fdcf22483b46..08cc401a8f4c2badabf0592dbd3977b6639fe89c 100644 (file)
@@ -250,18 +250,17 @@ var KeyProcessor = Class("KeyProcessor", {
     },
 
     execute: function execute(map, args)
-        let (self = this)
-            function execute() {
-                if (self.preExecute)
-                    self.preExecute.apply(self, args);
+        () => {
+            if (this.preExecute)
+                this.preExecute.apply(this, args);
 
-                args.self = self.main.params.mappingSelf || self.main.mappingSelf || map;
-                let res = map.execute.call(map, args);
+            args.self = this.main.params.mappingSelf || this.main.mappingSelf || map;
+            let res = map.execute.call(map, args);
 
-                if (self.postExecute)
-                    self.postExecute.apply(self, args);
-                return res;
-            },
+            if (this.postExecute)
+                this.postExecute.apply(this, args);
+            return res;
+        },
 
     onKeyPress: function onKeyPress(event) {
         if (event.skipmap)
@@ -322,3 +321,4 @@ var KeyArgProcessor = Class("KeyArgProcessor", KeyProcessor, {
     }
 });
 
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index c272eb5f8d9c50b26bccb33de0a33207af9f9f2c..68bba94c6e9bed082211128e30069ddb5cf53b8e 100644 (file)
@@ -123,8 +123,7 @@ var Map = Class("Map", {
                                   contexts.context,
                                   args);
 
-        let self = this;
-        function repeat() self.action(args)
+        let repeat = () => this.action(args);
         if (this.names[0] != ".") // FIXME: Kludge.
             mappings.repeat = repeat;
 
@@ -496,7 +495,7 @@ var Mappings = Module("mappings", {
                             ["td", {}, modeSign],
                             ["td", {}, name],
                             ["td", {}, map.rhs || map.action.toSource()]])),
-                    ["tr", { style: "height: .5ex;" }]])]
+                    ["tr", { style: "height: .5ex;" }]])];
 
         // E4X-FIXME
         // // TODO: Move this to an ItemList to show this automatically
@@ -572,7 +571,7 @@ var Mappings = Module("mappings", {
                 options: [
                     {
                         names: ["-arg", "-a"],
-                        description: "Accept an argument after the requisite key press",
+                        description: "Accept an argument after the requisite key press"
                     },
                     {
                         names: ["-builtin", "-b"],
@@ -828,8 +827,8 @@ var Mappings = Module("mappings", {
     mappings: function initMappings(dactyl, modules, window) {
         mappings.add([modes.COMMAND],
              ["\\"], "Emits <Leader> pseudo-key",
-             function () { events.feedkeys("<Leader>") });
+             function () { events.feedkeys("<Leader>"); });
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 4776c1cefed387cf541a8a56679bc882deaeefc4..8131e2963b51bfa31db0e4d477fdc51f349a532d 100644 (file)
@@ -233,7 +233,7 @@ var Marks = Module("marks", {
 
     _scrollTo: function _scrollTo(mark) {
         if (!mark.path)
-            var node = buffer.findScrollable(0, (mark.offset || mark.position).x)
+            var node = buffer.findScrollable(0, (mark.offset || mark.position).x);
         else
             for (node in DOM.XPath(mark.path, buffer.focusedFrame.document))
                 break;
@@ -303,7 +303,6 @@ var Marks = Module("marks", {
                           Math.round(mark.position.y * 100) + "%)",
                     (tab && "tab: " + tabs.index(tab))
             ].filter(util.identity).join(", ");
-
     },
 
     isLocalMark: bind("test", /^[a-z`']$/),
@@ -408,4 +407,4 @@ var Marks = Module("marks", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 2df79d9c3811ebf295186b72dfaaacf44a569d79..fc33fd7f24e95d88795de024fa9d690d8a166a6a 100644 (file)
@@ -606,7 +606,7 @@ var Modes = Module("modes", {
             },
 
             setter: function (vals) {
-                modes.all.forEach(function (m) { delete m.passUnknown });
+                modes.all.forEach(function (m) { delete m.passUnknown; });
 
                 vals = vals.map(function (v) update(new String(v.toLowerCase()), {
                     mode: v.replace(/^!/, "").toUpperCase(),
@@ -634,8 +634,8 @@ var Modes = Module("modes", {
     },
     prefs: function initPrefs() {
         prefs.watch("accessibility.browsewithcaret",
-                    function () { modes.onCaretChange.apply(modes, arguments) });
+                    function () { modes.onCaretChange.apply(modes, arguments); });
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 689d9a793120ee4c8c94fa92f169bae7d960ce11..6ef53f8fb54e278b3b3cbf652575102b63bedc45 100644 (file)
@@ -157,7 +157,7 @@ var MOW = Module("mow", {
                 dactyl.open(event.target.href, where);
             };
 
-            if (event.target instanceof HTMLAnchorElement)
+            if (event.target instanceof Ci.nsIDOMHTMLAnchorElement)
                 switch (DOM.Event.stringify(event)) {
                 case "<LeftMouse>":
                     openLink(dactyl.CURRENT_TAB);
@@ -192,7 +192,7 @@ var MOW = Module("mow", {
         popupshowing: function onPopupShowing(event) {
             let menu = commandline.widgets.contextMenu;
             let enabled = {
-                link: window.document.popupNode instanceof HTMLAnchorElement,
+                link: window.document.popupNode instanceof Ci.nsIDOMHTMLAnchorElement,
                 path: window.document.popupNode.hasAttribute("path"),
                 selection: !window.document.commandDispatcher.focusedWindow.getSelection().isCollapsed
             };
@@ -399,4 +399,4 @@ var MOW = Module("mow", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 9fc5acae5654028c63729c4292fb4d50cb0e52d1..f2c10399e4782a6bd2c9ce7117701ec885fe48b0 100644 (file)
@@ -204,4 +204,4 @@ var QuickMarks = Module("quickmarks", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 0de02088a37cb79f91c3f8b811796feff49f07f2..4cf50c47813e4a8b119dcfa837eabe5cc4c82941 100644 (file)
@@ -269,7 +269,7 @@ var StatusLine = Module("statusline", {
         });
     },
 
-    updateUrl: deprecated("statusline.status", function updateUrl(url) { this.status = url || buffer.uri }),
+    updateUrl: deprecated("statusline.status", function updateUrl(url) { this.status = url || buffer.uri; }),
 
     /**
      * Set the contents of the status line's input buffer to the given
@@ -393,4 +393,4 @@ var StatusLine = Module("statusline", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index fb155db8d36539cf5a309521d74ba06cfdb49c6e..016355fa9630d8fa0980498c6f36bccd337b0f84 100644 (file)
@@ -237,7 +237,7 @@ var Tabs = Module("tabs", {
             return this._groups;
 
         if (func)
-            func = bind(function (func) { func(this._groups) }, this, func);
+            func = bind(function (func) { func(this._groups); }, this, func);
 
         if (window.TabView && window.TabView._initFrame)
             window.TabView._initFrame(func);
@@ -335,7 +335,6 @@ var Tabs = Module("tabs", {
         completion.listCompleter("buffer", filter);
     },
 
-
     /**
      * Return an iterator of tabs matching the given filter. If no
      * *filter* or *count* is provided, returns the currently selected
@@ -1312,4 +1311,4 @@ var Tabs = Module("tabs", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 6cb779be3be6019be4e173dbd439c2da1d3175c5..d5e3fa14b2ff7ad5b0f662b4fdb941d21a8a9137 100644 (file)
         </p>
 
         <p>
-            If the <em>-group</em>=<a>group</a> flag is given, add this autocmd
-            to the named <t>group</t>. Any filters for <a>group</a> apply in
-            addition to <oa>filter</oa>. When listing commands this limits the
-            output to the specified group.
+            If the <em>-group</em>=<a>group</a> flag is given, add this
+            autocommand to the named <t>group</t>. Any filters for <a>group</a>
+            apply in addition to <oa>filter</oa>. When listing commands this
+            limits the output to the specified group.
         </p>
 
         <p>Available <oa>events</oa>:</p>
index 26c77c2ecfc11ca69fbfc8fa2fb2e0bb7f7c62b9..af586ab20638fe2757834f1b8282b02919ca1367 100644 (file)
     </description>
 </item>
 
-<item>
-    <tags>'noprivate' 'private'</tags>
-    <spec>'private'</spec>
-    <type>&option.private.type;</type>
-    <default>&option.private.default;</default>
-    <description>
-        <p>
-            Set the <str>private browsing</str> option. In private browsing mode
-            history, cache files, cookies, form data, passwords, download list
-            entries, local and URL <t>marks</t>, <t>command-line</t> history
-            and macros are available only for the duration of the private
-            browsing session and deleted when returning to normal browsing
-            mode. See also <t>privacy</t>.
-        </p>
-    </description>
-</item>
-
 <item>
     <tags>$&dactyl.idName;_RUNTIME</tags>
     <tags>'rtp' 'runtimepath'</tags>
index ee7e6b8c92548d2bfafb65012f37078562cffba9..0bd9549c06ad1fbe712d6ba853fccc0187aa325c 100644 (file)
@@ -28,8 +28,7 @@
     When in private browsing mode, no data other than Bookmarks and QuickMarks
     are written to disk. Further, upon exiting private mode, all newly
     accumulated data, including <t>command-line</t> history, local and URL
-    marks, and macros, are purged from memory. For more information, see
-    <o>private</o>.
+    marks, and macros, are purged from memory.
 </p>
 
 <h2 tag="sanitizing clearing-data">Clearing private data</h2>
index 2e52a9aaee7f888675b430c852032b193e5f2df5..e2c577ad9f704a611207314cf97ffd40881e112b 100644 (file)
@@ -15,8 +15,7 @@ defineModule("addons", {
 this.lazyRequire("completion", ["completion"]);
 lazyRequire("template", ["template"]);
 
-var callResult = function callResult(method) {
-    let args = Array.slice(arguments, 1);
+var callResult = function callResult(method, ...args) {
     return function (result) { result[method].apply(result, args); };
 }
 
@@ -25,7 +24,7 @@ var listener = function listener(action, event)
         this.dactyl[install.error ? "echoerr" : "echomsg"](
             _("addon.error", action, event, (install.name || install.sourceURI.spec) +
                 (install.error ? ": " + addons.errors[install.error] : "")));
-    }
+    };
 
 var AddonListener = Class("AddonListener", {
     init: function init(modules) {
@@ -120,7 +119,7 @@ var actions = {
         },
         get filter() {
             return function (addon) !addon.userDisabled &&
-                !(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE))
+                !(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE));
         },
         perm: "disable"
     },
@@ -206,14 +205,13 @@ var Addon = Class("Addon", {
                     ["span", { highlight: pending[0] }, pending[1]],
                     " on ",
                     ["a", { href: "#", "dactyl:command": "dactyl.restart" }, "restart"],
-                    ")"]
+                    ")"];
         return info;
     },
 
     update: function callee() {
-        let self = this;
-        function update(key, xml) {
-            let node = self.nodes[key];
+        let update = (key, xml) => {
+            let node = this.nodes[key];
             while (node.firstChild)
                 node.removeChild(node.firstChild);
 
@@ -390,9 +388,9 @@ var Addons = Module("addons", {
                 }
 
                 if (!file.exists())
-                    AddonManager.getInstallForURL(url,   install, "application/x-xpinstall");
+                    AddonManager.getInstallForURL(url,        install, "application/x-xpinstall");
                 else if (file.isReadable() && file.isFile())
-                    AddonManager.getInstallForFile(file, install, "application/x-xpinstall");
+                    AddonManager.getInstallForFile(file.file, install, "application/x-xpinstall");
                 else if (file.isDirectory())
                     dactyl.echoerr(_("addon.cantInstallDir", file.path.quote()));
                 else
@@ -498,4 +496,4 @@ endModule();
 
 } catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 589c8042478c4c948821c6761d9202e592da283d..a9318eb414119a78cb118446827cf1f377a93379 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k@gmail.com>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -68,8 +68,8 @@ Object.defineProperty(defineModule.loadLog, "push", {
     }
 });
 defineModule.prefix = "";
-defineModule.dump = function dump_() {
-    let msg = Array.map(arguments, function (msg) {
+defineModule.dump = function dump_(...args) {
+    let msg = args.map(function (msg) {
         if (loaded.util && typeof msg == "object")
             msg = util.objectToString(msg);
         return msg;
@@ -78,13 +78,13 @@ defineModule.dump = function dump_() {
                .replace(/^./gm, JSMLoader.name + ": $&"));
 }
 defineModule.modules = [];
-defineModule.time = function time(major, minor, func, self) {
+defineModule.time = function time(major, minor, func, self, ...args) {
     let time = Date.now();
     if (typeof func !== "function")
         func = self[func];
 
     try {
-        var res = func.apply(self, Array.slice(arguments, 4));
+        var res = func.apply(self, args);
     }
     catch (e) {
         loaded.util && util.reportError(e);
@@ -241,7 +241,7 @@ function properties(obj, prototypes, debugger_) {
                 return array.uniq([k for (k in obj)].concat(
                     Object.getOwnPropertyNames(
                               XPCNativeWrapper.unwrap(obj))
-                          .filter(filter)))
+                          .filter(filter)));
             }
             else if (!e.stack) {
                 throw Error(e);
@@ -441,18 +441,18 @@ function curry(fn, length, self, acc) {
         return fn;
 
     // Close over function with 'this'
-    function close(self, fn) function () fn.apply(self, Array.slice(arguments));
+    function close(self, fn) function () fn.apply(self, arguments);
 
     if (acc == null)
         acc = [];
 
-    return function curried() {
-        let args = acc.concat(Array.slice(arguments));
-
+    return function curried(...args) {
         // The curried result should preserve 'this'
-        if (arguments.length == 0)
+        if (args.length == 0)
             return close(self || this, curried);
 
+        let args = acc.concat(args);
+
         if (args.length >= length)
             return fn.apply(self || this, args);
 
@@ -461,15 +461,14 @@ function curry(fn, length, self, acc) {
 }
 
 if (curry.bind)
-    var bind = function bind(meth, self) let (func = callable(meth) ? meth : self[meth])
-        func.bind.apply(func, Array.slice(arguments, 1));
+    var bind = function bind(meth, self, ...args) let (func = callable(meth) ? meth : self[meth])
+        func.bind.apply(func, [self].concat(args));
 else
-    var bind = function bind(func, self) {
+    var bind = function bind(func, self, ...args) {
         if (!callable(func))
             func = self[func];
 
-        let args = Array.slice(arguments, bind.length);
-        return function bound() func.apply(self, args.concat(Array.slice(arguments)));
+        return function bound(...args2) func.apply(self, args.concat(args2));
     };
 
 /**
@@ -574,8 +573,8 @@ function isString(val) objproto.toString.call(val) == "[object String]";
  */
 function callable(val) typeof val === "function" && !(val instanceof Ci.nsIDOMElement);
 
-function call(fn) {
-    fn.apply(arguments[1], Array.slice(arguments, 2));
+function call(fn, self, ...args) {
+    fn.apply(self, args);
     return fn;
 }
 
@@ -660,8 +659,8 @@ function update(target) {
                         func.superapply = function superapply(self, args)
                             let (meth = Object.getPrototypeOf(target)[k])
                                 meth && meth.apply(self, args);
-                        func.supercall = function supercall(self)
-                            func.superapply(self, Array.slice(arguments, 1));
+                        func.supercall = function supercall(self, ...args)
+                            func.superapply(self, args);
                     }
                 }
                 Object.defineProperty(target, k, desc);
@@ -687,8 +686,8 @@ function update_(target) {
                         func.superapply = function super_apply(self, args)
                             let (meth = Object.getPrototypeOf(target)[k])
                                 meth && meth.apply(self, args);
-                        func.supercall = function super_call(self)
-                            func.superapply(self, Array.slice(arguments, 1));
+                        func.supercall = function super_call(self, ...args)
+                            func.superapply(self, args);
                     }
                 }
                 Object.defineProperty(target, k, desc);
@@ -722,9 +721,8 @@ function update_(target) {
  *
  * @returns {function} The constructor for the resulting class.
  */
-function Class() {
+function Class(...args) {
 
-    var args = Array.slice(arguments);
     if (isString(args[0]))
         var name = args.shift();
     var superclass = Class;
@@ -953,14 +951,13 @@ Class.prototype = {
      * @returns {nsITimer} The timer which backs this timeout.
      */
     timeout: function timeout(callback, timeout) {
-        const self = this;
-        function timeout_notify(timer) {
-            if (self.stale ||
+        let timeout_notify = (timer) => {
+            if (this.stale ||
                     util.rehashing && !isinstance(Cu.getGlobalForObject(callback), ["BackstagePass"]))
                 return;
-            self.timeouts.splice(self.timeouts.indexOf(timer), 1);
-            util.trapErrors(callback, self);
-        }
+            this.timeouts.splice(this.timeouts.indexOf(timer), 1);
+            util.trapErrors(callback, this);
+        };
         let timer = services.Timer(timeout_notify, timeout || 0, services.Timer.TYPE_ONE_SHOT);
         this.timeouts.push(timer);
         return timer;
@@ -973,12 +970,11 @@ Class.prototype = {
      * localized properties.
      */
     update: function update() {
-        let self = this;
         // XXX: Duplication.
 
         for (let i = 0; i < arguments.length; i++) {
             let src = arguments[i];
-            Object.getOwnPropertyNames(src || {}).forEach(function (k) {
+            Object.getOwnPropertyNames(src || {}).forEach((k) => {
                 let desc = Object.getOwnPropertyDescriptor(src, k);
                 if (desc.value instanceof Class.Property)
                     desc = desc.value.init(k, this) || desc.value;
@@ -986,12 +982,16 @@ Class.prototype = {
                 if (typeof desc.value === "function") {
                     let func = desc.value.wrapped || desc.value;
                     if (!func.superapply) {
-                        func.__defineGetter__("super", function () Object.getPrototypeOf(self)[k]);
-                        func.superapply = function superapply(self, args)
-                            let (meth = Object.getPrototypeOf(self)[k])
-                                meth && meth.apply(self, args);
-                        func.supercall = function supercall(self)
-                            func.superapply(self, Array.slice(arguments, 1));
+                        func.__defineGetter__("super", () => Object.getPrototypeOf(this)[k]);
+
+                        func.superapply = function superapply(self, args) {
+                            let meth = Object.getPrototypeOf(self)[k];
+                            return meth && meth.apply(self, args);
+                        };
+
+                        func.supercall = function supercall(self, ...args) {
+                            return func.superapply(self, args);
+                        }
                     }
                 }
 
@@ -1080,7 +1080,7 @@ function XPCOMShim(interfaces) {
         getInterfaces: function (count) { count.value = 0; }
     });
     return (interfaces || []).reduce(function (shim, iface) shim.QueryInterface(Ci[iface]),
-                                     ip.data)
+                                     ip.data);
 };
 let stub = Class.Property({
     configurable: true,
@@ -1097,7 +1097,7 @@ var ErrorBase = Class("ErrorBase", Error, {
     init: function EB_init(message, level) {
         level = level || 0;
         let error = Error(message);
-        update(this, error)
+        update(this, error);
         this.stack = error.stack;
         this.message = message;
 
@@ -1127,22 +1127,22 @@ var Finished = Class("Finished", ErrorBase);
  * @param {Object} classProperties Properties to be applied to the class constructor.
  * @returns {Class}
  */
-function Module(name, prototype) {
+function Module(name, prototype, ...args) {
     try {
-        let init = callable(prototype) ? 4 : 3;
-        let proto = arguments[callable(prototype) ? 2 : 1];
+        let init = callable(prototype) ? 2 : 1;
+        let proto = callable(prototype) ? args[0] : prototype;
 
         proto._metaInit_ = function () {
             delete module.prototype._metaInit_;
             currentModule[name.toLowerCase()] = this;
         };
 
-        const module = Class.apply(Class, Array.slice(arguments, 0, init));
+        const module = Class.apply(Class, [name, prototype, ...args.slice(0, init)]);
         let instance = module();
         module.className = name.toLowerCase();
 
         instance.INIT = update(Object.create(Module.INIT),
-                               arguments[init] || {});
+                               args[init] || {});
 
         currentModule[module.className] = instance;
         defineModule.modules.push(instance);
@@ -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(function (fn, i) update(objs[i], fn.apply(module, args)));
 
             memoize(module, "closure", Class.makeClosure);
             module.instance = module;
@@ -1199,13 +1199,9 @@ Module.INIT = {
  *
  * @returns {function} The constructor for the new Struct.
  */
-function Struct() {
-    if (!/^[A-Z]/.test(arguments[0]))
-        var args = Array.slice(arguments, 0);
-    else {
-        var className = arguments[0];
-        args = Array.slice(arguments, 1);
-    }
+function Struct(...args) {
+    if (/^[A-Z]/.test(args[0]))
+        var className = args.shift();
 
     const Struct = Class(className || "Struct", StructBase, {
         length: args.length,
@@ -1599,9 +1595,9 @@ var array = Class("array", Array, {
             },
             array: ary,
             toString: function () this.array.toString(),
-            concat: function () this.__noSuchMethod__("concat", Array.slice(arguments)),
-            filter: function () this.__noSuchMethod__("filter", Array.slice(arguments)),
-            map: function () this.__noSuchMethod__("map", Array.slice(arguments))
+            concat: function (...args) this.__noSuchMethod__("concat", args),
+            filter: function (...args) this.__noSuchMethod__("filter", args),
+            map: function (...args) this.__noSuchMethod__("map", args)
         };
     }
 }, {
@@ -1734,8 +1730,8 @@ var array = Class("array", Array, {
 /* Make Minefield not explode, because Minefield exploding is not fun. */
 let iterProto = Iter.prototype;
 Object.keys(iter).forEach(function (k) {
-    iterProto[k] = function () {
-        let res = iter[k].apply(iter, [this].concat(Array.slice(arguments)));
+    iterProto[k] = function (...args) {
+        let res = iter[k].apply(iter, [this].concat(args));
         if (isinstance(res, ["Iterator", "Generator"]))
             return Iter(res);
         return res;
@@ -1744,8 +1740,8 @@ Object.keys(iter).forEach(function (k) {
 
 Object.keys(array).forEach(function (k) {
     if (!(k in iterProto))
-        iterProto[k] = function () {
-            let res = array[k].apply(array, [this.toArray()].concat(Array.slice(arguments)));
+        iterProto[k] = function (...args) {
+            let res = array[k].apply(array, [this.toArray()].concat(args));
             if (isinstance(res, ["Iterator", "Generator"]))
                 return Iter(res);
             if (isArray(res))
@@ -1769,4 +1765,4 @@ endModule();
 
 // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index cedf7bd90d51bda721676114205385e4a61f0292..be55f9816cbc28955f3c802e8a2ae9146c6f0943 100644 (file)
@@ -262,4 +262,4 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
 
 endModule();
 
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 6c9426d242c7f0c92ebb0cd11bc205a09ec2c285..4206133a8249b922b5cff8befbe73190ac3f0813 100644 (file)
@@ -19,3 +19,4 @@ this["import"] = function import_(obj) {
 Components.utils.import("resource://gre/modules/Services.jsm");
 function loadSubScript() Services.scriptloader.loadSubScript.apply(null, arguments);
 
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 964c3c8166c4c6778202a58885c246498cb655d6..15aea79b1257040fefb5bdc2b55f2e5e60b02b72 100644 (file)
@@ -33,7 +33,7 @@ var Buffer = Module("Buffer", {
 
             let win = services.focus.focusedWindow;
             if (!win || win == window || util.topWindow(win) != window)
-                return window.content
+                return window.content;
             if (win.top == window)
                 return win;
             return win.top;
@@ -83,7 +83,7 @@ var Buffer = Module("Buffer", {
             services.contentPrefs.getPref(this.uri, pref,
                                           sanitizer.getContext(this.win), callback);
         else
-            services.contentPrefs.getPref(uri, pref, callback);
+            services.contentPrefs.getPref(this.uri, pref, callback);
     },
 
     /**
@@ -219,7 +219,7 @@ var Buffer = Module("Buffer", {
      */
     get zoomLevel() {
         let v = this.contentViewer;
-        return v[v.textZoom == 1 ? "fullZoom" : "textZoom"] * 100
+        return v[v.textZoom == 1 ? "fullZoom" : "textZoom"] * 100;
     },
     set zoomLevel(value) { this.setZoom(value, this.fullZoom); },
 
@@ -755,8 +755,8 @@ var Buffer = Module("Buffer", {
      * vertical percentages. See {@link Buffer.scrollToPercent} for
      * parameters.
      */
-    scrollToPercent: function scrollToPercent(horizontal, vertical)
-        Buffer.scrollToPercent(this.findScrollable(0, vertical == null), horizontal, vertical),
+    scrollToPercent: function scrollToPercent(horizontal, vertical, dir)
+        Buffer.scrollToPercent(this.findScrollable(dir || 0, vertical == null), horizontal, vertical),
 
     /**
      * Scrolls the currently active element to the given horizontal and
@@ -907,7 +907,7 @@ var Buffer = Module("Buffer", {
         let distance = reverse ? function (rect) -rect.top : function (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])
+                        .sort(function (a, b) a[1] - b[1]);
 
         if (offScreen && !reverse)
             elems = elems.filter(function (e) e[1] > this, this.topWindow.innerHeight);
@@ -995,8 +995,6 @@ var Buffer = Module("Buffer", {
     showPageInfo: function showPageInfo(verbose, sections) {
         let { commandline, dactyl, options } = this.modules;
 
-        let self = this;
-
         // Ctrl-g single line output
         if (!verbose) {
             let file = this.win.location.pathname.split("/").pop() || _("buffer.noName");
@@ -1004,7 +1002,7 @@ var Buffer = Module("Buffer", {
 
             let info = template.map(
                 (sections || options["pageinfo"])
-                    .map(function (opt) Buffer.pageInfo[opt].action.call(self)),
+                    .map((opt) => Buffer.pageInfo[opt].action.call(this)),
                 function (res) res && iter(res).join(", ") || undefined,
                 ", ").join("");
 
@@ -1016,9 +1014,9 @@ var Buffer = Module("Buffer", {
             return;
         }
 
-        let list = template.map(sections || options["pageinfo"], function (option) {
+        let list = template.map(sections || options["pageinfo"], (option) => {
             let { action, title } = Buffer.pageInfo[option];
-            return template.table(title, action.call(self, true));
+            return template.table(title, action.call(this, true));
         }, ["br"]);
 
         commandline.commandOutput(list);
@@ -1144,7 +1142,10 @@ var Buffer = Module("Buffer", {
 
             let ext = uri.fileExtension || "txt";
             if (doc.contentType)
-                ext = services.mime.getPrimaryExtension(doc.contentType, ext);
+                try {
+                    ext = services.mime.getPrimaryExtension(doc.contentType, ext);
+                }
+                catch (e) {}
 
             if (!isString(doc))
                 return io.withTempFiles(function (temp) {
@@ -1251,14 +1252,13 @@ var Buffer = Module("Buffer", {
      * Updates the zoom level of this buffer from a content preference.
      */
     updateZoom: util.wrapCallback(function updateZoom() {
-        let self = this;
         let uri = this.uri;
 
         if (prefs.get("browser.zoom.siteSpecific")) {
-            this.getPref("dactyl.content.full-zoom", function (val) {
-                if (val != null && uri.equals(self.uri) && val != prefs.get("browser.zoom.full"))
-                    [self.contentViewer.textZoom, self.contentViewer.fullZoom] =
-                        [self.contentViewer.fullZoom, self.contentViewer.textZoom];
+            this.getPref("dactyl.content.full-zoom", (val) => {
+                if (val != null && uri.equals(this.uri) && val != prefs.get("browser.zoom.full"))
+                    [this.contentViewer.textZoom, this.contentViewer.fullZoom] =
+                        [this.contentViewer.fullZoom, this.contentViewer.textZoom];
             });
         }
     }),
@@ -1365,10 +1365,10 @@ var Buffer = Module("Buffer", {
                 get scrollRightMax() this.win.scrollMaxY,
 
                 get scrollLeft() this.win.scrollX,
-                set scrollLeft(val) { this.win.scrollTo(val, this.win.scrollY) },
+                set scrollLeft(val) { this.win.scrollTo(val, this.win.scrollY); },
 
                 get scrollTop() this.win.scrollY,
-                set scrollTop(val) { this.win.scrollTo(this.win.scrollX, val) }
+                set scrollTop(val) { this.win.scrollTo(this.win.scrollX, val); }
             };
         return elem;
     },
@@ -1471,8 +1471,13 @@ var Buffer = Module("Buffer", {
             return elem[pos] > 0;
 
         let max = pos + "Max";
-        if (max in elem && pos > 0)
-            return elem[pos] < elem[max];
+        if (max in elem) {
+            if (elem[pos] < elem[max])
+                return true;
+            if (dir > 0)
+                return false;
+            return elem[pos] > 0;
+        }
 
         let style = DOM(elem).style;
         let borderSize = Math.round(parseFloat(style[border1]) + parseFloat(style[border2]));
@@ -1672,7 +1677,7 @@ var Buffer = Module("Buffer", {
         return {
             x: elem.scrollLeft && elem.scrollLeft / this._exWidth(node),
             y: elem.scrollTop / parseFloat(style.lineHeight)
-        }
+        };
     },
 
     _exWidth: function _exWidth(elem) {
@@ -1739,7 +1744,7 @@ var Buffer = Module("Buffer", {
                 const BRANCH   = "printer_" + PRINTER + ".";
                 const BRANCHES = ["print.", BRANCH, "print." + BRANCH];
                 function set(pref, value) {
-                    BRANCHES.forEach(function (branch) { prefs.set(branch + pref, value) });
+                    BRANCHES.forEach(function (branch) { prefs.set(branch + pref, value); });
                 }
 
                 prefs.withContext(function () {
@@ -2007,17 +2012,17 @@ var Buffer = Module("Buffer", {
 
         mappings.add([modes.NORMAL],
             ["<C-a>", "<increment-url-path>"], "Increment last number in URL",
-            function (args) { buffer.incrementURL(Math.max(args.count, 1)); },
+            function ({ count }) { buffer.incrementURL(Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL],
             ["<C-x>", "<decrement-url-path>"], "Decrement last number in URL",
-            function (args) { buffer.incrementURL(-Math.max(args.count, 1)); },
+            function ({ count }) { buffer.incrementURL(-Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["gu", "<open-parent-path>"],
             "Go to parent directory",
-            function (args) { buffer.climbUrlPath(Math.max(args.count, 1)); },
+            function ({ count }) { buffer.climbUrlPath(Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["gU", "<open-root-path>"],
@@ -2026,9 +2031,9 @@ var Buffer = Module("Buffer", {
 
         mappings.add([modes.COMMAND], [".", "<repeat-key>"],
             "Repeat the last key event",
-            function (args) {
+            function ({ count }) {
                 if (mappings.repeat) {
-                    for (let i in util.interruptibleRange(0, Math.max(args.count, 1), 100))
+                    for (let i in util.interruptibleRange(0, Math.max(count, 1), 100))
                         mappings.repeat();
                 }
             },
@@ -2045,22 +2050,22 @@ var Buffer = Module("Buffer", {
         // scrolling
         mappings.add([modes.NORMAL], ["j", "<Down>", "<C-e>", "<scroll-down-line>"],
             "Scroll document down",
-            function (args) { buffer.scrollVertical("lines", Math.max(args.count, 1)); },
+            function ({ count }) { buffer.scrollVertical("lines", Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["k", "<Up>", "<C-y>", "<scroll-up-line>"],
             "Scroll document up",
-            function (args) { buffer.scrollVertical("lines", -Math.max(args.count, 1)); },
+            function ({ count }) { buffer.scrollVertical("lines", -Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], dactyl.has("mail") ? ["h", "<scroll-left-column>"] : ["h", "<Left>", "<scroll-left-column>"],
             "Scroll document to the left",
-            function (args) { buffer.scrollHorizontal("columns", -Math.max(args.count, 1)); },
+            function ({ count }) { buffer.scrollHorizontal("columns", -Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], dactyl.has("mail") ? ["l", "<scroll-right-column>"] : ["l", "<Right>", "<scroll-right-column>"],
             "Scroll document to the right",
-            function (args) { buffer.scrollHorizontal("columns", Math.max(args.count, 1)); },
+            function ({ count }) { buffer.scrollHorizontal("columns", Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["0", "^", "<scroll-begin>"],
@@ -2073,112 +2078,113 @@ var Buffer = Module("Buffer", {
 
         mappings.add([modes.NORMAL], ["gg", "<Home>", "<scroll-top>"],
             "Go to the top of the document",
-            function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 0); },
+            function ({ count }) { buffer.scrollToPercent(null, count != null ? count : 0,
+                                                     count != null ? 0 : -1); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["G", "<End>", "<scroll-bottom>"],
             "Go to the end of the document",
-            function (args) {
-                if (args.count)
+            function ({ count }) {
+                if (count)
                     var elem = options.get("linenumbers")
                                       .getLine(buffer.focusedFrame.document,
-                                               args.count);
+                                               count);
                 if (elem)
                     elem.scrollIntoView(true);
-                else if (args.count)
-                    buffer.scrollToPosition(null, args.count);
+                else if (count)
+                    buffer.scrollToPosition(null, count);
                 else
-                    buffer.scrollToPercent(null, 100);
+                    buffer.scrollToPercent(null, 100, 1);
             },
             { count: true });
 
         mappings.add([modes.NORMAL], ["%", "<scroll-percent>"],
             "Scroll to {count} percent of the document",
-            function (args) {
-                dactyl.assert(args.count > 0 && args.count <= 100);
-                buffer.scrollToPercent(null, args.count);
+            function ({ count }) {
+                dactyl.assert(count > 0 && count <= 100);
+                buffer.scrollToPercent(null, count);
             },
             { count: true });
 
         mappings.add([modes.NORMAL], ["<C-d>", "<scroll-down>"],
             "Scroll window downwards in the buffer",
-            function (args) { buffer._scrollByScrollSize(args.count, true); },
+            function ({ count }) { buffer._scrollByScrollSize(count, true); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["<C-u>", "<scroll-up>"],
             "Scroll window upwards in the buffer",
-            function (args) { buffer._scrollByScrollSize(args.count, false); },
+            function ({ count }) { buffer._scrollByScrollSize(count, false); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["<C-b>", "<PageUp>", "<S-Space>", "<scroll-up-page>"],
             "Scroll up a full page",
-            function (args) { buffer.scrollVertical("pages", -Math.max(args.count, 1)); },
+            function ({ count }) { buffer.scrollVertical("pages", -Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["<Space>"],
             "Scroll down a full page",
-            function (args) {
+            function ({ count }) {
                 if (isinstance((services.focus.focusedWindow || buffer.win).document.activeElement,
                                [Ci.nsIDOMHTMLInputElement,
                                 Ci.nsIDOMHTMLButtonElement,
                                 Ci.nsIDOMXULButtonElement]))
                     return Events.PASS;
 
-                buffer.scrollVertical("pages", Math.max(args.count, 1));
+                buffer.scrollVertical("pages", Math.max(count, 1));
             },
             { count: true });
 
         mappings.add([modes.NORMAL], ["<C-f>", "<PageDown>", "<scroll-down-page>"],
             "Scroll down a full page",
-            function (args) { buffer.scrollVertical("pages", Math.max(args.count, 1)); },
+            function ({ count }) { buffer.scrollVertical("pages", Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["]f", "<previous-frame>"],
             "Focus next frame",
-            function (args) { buffer.shiftFrameFocus(Math.max(args.count, 1)); },
+            function ({ count }) { buffer.shiftFrameFocus(Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["[f", "<next-frame>"],
             "Focus previous frame",
-            function (args) { buffer.shiftFrameFocus(-Math.max(args.count, 1)); },
+            function ({ count }) { buffer.shiftFrameFocus(-Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["["],
             "Jump to the previous element as defined by 'jumptags'",
-            function (args) { buffer.findJump(args.arg, args.count, true); },
+            function ({ arg, count }) { buffer.findJump(arg, count, true); },
             { arg: true, count: true });
 
         mappings.add([modes.NORMAL], ["g]"],
             "Jump to the next off-screen element as defined by 'jumptags'",
-            function (args) { buffer.findJump(args.arg, args.count, false, true); },
+            function ({ arg, count }) { buffer.findJump(arg, count, false, true); },
             { arg: true, count: true });
 
         mappings.add([modes.NORMAL], ["]"],
             "Jump to the next element as defined by 'jumptags'",
-            function (args) { buffer.findJump(args.arg, args.count, false); },
+            function ({ arg, count }) { buffer.findJump(arg, count, false); },
             { arg: true, count: true });
 
         mappings.add([modes.NORMAL], ["{"],
             "Jump to the previous paragraph",
-            function (args) { buffer.findJump("p", args.count, true); },
+            function ({ count }) { buffer.findJump("p", count, true); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["}"],
             "Jump to the next paragraph",
-            function (args) { buffer.findJump("p", args.count, false); },
+            function ({ count }) { buffer.findJump("p", count, false); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["]]", "<next-page>"],
             "Follow the link labeled 'next' or '>' if it exists",
-            function (args) {
-                buffer.findLink("next", options["nextpattern"], (args.count || 1) - 1, true);
+            function ({ count }) {
+                buffer.findLink("next", options["nextpattern"], (count || 1) - 1, true);
             },
             { count: true });
 
         mappings.add([modes.NORMAL], ["[[", "<previous-page>"],
             "Follow the link labeled 'prev', 'previous' or '<' if it exists",
-            function (args) {
-                buffer.findLink("prev", options["previouspattern"], (args.count || 1) - 1, true);
+            function ({ count }) {
+                buffer.findLink("prev", options["previouspattern"], (count || 1) - 1, true);
             },
             { count: true });
 
@@ -2192,10 +2198,10 @@ var Buffer = Module("Buffer", {
 
         mappings.add([modes.NORMAL], ["gi", "<focus-input>"],
             "Focus last used input field",
-            function (args) {
+            function ({ count }) {
                 let elem = buffer.lastInputField;
 
-                if (args.count >= 1 || !elem || !events.isContentNode(elem)) {
+                if (count >= 1 || !elem || !events.isContentNode(elem)) {
                     let xpath = ["frame", "iframe", "input", "xul:textbox", "textarea[not(@disabled) and not(@readonly)]"];
 
                     let frames = buffer.allFrames(null, true);
@@ -2219,7 +2225,7 @@ var Buffer = Module("Buffer", {
                     });
 
                     dactyl.assert(elements.length > 0);
-                    elem = elements[Math.constrain(args.count, 1, elements.length) - 1];
+                    elem = elements[Math.constrain(count, 1, elements.length) - 1];
                 }
                 buffer.focusElement(elem);
                 DOM(elem).scrollIntoView();
@@ -2275,52 +2281,52 @@ var Buffer = Module("Buffer", {
         // zooming
         mappings.add([modes.NORMAL], ["zi", "+", "<text-zoom-in>"],
             "Enlarge text zoom of current web page",
-            function (args) { buffer.zoomIn(Math.max(args.count, 1), false); },
+            function ({ count }) { buffer.zoomIn(Math.max(count, 1), false); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["zm", "<text-zoom-more>"],
             "Enlarge text zoom of current web page by a larger amount",
-            function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, false); },
+            function ({ count }) { buffer.zoomIn(Math.max(count, 1) * 3, false); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["zo", "-", "<text-zoom-out>"],
             "Reduce text zoom of current web page",
-            function (args) { buffer.zoomOut(Math.max(args.count, 1), false); },
+            function ({ count }) { buffer.zoomOut(Math.max(count, 1), false); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["zr", "<text-zoom-reduce>"],
             "Reduce text zoom of current web page by a larger amount",
-            function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, false); },
+            function ({ count }) { buffer.zoomOut(Math.max(count, 1) * 3, false); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["zz", "<text-zoom>"],
             "Set text zoom value of current web page",
-            function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, false); },
+            function ({ count }) { buffer.setZoom(count > 1 ? count : 100, false); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["ZI", "zI", "<full-zoom-in>"],
             "Enlarge full zoom of current web page",
-            function (args) { buffer.zoomIn(Math.max(args.count, 1), true); },
+            function ({ count }) { buffer.zoomIn(Math.max(count, 1), true); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["ZM", "zM", "<full-zoom-more>"],
             "Enlarge full zoom of current web page by a larger amount",
-            function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, true); },
+            function ({ count }) { buffer.zoomIn(Math.max(count, 1) * 3, true); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["ZO", "zO", "<full-zoom-out>"],
             "Reduce full zoom of current web page",
-            function (args) { buffer.zoomOut(Math.max(args.count, 1), true); },
+            function ({ count }) { buffer.zoomOut(Math.max(count, 1), true); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["ZR", "zR", "<full-zoom-reduce>"],
             "Reduce full zoom of current web page by a larger amount",
-            function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, true); },
+            function ({ count }) { buffer.zoomOut(Math.max(count, 1) * 3, true); },
             { count: true });
 
         mappings.add([modes.NORMAL], ["zZ", "<full-zoom>"],
             "Set full zoom value of current web page",
-            function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, true); },
+            function ({ count }) { buffer.setZoom(count > 1 ? count : 100, true); },
             { count: true });
 
         // page info
@@ -2656,7 +2662,7 @@ Buffer.addPageInfoSection("m", "Meta Tags", function (verbose) {
 });
 
 Buffer.addPageInfoSection("s", "Security", function (verbose) {
-    let { statusline } = this.modules
+    let { statusline } = this.modules;
 
     let identity = this.topWindow.gIdentityHandler;
 
@@ -2697,4 +2703,4 @@ Buffer.addPageInfoSection("s", "Security", function (verbose) {
 
 endModule();
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 5f39bc6a3264ca2d43f93cf6785598ceed00e152..e25bd4263ecc839f87e6e062430b8e77987db5e0 100644 (file)
@@ -28,7 +28,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
             "cache": function (uri, path) {
                 let contentType = "text/plain";
                 try {
-                    contentType = services.mime.getTypeFromURI(uri)
+                    contentType = services.mime.getTypeFromURI(uri);
                 }
                 catch (e) {}
 
@@ -268,4 +268,4 @@ endModule();
 
 // catch(e){ if (typeof e === "string") e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 199cfff13eca5e0b999b0a74c6d1a77504d36661..617c6bd168c8371310fcefd5f0ae5865365aed94 100644 (file)
@@ -1,6 +1,6 @@
 // Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
 // Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -352,7 +352,7 @@ var Command = Class("Command", {
                     { configurable: true, enumerable: true, get: function () opt.default };
 
                 if (prop.get && !prop.set)
-                    prop.set = function (val) { Class.replaceProperty(this, opt.names[0], val) };
+                    prop.set = function (val) { Class.replaceProperty(this, opt.names[0], val); };
                 Object.defineProperty(res, opt.names[0], prop);
             }
         });
@@ -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(function (a, b) a.name > b.name));
     },
 
     /** @property {string} The last executed Ex command line. */
@@ -583,8 +583,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
                 this.remove(name);
         }
 
-        let self = this;
-        let closure = function () self._map[name];
+        let closure = () => this._map[name];
 
         memoize(this._map, name, function () commands.Command(specs, description, action, extra));
         if (!extra.hidden)
@@ -1171,7 +1170,7 @@ var Commands = Module("commands", {
                     if (sub.substr(0, 2) === "<<" && hereDoc)
                         let ([count, arg] = getNextArg(sub)) {
                             sub = arg + sub.substr(count);
-                        }
+                        };
 
                     args.push(sub);
                     args.quote = null;
@@ -1572,7 +1571,7 @@ var Commands = Module("commands", {
                                     return dactyl.userEval(completer);
                                 });
                                 if (callable(result))
-                                    return result.apply(this, Array.slice(arguments));
+                                    return result.apply(this, arguments);
                                 else
                                     return context.completions = result;
                             };
@@ -1765,9 +1764,9 @@ var Commands = Module("commands", {
 
         mappings.add([modes.COMMAND],
             ["@:"], "Repeat the last Ex command",
-            function (args) {
+            function ({ count }) {
                 if (commands.repeat) {
-                    for (let i in util.interruptibleRange(0, Math.max(args.count, 1), 100))
+                    for (let i in util.interruptibleRange(0, Math.max(count, 1), 100))
                         dactyl.execute(commands.repeat);
                 }
                 else
@@ -1787,7 +1786,7 @@ let quote = function quote(q, list, map) {
 
 Commands.quoteMap = {
     "\n": "\\n",
-    "\t": "\\t",
+    "\t": "\\t"
 };
 
 Commands.quoteArg = {
@@ -1813,4 +1812,4 @@ endModule();
 
 } catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index eec3857bbf914d584154414053c8e10838e94fd1..24b091a0d935631a47b3c74442b226eb44afa453 100644 (file)
@@ -135,10 +135,10 @@ var CompletionContext = Class("CompletionContext", {
              *     {@link #filters} array.
              */
             this.filterFunc = function filterFunc(items) {
-                    let self = this;
-                    return this.filters.
-                        reduce(function r(res, filter) res.filter(function f(item) filter.call(self, item)),
-                                items);
+                return this.filters
+                           .reduce((res, filter)
+                                        => res.filter((item) => filter.call(this, item)),
+                                   items);
             };
             /**
              * @property {Array} An array of predicates on which to filter the
@@ -674,7 +674,6 @@ var CompletionContext = Class("CompletionContext", {
     },
 
     getRows: function getRows(start, end, doc) {
-        let self = this;
         let items = this.items;
         let cache = this.cache.rows;
         let step = start > end ? -1 : 1;
@@ -706,8 +705,8 @@ var CompletionContext = Class("CompletionContext", {
      *      for the new context. If a string is provided, it is
      *      interpreted as a method to access on *self*.
      */
-    fork: function fork(name, offset, self, completer) {
-        return this.forkapply(name, offset, self, completer, Array.slice(arguments, fork.length));
+    fork: function fork(name, offset, self, completer, ...args) {
+        return this.forkapply(name, offset, self, completer, args);
     },
 
     forkapply: function forkapply(name, offset, self, completer, args) {
@@ -732,13 +731,11 @@ var CompletionContext = Class("CompletionContext", {
         return context;
     },
 
-    split: function split(name, obj, fn) {
-        const self = this;
-
+    split: function split(name, obj, fn, ...args) {
         let context = this.fork(name);
-        function alias(prop) {
-            context.__defineGetter__(prop, function get_() self[prop]);
-            context.__defineSetter__(prop, function set_(val) self[prop] = val);
+        let alias = (prop) => {
+            context.__defineGetter__(prop, () => this[prop]);
+            context.__defineSetter__(prop, (val) => this[prop] = val);
         }
         alias("_cache");
         alias("_completions");
@@ -749,7 +746,7 @@ var CompletionContext = Class("CompletionContext", {
         context.hasItems = true;
         this.hasItems = false;
         if (fn)
-            return fn.apply(obj || this, [context].concat(Array.slice(arguments, split.length)));
+            return fn.apply(obj || this, [context].concat(args));
         return context;
     },
 
@@ -821,7 +818,6 @@ var CompletionContext = Class("CompletionContext", {
      * context.
      */
     reset: function reset() {
-        let self = this;
         if (this.parent)
             throw Error();
 
@@ -842,7 +838,7 @@ var CompletionContext = Class("CompletionContext", {
             this.value = this._value;
             this._caret = this.value.length;
         }
-        //for (let key in (k for ([k, v] in Iterator(self.contexts)) if (v.offset > this.caret)))
+        //for (let key in (k for ([k, v] in Iterator(this.contexts)) if (v.offset > this.caret)))
         //    delete this.contexts[key];
         for each (let context in this.contexts) {
             context.hasItems = false;
@@ -907,10 +903,10 @@ var Completion = Module("completion", {
         get options() modules.options,
 
         // FIXME
-        _runCompleter: function _runCompleter(name, filter, maxItems) {
+        _runCompleter: function _runCompleter(name, filter, maxItems, ...args) {
             let context = modules.CompletionContext(filter);
             context.maxItems = maxItems;
-            let res = context.fork.apply(context, ["run", 0, this, name].concat(Array.slice(arguments, 3)));
+            let res = context.fork.apply(context, ["run", 0, this, name].concat(args));
             if (res) {
                 if (Components.stack.caller.name === "runCompleter") // FIXME
                     return { items: res.map(function m(i) ({ item: i })) };
@@ -921,14 +917,14 @@ var Completion = Module("completion", {
         },
 
         runCompleter: function runCompleter(name, filter, maxItems) {
-            return this._runCompleter.apply(this, Array.slice(arguments))
+            return this._runCompleter.apply(this, arguments)
                        .items.map(function m(i) i.item);
         },
 
-        listCompleter: function listCompleter(name, filter, maxItems) {
+        listCompleter: function listCompleter(name, filter, maxItems, ...args) {
             let context = modules.CompletionContext(filter || "");
             context.maxItems = maxItems;
-            context.fork.apply(context, ["list", 0, this, name].concat(Array.slice(arguments, 3)));
+            context.fork.apply(context, ["list", 0, this, name].concat(args));
             context = context.contexts["/list"];
             context.wait(null, true);
 
@@ -943,7 +939,7 @@ var Completion = Module("completion", {
                     template.map(contexts, function m(context)
                         [template.completionRow(context.title, "CompTitle"),
                          template.map(context.items, function m(item) context.createRow(item), null, 100)])]);
-        },
+        }
     }),
 
     ////////////////////////////////////////////////////////////////////////////////
@@ -991,10 +987,10 @@ var Completion = Module("completion", {
         }, this);
     },
 
-    addUrlCompleter: function addUrlCompleter(opt) {
-        let completer = Completion.UrlCompleter.apply(null, Array.slice(arguments));
-        completer.args = Array.slice(arguments, completer.length);
-        this.urlCompleters[opt] = completer;
+    addUrlCompleter: function addUrlCompleter(name, description, completer, ...args) {
+        let completer = Completion.UrlCompleter(name, description, completer);
+        completer.args = args;
+        this.urlCompleters[name] = completer;
     },
 
     autocomplete: curry(function autocomplete(provider, context) {
@@ -1019,7 +1015,7 @@ var Completion = Module("completion", {
         let words = context.filter.toLowerCase().split(/\s+/g);
         context.hasItems = true;
         context.completions = context.completions.filter(function f({ url, title })
-            words.every(function e(w) (url + " " + title).toLowerCase().indexOf(w) >= 0))
+            words.every(function e(w) (url + " " + title).toLowerCase().indexOf(w) >= 0));
 
         context.format = this.modules.bookmarks.format;
         context.keys.extra = function k_extra(item) {
@@ -1229,4 +1225,4 @@ endModule();
 
 // catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 305880d3cbd5bdae938f6ad985ca10696892f56a..9e5b7c0c59ea3526d4c79afcd5c0f769de8d2eee 100644 (file)
@@ -37,7 +37,7 @@ AboutHandler.prototype = {
         return channel;
     },
 
-    getURIFlags: function (uri) Ci.nsIAboutModule.ALLOW_SCRIPT,
+    getURIFlags: function (uri) Ci.nsIAboutModule.ALLOW_SCRIPT
 };
 var ConfigBase = Class("ConfigBase", {
     /**
@@ -415,7 +415,7 @@ var ConfigBase = Class("ConfigBase", {
         "list.href": Class.Memoize(function () "http://groups.google.com/group/" + config.name),
 
         "hg.latest": Class.Memoize(function () this.code + "source/browse/"), // XXX
-        "irc": "irc://irc.oftc.net/#pentadactyl",
+        "irc": "irc://irc.oftc.net/#pentadactyl"
     }),
 
     dtdExtra: {
@@ -494,7 +494,7 @@ var ConfigBase = Class("ConfigBase", {
          */
         get outputHeight() this.browser.mPanelContainer.boxObject.height,
 
-        tabStrip: Class.Memoize(function () document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer),
+        tabStrip: Class.Memoize(function () document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer)
     }),
 
     /**
@@ -568,12 +568,6 @@ var ConfigBase = Class("ConfigBase", {
 
     sidebars: {},
 
-    /**
-     * @property {string} The leaf name of any temp files created by
-     *     {@link io.createTempFile}.
-     */
-    get tempFile() this.name + ".txt",
-
     /**
      * @constant
      * @property {string} The default highlighting rules.
@@ -620,4 +614,4 @@ endModule();
 
 // catch(e){ if (typeof e === "string") e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index c34d2dded318ad56c02ee56b595b86b86768366c..ffada2b7635446021f543c06cdc5c2a6e8165f7b 100644 (file)
@@ -19,8 +19,6 @@ var Const = function Const(val) Class.Property({ enumerable: true, value: val })
 
 var Group = Class("Group", {
     init: function init(name, description, filter, persist) {
-        const self = this;
-
         this.name = name;
         this.description = description;
         this.filter = filter || this.constructor.defaultFilter;
@@ -67,7 +65,7 @@ var Group = Class("Group", {
     get builtin() this.modules.contexts.builtinGroups.indexOf(this) >= 0,
 
 }, {
-    compileFilter: function (patterns, default_) {
+    compileFilter: function (patterns, default_ = false) {
         if (arguments.length < 2)
             default_ = false;
 
@@ -171,13 +169,12 @@ var Contexts = Module("contexts", {
         Hives: Class("Hives", Class.Property, {
             init: function init(name, constructor) {
                 const { contexts } = modules;
-                const self = this;
 
                 if (this.Hive)
                     return {
                         enumerable: true,
 
-                        get: function () array(contexts.groups[self.name])
+                        get: () => array(contexts.groups[this.name])
                     };
 
                 this.Hive = constructor;
@@ -546,7 +543,7 @@ var Contexts = Module("contexts", {
             if (callable(params))
                 action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })");
             else
-                action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg).array);
+                action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg));
             process = function (param) isObject(param) && param.valueOf ? param.valueOf() : param;
             action.params = params;
             action.makeParams = makeParams;
@@ -819,4 +816,4 @@ endModule();
 
 // catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 5a1cdfb642bfcbe75ff01066cfd933b08a16af39..c83810bb6e07b573ff6ab0cdf67c4bc36a0fa07b 100644 (file)
@@ -51,3 +51,4 @@ function fromXML(node, doc, nodes) {
     }
 }
 
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 61e4446978f2b2848e47ccab923d225c48c175da..b76bc0fe492499362dc4480e3e7afc6259209445 100644 (file)
@@ -100,7 +100,7 @@ var DOM = Class("DOM", {
             href: { get: function (elem) elem.href || elem.getAttribute("href") },
             src:  { get: function (elem) elem.src || elem.getAttribute("src") },
             checked: { get: function (elem) elem.hasAttribute("checked") ? elem.getAttribute("checked") == "true" : elem.checked,
-                       set: function (elem, val) { elem.setAttribute("checked", !!val); elem.checked = val } },
+                       set: function (elem, val) { elem.setAttribute("checked", !!val); elem.checked = val; } },
             collapsed: BooleanAttribute("collapsed"),
             disabled: BooleanAttribute("disabled"),
             hidden: BooleanAttribute("hidden"),
@@ -125,7 +125,7 @@ var DOM = Class("DOM", {
             if (val instanceof Ci.nsIDOMNode)
                 return val;
 
-            if (typeof val == "xml" || DOM.isJSONXML(val)) {
+            if (DOM.isJSONXML(val)) {
                 val = dom.constructor(val, dom.document);
                 if (container)
                     container[idx] = val[0];
@@ -140,6 +140,9 @@ var DOM = Class("DOM", {
             return val;
         }
 
+        if (DOM.isJSONXML(val))
+            val = (function () this).bind(val);
+
         if (callable(val))
             return this.each(function (elem, i) {
                 util.withProperErrors(fn, this, munge(val.call(this, elem, i)), elem, i);
@@ -190,8 +193,8 @@ var DOM = Class("DOM", {
         let res = this.Empty();
 
         this.each(function (elem) {
-            while(true) {
-                elem = fn.call(this, elem)
+            while (true) {
+                elem = fn.call(this, elem);
                 if (elem instanceof Ci.nsIDOMNode)
                     res[res.length++] = elem;
                 else if (elem && "length" in elem)
@@ -269,7 +272,7 @@ var DOM = Class("DOM", {
         each: function each(meth, arg) {
             return self.each(function (elem) {
                 elem.classList[meth](arg);
-            })
+            });
         },
 
         add: function add(cls) this.each("add", cls),
@@ -309,7 +312,7 @@ var DOM = Class("DOM", {
             let { highlight } = this;
             let v = callable(val) ? val.call(thisObj || this, elem, i) : val;
 
-            highlight[(v == null ? highlight.has(hl) : !v) ? "remove" : "add"](hl)
+            highlight[(v == null ? highlight.has(hl) : !v) ? "remove" : "add"](hl);
         }),
     }),
 
@@ -343,7 +346,7 @@ var DOM = Class("DOM", {
             get bottom() this.top + this.height,
             left: r.left + node.clientLeft,
             get right() this.left + this.width
-        }
+        };
     },
 
     scrollPos: function scrollPos(left, top) {
@@ -575,7 +578,7 @@ var DOM = Class("DOM", {
         let res = [];
         this.each(function (elem) {
             try {
-                let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling)
+                let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling);
                 if (color)
                     res.push(["span", { highlight: "HelpXML" },
                         ["span", { highlight: "HelpXMLTagStart" },
@@ -590,7 +593,7 @@ var DOM = Class("DOM", {
                         ],
                         !hasChildren ? "" :
                             ["", "...",
-                             ["span", { highlight: "HtmlTagEnd" },"<", namespaced(elem), ">"]]
+                             ["span", { highlight: "HtmlTagEnd" }, "<", namespaced(elem), ">"]]
                     ]);
                 else {
                     let tag = "<" + [namespaced(elem)].concat(
@@ -791,19 +794,19 @@ var DOM = Class("DOM", {
     html: function html(txt, self) {
         return this.getSet(arguments,
                            function (elem) elem.innerHTML,
-                           util.wrapCallback(function (elem, val) { elem.innerHTML = val }));
+                           util.wrapCallback(function (elem, val) { elem.innerHTML = val; }));
     },
 
     text: function text(txt, self) {
         return this.getSet(arguments,
                            function (elem) elem.textContent,
-                           function (elem, val) { elem.textContent = val });
+                           function (elem, val) { elem.textContent = val; });
     },
 
     val: function val(txt) {
         return this.getSet(arguments,
                            function (elem) elem.value,
-                           function (elem, val) { elem.value = val == null ? "" : val });
+                           function (elem, val) { elem.value = val == null ? "" : val; });
     },
 
     listen: function listen(event, listener, capture) {
@@ -902,7 +905,7 @@ var DOM = Class("DOM", {
                     return true;
                 if (rect.top > viewport.bottom)
                     return false;
-                return Math.abs(rect.top) < Math.abs(viewport.bottom - rect.bottom)
+                return Math.abs(rect.top) < Math.abs(viewport.bottom - rect.bottom);
             }
 
             let rect;
@@ -1063,7 +1066,6 @@ var DOM = Class("DOM", {
             return this;
         },
 
-
         code_key:       Class.Memoize(function (prop) this.init()[prop]),
         code_nativeKey: Class.Memoize(function (prop) this.init()[prop]),
         keyTable:       Class.Memoize(function (prop) this.init()[prop]),
@@ -1331,7 +1333,6 @@ var DOM = Class("DOM", {
             return "<" + modifier + key + ">";
         },
 
-
         defaults: {
             load:   { bubbles: false },
             submit: { cancelable: true }
@@ -1613,7 +1614,7 @@ var DOM = Class("DOM", {
                     else
                         elem.setAttributeNS(vals[0] || "", key, val);
                 }
-            args.forEach(function(e) {
+            args.forEach(function (e) {
                 elem.appendChild(tag(e, namespaces));
             });
 
@@ -1627,7 +1628,7 @@ var DOM = Class("DOM", {
         else
             namespaces = fromJSON.namespaces;
 
-        return tag(xml, namespaces)
+        return tag(xml, namespaces);
     }, {
         namespaces: {
             "": "http://www.w3.org/1999/xhtml",
@@ -1663,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(function (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(function (a) isinstance(a, ["String", DOM.DOMString]) || isFragment(a) && isStrings(a));
         }
 
         function tag(args, namespaces, indent) {
@@ -1724,7 +1725,7 @@ var DOM = Class("DOM", {
                             contents.push(string);
                     });
                     if (contents.length)
-                        res.push(contents.join("\n"), join)
+                        res.push(contents.join("\n"), join);
                 });
                 if (res[res.length - 1] == join)
                     res.pop();
@@ -1785,7 +1786,7 @@ var DOM = Class("DOM", {
                              "</", name, ">");
                 else {
                     let contents = [];
-                    args.forEach(function(e) {
+                    args.forEach(function (e) {
                         let string = tag(e, namespaces, indent + INDENT);
                         if (string)
                             contents.push(string);
@@ -1803,7 +1804,7 @@ var DOM = Class("DOM", {
         else
             namespaces = DOM.fromJSON.namespaces;
 
-        return tag(xml, namespaces, "")
+        return tag(xml, namespaces, "");
     },
 
     parseNamespace: function parseNamespace(name, namespaces) {
@@ -1908,4 +1909,4 @@ endModule();
 
 // catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index fdf5925b846d5d01853db1de0debec0aad957919..26ac1ccd31dc0df00f00d86bfdb954e27f2d0cd5 100644 (file)
@@ -23,21 +23,20 @@ var states = iter([v, k.slice(prefix.length).toLowerCase()]
 
 var Download = Class("Download", {
     init: function init(id, list) {
-        let self = this;
         this.download = services.downloadManager.getDownload(id);
         this.list = list;
 
         this.nodes = {
-            commandTarget: self
+            commandTarget: this
         };
         DOM.fromJSON(
             ["tr", { highlight: "Download", key: "row" },
                 ["td", { highlight: "DownloadTitle" },
                     ["span", { highlight: "Link" },
-                        ["a", { key: "launch", href: self.target.spec, path: self.targetFile.path },
-                            self.displayName],
+                        ["a", { key: "launch", href: this.target.spec, path: this.targetFile.path },
+                            this.displayName],
                         ["span", { highlight: "LinkInfo" },
-                            self.targetFile.path]]],
+                            this.targetFile.path]]],
                 ["td", { highlight: "DownloadState", key: "state" }],
                 ["td", { highlight: "DownloadButtons Buttons" },
                     ["a", { highlight: "Button", href: "javascript:0", key: "pause" }, _("download.action.Pause")],
@@ -54,19 +53,19 @@ var Download = Class("Download", {
                 ["td", { highlight: "DownloadSpeed", key: "speed" }],
                 ["td", { highlight: "DownloadTime", key: "time" }],
                 ["td", {},
-                    ["a", { highlight: "DownloadSource", key: "source", href: self.source.spec },
-                        self.source.spec]]],
+                    ["a", { highlight: "DownloadSource", key: "source", href: this.source.spec },
+                        this.source.spec]]],
             this.list.document, this.nodes);
 
-        this.nodes.launch.addEventListener("click", function (event) {
+        this.nodes.launch.addEventListener("click", (event) => {
             if (event.button == 0) {
                 event.preventDefault();
-                self.command("launch");
+                this.command("launch");
             }
         }, false);
 
-        self.updateStatus();
-        return self;
+        this.updateStatus();
+        return this;
     },
 
     get status() states[this.state],
@@ -102,7 +101,6 @@ var Download = Class("Download", {
             this.updateStatus();
         },
         launch: function launch() {
-            let self = this;
             // Behavior mimics that of the builtin Download Manager.
             function action() {
                 try {
@@ -119,13 +117,13 @@ 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") + " ",
-                    function (resp) {
+                    (resp) => {
                         if (/^a(lways)$/i.test(resp)) {
                             prefs.set("browser.download.manager.alertOnEXEOpen", false);
                             resp = "yes";
                         }
                         if (/^y(es)?$/i.test(resp))
-                            action.call(self);
+                            action.call(this);
                     });
             else
                 action.call(this);
@@ -419,7 +417,6 @@ var Downloads = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), {
             let file  = download.targetFile.path;
             let size  = download.size;
 
-
             overlay.modules.forEach(function (modules) {
                 modules.dactyl.echomsg({ domains: [util.getHost(url)], message: _("io.downloadFinished", title, file) },
                                        1, modules.commandline.ACTIVE_WINDOW);
@@ -516,4 +513,4 @@ endModule();
 
 // catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index ee85905b3f89322b6bbd7b93bd58febc674a6fe4..9c1897deb9859bd34c0bbf62404423de2fd31f75 100644 (file)
@@ -851,4 +851,4 @@ var RangeFind = Class("RangeFind", {
 
 endModule();
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index a092ad5c8a71fc02de197919eda53dd9b58b6957..623aeca1a6844dbd06842dc01095b43b48da5a3a 100644 (file)
@@ -131,12 +131,10 @@ var Help = Module("Help", {
             let beta = array(betas.iterate(NEWS))
                         .map(function (m) m[1]).uniq().slice(-1)[0];
 
-
             function rec(text, level, li) {
                 let res = [];
                 let list, space, i = 0;
 
-
                 for (let match in re.iterate(text)) {
                     if (match.comment)
                         continue;
@@ -195,7 +193,6 @@ var Help = Module("Help", {
             //     }
             // }
 
-
             return '<?xml version="1.0"?>\n' +
                    '<?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>\n' +
                    DOM.toXML(["document", { xmlns: "dactyl", name: "versions",
@@ -448,9 +445,16 @@ var Help = Module("Help", {
     javascript: function initJavascript(dactyl, modules, window) {
         modules.JavaScript.setCompleter([modules.help.exportHelp],
             [function (context, args) overlay.activeModules.completion.file(context)]);
+    },
+    options: function initOptions(dactyl, modules, window) {
+        const { options } = modules;
+
+        options.add(["helpfile", "hf"],
+            "Name of the main help file",
+            "string", "intro");
     }
 });
 
 endModule();
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index bf242e08f70eed2c3caaa0354166c9ac38a35c78..fca93478b3f7ce514cabba374e700eaf5bde62a8 100644 (file)
@@ -218,11 +218,12 @@ var Highlights = Module("Highlight", {
      * @param {string} class
      */
     selector: function selector(class_)
-        let (self = this)
-           class_.replace(/(^|[>\s])([A-Z][\w-]+)\b/g,
-            function (m, n1, hl) n1 +
-                (self.highlight[hl] && self.highlight[hl].class != class_
-                    ? self.highlight[hl].selector : "[dactyl|highlight~=" + hl + "]")),
+        class_.replace(/(^|[>\s])([A-Z][\w-]+)\b/g,
+            (m, n1, hl) => {
+                if (this.highlight[hl] && this.highlight[hl].class != class_)
+                    return n1 + this.highlight[hl].selector;
+                return n1 + "[dactyl|highlight~=" + hl + "]";
+            }),
 
     groupRegexp: util.regexp(literal(/*
         ^
@@ -452,4 +453,4 @@ var Highlights = Module("Highlight", {
 
 endModule();
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 9e717d74ed51ebd217ea017e821b017e7a7ef7c7..8a3a06b2994c4f7a7e40a39c28c361f9b0b71bdd 100644 (file)
@@ -149,7 +149,7 @@ var IO = Module("io", {
                     let sourceJSM = function sourceJSM() {
                         context = contexts.Module(uri);
                         dactyl.triggerObserver("io.source", context, file, file.lastModifiedTime);
-                    }
+                    };
 
                     if (/\.jsm$/.test(filename))
                         sourceJSM();
@@ -307,23 +307,20 @@ var IO = Module("io", {
     },
 
     /**
-     * Creates a temporary file.
+     * Returns a temporary file.
      *
+     * @param {string} ext The filename extension.
+     *     @default "txt"
+     * @param {string} label A metadata string appended to the filename. Useful
+     *     for identifying the file, beyond its extension, to external
+     *     applications.
+     *     @default ""
      * @returns {File}
      */
-    createTempFile: function createTempFile(name, type) {
-        if (name instanceof Ci.nsIFile) {
-            var file = name.clone();
-            if (!type || type == "file")
-                file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(666));
-            else
-                file.createUnique(Ci.nsIFile.DIRECTORY_TYPE, octal(777));
-        }
-        else {
-            file = services.directory.get("TmpD", Ci.nsIFile);
-            file.append(this.config.tempFile + (name ? "." + name : ""));
-            file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(666));
-        }
+    createTempFile: function createTempFile(ext = "txt", label = "") {
+        let file = services.directory.get("TmpD", Ci.nsIFile);
+        file.append(config.name + label + "." + ext);
+        file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(666));
 
         services.externalApp.deleteTemporaryFileOnExit(file);
 
@@ -543,9 +540,9 @@ var IO = Module("io", {
      * @returns {boolean} false if temp files couldn't be created,
      *     otherwise, the return value of *func*.
      */
-    withTempFiles: function withTempFiles(func, self, checked, ext) {
+    withTempFiles: function withTempFiles(func, self, checked, ext, label) {
         let args = array(util.range(0, func.length))
-                    .map(bind("createTempFile", this, ext)).array;
+                    .map(bind("createTempFile", this, ext, label)).array;
         try {
             if (!args.every(util.identity))
                 return false;
@@ -639,7 +636,7 @@ var IO = Module("io", {
                 lines.push("\n\" vim: set ft=" + config.name + ":");
 
                 try {
-                    file.write(lines.join("\n"));
+                    file.write(lines.join("\n").concat("\n"));
                     dactyl.echomsg(_("io.writing", file.path.quote()), 2);
                 }
                 catch (e) {
@@ -675,13 +672,13 @@ var IO = Module("io", {
                     item.file = file;
                 }
 
-                rtItems.ftdetect.template = // {{{
+                rtItems.ftdetect.template = //{{{
 literal(/*" Vim filetype detection file
 <header>
 
 au BufNewFile,BufRead *<name>rc*,*.<fileext> set filetype=<name>
 */);//}}}
-                rtItems.ftplugin.template = // {{{
+                rtItems.ftplugin.template = //{{{
 literal(/*" Vim filetype plugin file
 <header>
 
@@ -708,7 +705,7 @@ endif
 let &cpo = s:cpo_save
 unlet s:cpo_save
 */);//}}}
-                rtItems.syntax.template = // {{{
+                rtItems.syntax.template = //{{{
 literal(/*" Vim syntax file
 <header>
 
@@ -812,7 +809,7 @@ unlet s:cpo_save
                     return lines.map(function (l) l.join("")).join("\n").replace(/\s+\n/gm, "\n");
                 }//}}}
 
-                let params = { // {{{
+                let params = { //{{{
                     header: ['" Language:    ' + config.appName + ' configuration file',
                              '" Maintainer:  Doug Kearns <dougkearns@gmail.com>',
                              '" Version:     ' + config.version].join("\n"),
@@ -830,7 +827,7 @@ unlet s:cpo_save
                                         array(o.realNames for (o in options) if (o.type == "boolean"))
                                             .flatten().map(String.quote),
                                         ", ") + "]"
-                }; // }}}
+                }; //}}}
 
                 for (let { file, template } in values(rtItems)) {
                     try {
@@ -1165,4 +1162,4 @@ endModule();
 
 } catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index a0981d7894fed5048a2ca8b945035fa2d6389a60..b74c86f48f53ced9f1affd7cceb9cc2ad65c33c3 100644 (file)
@@ -765,13 +765,12 @@ var JavaScript = Module("javascript", {
             init: function init(context) {
                 init.supercall(this);
 
-                let self = this;
                 let sandbox = true || isinstance(context, ["Sandbox"]);
 
                 this.context = modules.newContext(context, !sandbox, "Dactyl REPL Context");
                 this.js = modules.JavaScript();
                 this.js.replContext = this.context;
-                this.js.newContext = function newContext() modules.newContext(self.context, !sandbox, "Dactyl REPL Temp Context");
+                this.js.newContext = () => modules.newContext(this.context, !sandbox, "Dactyl REPL Temp Context");
 
                 this.js.globals = [
                    [this.context, /*L*/"REPL Variables"],
@@ -856,8 +855,7 @@ var JavaScript = Module("javascript", {
     mappings: function initMappings(dactyl, modules, window) {
         const { mappings, modes } = modules;
 
-        function bind() mappings.add.apply(mappings,
-                                           [[modes.REPL]].concat(Array.slice(arguments)))
+        function bind(...args) mappings.add.apply(mappings, [[modes.REPL]].concat(args))
 
         bind(["<Return>"], "Accept the current input",
              function ({ self }) { self.accept(); });
@@ -900,4 +898,4 @@ endModule();
 
 } catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 41ef16cf570cfcf40a260d4abbb934bf158bcbe6..ae6926d003589188bc6c1e821076575c24428bb4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k@gmail.com>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -65,14 +65,13 @@ var Modules = function Modules(window) {
      *
      * @returns {function} The constructor for the resulting module.
      */
-    function Module(name) {
-        let args = Array.slice(arguments);
+    function Module(name, ...args) {
 
         var base = ModuleBase;
-        if (callable(args[1]))
-            base = args.splice(1, 1)[0];
+        if (callable(args[0]))
+            base = args.shift();
 
-        let [prototype, classProperties, moduleInit] = args;
+        let [prototype, classProperties, moduleInit] = args;
         prototype._metaInit_ = function () {
             delete module.prototype._metaInit_;
             Class.replaceProperty(modules, module.className, this);
@@ -92,7 +91,6 @@ var Modules = function Modules(window) {
 
     const create = window.Object.create.bind(window.Object);
 
-
     const BASES = [BASE, "resource://dactyl-local-content/"];
 
     jsmodules = Cu.createObjectIn(window);
@@ -322,25 +320,24 @@ overlay.overlayWindow(Object.keys(config.overlays), function _overlay(window) ({
     },
 
     scanModules: function scanModules() {
-        let self = this;
         let { Module, modules } = this.modules;
 
-        defineModule.modules.forEach(function defModule(mod) {
+        defineModule.modules.forEach((mod) => {
             let names = Set(Object.keys(mod.INIT));
             if ("init" in mod.INIT)
                 Set.add(names, "init");
 
-            keys(names).forEach(function (name) { self.deferInit(name, mod.INIT, mod); });
+            keys(names).forEach((name) => { this.deferInit(name, mod.INIT, mod); });
         });
 
-        Module.list.forEach(function frobModule(mod) {
+        Module.list.forEach((mod) => {
             if (!mod.frobbed) {
-                modules.__defineGetter__(mod.className, function () {
+                modules.__defineGetter__(mod.className, () => {
                     delete modules[mod.className];
-                    return self.loadModule(mod.className, null, Components.stack.caller);
+                    return this.loadModule(mod.className, null, Components.stack.caller);
                 });
                 Object.keys(mod.prototype.INIT)
-                      .forEach(function (name) { self.deferInit(name, mod.prototype.INIT, mod); });
+                      .forEach((name) => { this.deferInit(name, mod.prototype.INIT, mod); });
             }
             mod.frobbed = true;
         });
@@ -357,4 +354,4 @@ endModule();
 
 } catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 12ab0f357fa94b2195db31466b6bb2bdabea2506..533c0043d5686f25a90e4962156a33a5893a0dd1 100644 (file)
@@ -98,7 +98,7 @@ var Messages = Module("messages", {
         file = io.File(file);
 
         function properties(base, iter_, prop) iter(function _properties() {
-            function key() [base, obj.identifier || obj.name].concat(Array.slice(arguments)).join(".").replace(/[\\:=]/g, "\\$&");
+            function key(...args) [base, obj.identifier || obj.name].concat(args).join(".").replace(/[\\:=]/g, "\\$&");
 
             prop = prop || "description";
             for (var obj in iter_) {
@@ -147,7 +147,6 @@ var Messages = Module("messages", {
                 obj[_prop] = this.default;
                 return {
                     get: function get() {
-                        let self = this;
                         let value = this[_prop];
 
                         function getter(key, default_) function getter() messages.get([name, key].join("."), default_);
@@ -205,4 +204,4 @@ endModule();
 
 // catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 1440e23cd6e7b0ad6d5dc4abc944db69fed729ce..ac5ceb98cb7ef4400d9c0728e0363a661def1cc5 100644 (file)
@@ -1,6 +1,6 @@
 // Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
 // Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 by Kris Maglione <maglione.k@gmail.com>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -258,7 +258,7 @@ var Option = Class("Option", {
         return null;
     },
 
-    // Properties {{{2
+    // Properties {{{
 
     /** @property {string} The option's canonical name. */
     name: null,
@@ -400,7 +400,8 @@ var Option = Class("Option", {
     hasChanged: false,
 
     /**
-     * Returns the timestamp when the option's value was last changed.
+     * @property {number} Returns the timestamp when the option's value was
+     *     last changed.
      */
     get lastSet() options.store.get(this.name).time,
     set lastSet(val) { options.store.set(this.name, { value: this.globalValue, time: Date.now() }); },
@@ -411,6 +412,7 @@ var Option = Class("Option", {
      */
     setFrom: null
 
+    //}}}
 }, {
     /**
      * @property {number} Global option scope.
@@ -906,8 +908,6 @@ var Options = Module("options", {
          * @optional
          */
         add: function add(names, description, type, defaultValue, extraInfo) {
-            const self = this;
-
             if (!util.isDactyl(Components.stack.caller))
                 deprecated.warn(add, "options.add", "group.options.add");
 
@@ -925,7 +925,7 @@ var Options = Module("options", {
                 this.remove(name);
             }
 
-            let closure = function () self._optionMap[name];
+            let closure = () => this._optionMap[name];
 
             memoize(this._optionMap, name, function () Option.types[type](modules, names, description, defaultValue, extraInfo));
             for (let alias in values(names.slice(1)))
@@ -1566,4 +1566,4 @@ endModule();
 
 } catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index f8a4fb5d314bebe9beb2c649bf53a9a63801e454..560982c2d266352119f13331f7004043ba646485 100644 (file)
@@ -20,7 +20,7 @@ var setAttr = function setAttr(elem, ns, name, val) {
         elem.removeAttributeNS(ns, name);
     else
         elem.setAttributeNS(ns, name, val);
-}
+};
 
 var Overlay = Class("Overlay", {
     init: function init(window) {
@@ -42,7 +42,6 @@ var Overlay = Class("Overlay", {
     }
 });
 
-
 var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), {
     init: function init() {
         util.addObserver(this);
@@ -234,7 +233,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
                 let iterator = Iterator(obj[key]);
                 if (isArray(obj[key])) {
                     iterator = ([elem[1].id, elem.slice(2), elem[1]]
-                                for each (elem in obj[key]))
+                                for each (elem in obj[key]));
                 }
 
                 for (let [elem, xml, attrs] in iterator) {
@@ -381,7 +380,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
                 Object.defineProperty(object, k, desc);
 
                 if (callable(value)) {
-                    var sentinel = "(function DactylOverlay() {}())"
+                    var sentinel = "(function DactylOverlay() {}())";
                     value.toString = function toString() toString.toString.call(this).replace(/\}?$/, sentinel + "; $&");
                     value.toSource = function toSource() toSource.toSource.call(this).replace(/\}?$/, sentinel + "; $&");
                 }
@@ -432,4 +431,4 @@ endModule();
 
 } catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index b0fdd176d6c80352de3b6722e6a95ca1515cc157..d01d1c26041237d746f7a70f815bea9b902dc021 100644 (file)
@@ -439,4 +439,4 @@ endModule();
 
 } catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 82b59a39f2246d7a1a8fe09e1345a14dd08f8df0..f73e209247102989d14f113b4518ba3d51ce752e 100644 (file)
@@ -44,9 +44,9 @@ function NetError(orig, error) {
 
         originalURI: orig,
 
-        asyncOpen: function () { throw error || Cr.NS_ERROR_FILE_NOT_FOUND },
+        asyncOpen: function () { throw error || Cr.NS_ERROR_FILE_NOT_FOUND; },
 
-        open: function () { throw error || Cr.NS_ERROR_FILE_NOT_FOUND }
+        open: function () { throw error || Cr.NS_ERROR_FILE_NOT_FOUND; }
     }).data.QueryInterface(Ci.nsIChannel);
 }
 function RedirectChannel(to, orig, time, message) {
@@ -72,7 +72,7 @@ function Protocol(scheme, classID, contentBase) {
 
         contentBase: contentBase,
 
-        _xpcom_factory: JSMLoader.Factory(Protocol),
+        _xpcom_factory: JSMLoader.Factory(Protocol)
     };
     return Protocol;
 }
@@ -259,4 +259,4 @@ XMLChannel.prototype = {
 
 endModule();
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 9b4eb547805e9b2e8a859bf8be683d9dde855715..01b0ecad1b750f0ee7238f0b9da099182bdf589d 100644 (file)
@@ -70,7 +70,6 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
 
         util.addObserver(this);
 
-        services.add("contentPrefs", "@mozilla.org/content-pref/service;1", Ci.nsIContentPrefService);
         services.add("cookies",      "@mozilla.org/cookiemanager;1",        [Ci.nsICookieManager, Ci.nsICookieManager2,
                                                                              Ci.nsICookieService]);
         services.add("loginManager", "@mozilla.org/login-manager;1",        Ci.nsILoginManager);
@@ -201,7 +200,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                                      template.map(util.range(0, Math.ceil(items.length / 2)), function (i)
                                          ["row", {},
                                              template.map(items.slice(i * 2, i * 2 + 2), function (item)
-                                                ["checkbox", { xmlns: XUL, label: item.description, preference: branch + item.name }])])]]],
+                                                ["checkbox", { xmlns: XUL, label: item.description, preference: branch + item.name }])])]]]
                     }
                 }));
             }
@@ -215,7 +214,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                             template.map(ourItems(), function ([item, desc])
                                 ["listitem", { xmlns: "xul", preference: branch + item,
                                                type: "checkbox", label: config.appName + ", " + desc,
-                                               onsyncfrompreference: "return gSanitizePromptDialog.onReadGeneric();" }]),
+                                               onsyncfrompreference: "return gSanitizePromptDialog.onReadGeneric();" }])
                         ]
                     },
                     ready: function ready(win) {
@@ -508,7 +507,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
                         description: "Timespan for which to sanitize items",
                         completer: function (context) modules.options.get("sanitizetimespan").completer(context),
                         type: modules.CommandOption.STRING,
-                        validator: function (arg) modules.options.get("sanitizetimespan").validator(arg),
+                        validator: function (arg) modules.options.get("sanitizetimespan").validator(arg)
                     }
                 ],
                 privateData: true
@@ -599,19 +598,6 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
     },
     options: function initOptions(dactyl, modules) {
         const options = modules.options;
-        if (services.has("privateBrowsing") && "privateBrowsingEnabled" in services.privateBrowsing)
-            options.add(["private", "pornmode"],
-                "Set the 'private browsing' option",
-                "boolean", false,
-                {
-                    initialValue: true,
-                    getter: function () services.privateBrowsing.privateBrowsingEnabled,
-                    setter: function (value) {
-                        if (services.privateBrowsing.privateBrowsingEnabled != value)
-                            services.privateBrowsing.privateBrowsingEnabled = value;
-                    },
-                    persist: false
-                });
 
         options.add(["sanitizeitems", "si"],
             "The default list of private items to sanitize",
@@ -731,4 +717,4 @@ endModule();
 
 // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index d3ac781fac3fdfff5fde6cf3a5ca43cfa444b45b..377cd13edec5345d5e8809a9b35474bcf89c7752 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -47,13 +47,13 @@ var Services = Module("Services", {
         this.add("downloadManager",     "@mozilla.org/download-manager;1",                  "nsIDownloadManager");
         this.add("environment",         "@mozilla.org/process/environment;1",               "nsIEnvironment");
         this.add("extensionManager",    "@mozilla.org/extensions/manager;1",                "nsIExtensionManager");
-        this.add("externalApp",         "@mozilla.org/uriloader/external-helper-app-service;1", "nsPIExternalAppLauncher")
+        this.add("externalApp",         "@mozilla.org/uriloader/external-helper-app-service;1", "nsPIExternalAppLauncher");
         this.add("externalProtocol",    "@mozilla.org/uriloader/external-protocol-service;1", "nsIExternalProtocolService");
         this.add("favicon",             "@mozilla.org/browser/favicon-service;1",           "nsIFaviconService");
         this.add("file:",               this.PROTOCOL + "file",                             "nsIFileProtocolHandler");
         this.add("focus",               "@mozilla.org/focus-manager;1",                     "nsIFocusManager");
-        this.add("history",             "@mozilla.org/browser/global-history;2",
-                 ["nsIBrowserHistory", "nsIGlobalHistory2", "nsINavHistoryService", "nsPIPlacesDatabase"]);
+        this.add("history",             "@mozilla.org/browser/nav-history-service;1",
+                 ["nsIBrowserHistory", "nsINavHistoryService", "nsPIPlacesDatabase"]);
         this.add("io",                  "@mozilla.org/network/io-service;1",                "nsIIOService");
         this.add("json",                "@mozilla.org/dom/json;1",                          "nsIJSON", "createInstance");
         this.add("listeners",           "@mozilla.org/eventlistenerservice;1",              "nsIEventListenerService");
@@ -99,7 +99,7 @@ var Services = Module("Services", {
         this.addClass("Persist",      "@mozilla.org/embedding/browser/nsWebBrowserPersist;1", "nsIWebBrowserPersist");
         this.addClass("Pipe",         "@mozilla.org/pipe;1",                       "nsIPipe", "init");
         this.addClass("Process",      "@mozilla.org/process/util;1",               "nsIProcess", "init");
-        this.addClass("Pump",         "@mozilla.org/network/input-stream-pump;1",  "nsIInputStreamPump", "init")
+        this.addClass("Pump",         "@mozilla.org/network/input-stream-pump;1",  "nsIInputStreamPump", "init");
         this.addClass("StreamChannel","@mozilla.org/network/input-stream-channel;1",
                       ["nsIInputStreamChannel", "nsIChannel"], "setURI");
         this.addClass("StreamCopier", "@mozilla.org/network/async-stream-copier;1","nsIAsyncStreamCopier", "init");
@@ -126,7 +126,7 @@ var Services = Module("Services", {
             if (!service.interfaces.length)
                 return res.wrappedJSObject || res;
 
-            service.interfaces.forEach(function (iface) res.QueryInterface(Ci[iface]));
+            service.interfaces.forEach(function (iface) res instanceof Ci[iface]);
             if (service.init && args.length) {
                 if (service.callable)
                     res[service.init].apply(res, args);
@@ -139,7 +139,7 @@ var Services = Module("Services", {
             if (service.quiet === false)
                 throw e.stack ? e : Error(e);
 
-            if (typeof util !== "undefined")
+            if (typeof util !== "undefined" && util != null)
                 util.reportError(e);
             else
                 dump("dactyl: Service creation failed for '" + service.class + "': " + e + "\n" + (e.stack || Error(e).stack));
@@ -176,13 +176,12 @@ var Services = Module("Services", {
      *     class.
      */
     addClass: function addClass(name, class_, ifaces, init, quiet) {
-        const self = this;
         this.services[name] = { class: class_, interfaces: Array.concat(ifaces || []), method: "createInstance", init: init, quiet: quiet };
         if (init)
             memoize(this.services[name], "callable",
                     function () callable(XPCOMShim(this.interfaces)[this.init]));
 
-        this[name] = function Create() self._create(name, arguments);
+        this[name] = (function Create() this._create(name, arguments)).bind(this);
         update.apply(null, [this[name]].concat([Ci[i] for each (i in Array.concat(ifaces))]));
         return this[name];
     },
@@ -214,4 +213,4 @@ endModule();
 
 } catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
 
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 0f4cc06e7a83a41c0ca3e89dada9b422948c613e..f37524d843e79186c40ad36c5e02627b775f2276 100644 (file)
@@ -162,7 +162,7 @@ var ObjectStore = Class("ObjectStore", StoreBase, {
     }
 });
 
-var sessionGlobal = Cu.import("resource://gre/modules/Services.jsm", {})
+var sessionGlobal = Cu.import("resource://gre/modules/Services.jsm", {});
 
 var Storage = Module("Storage", {
     Local: function Local(dactyl, modules, window) ({
@@ -241,7 +241,6 @@ var Storage = Module("Storage", {
     },
 
     newObject: function newObject(key, constructor, params) {
-        let self = this;
         if (params == null || !isObject(params))
             throw Error("Invalid argument type");
 
@@ -261,10 +260,10 @@ var Storage = Module("Storage", {
             if (key in this && !reload)
                 throw Error("Cannot add storage key with that name.");
 
-            let load = function () self._loadData(key, params.store, params.type || myObject);
+            let load = () => this._loadData(key, params.store, params.type || myObject);
 
             this.keys[key] = new constructor(key, params.store, load, params);
-            this.keys[key].timer = new Timer(1000, 10000, function () self.save(key));
+            this.keys[key].timer = new Timer(1000, 10000, () => this.save(key));
             this.__defineGetter__(key, function () this.keys[key]);
         }
         return this.keys[key];
@@ -762,7 +761,6 @@ var File = Class("File", {
         }
     },
 
-
     isAbsolutePath: function isAbsolutePath(path) {
         try {
             services.File().initWithPath(path);
@@ -793,7 +791,7 @@ let (file = services.directory.get("ProfD", Ci.nsIFile)) {
         if (!(prop in File.prototype)) {
             let isFunction;
             try {
-                isFunction = callable(file[prop])
+                isFunction = callable(file[prop]);
             }
             catch (e) {}
 
@@ -814,4 +812,4 @@ endModule();
 
 // catch(e){ dump(e + "\n" + (e.stack || Error().stack)); Components.utils.reportError(e) }
 
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index c89c2812ef454217e315d0f1388ecb3068ce204d..ffa4c696fc0b3e2d5f548c78967d0aa935855f20 100644 (file)
@@ -29,7 +29,7 @@ Sheet.liveProperty = function (name) {
         this[i] = val;
         this.enabled = this.enabled;
     });
-}
+};
 Sheet.liveProperty("agent");
 Sheet.liveProperty("css");
 Sheet.liveProperty("sites");
@@ -203,7 +203,6 @@ var Hive = Class("Hive", {
      * @param {number} index
      */
     remove: function remove(name, filter, css, index) {
-        let self = this;
         if (arguments.length == 1) {
             var matches = [name];
             name = null;
@@ -211,7 +210,7 @@ var Hive = Class("Hive", {
 
         if (filter && filter.indexOf(",") > -1)
             return filter.split(",").reduce(
-                function (n, f) n + self.removeSheet(name, f, index), 0);
+                (n, f) => n + this.removeSheet(name, f, index), 0);
 
         if (filter == undefined)
             filter = "";
@@ -763,9 +762,9 @@ var Styles = Module("Styles", {
                                                          ]);
                     }),
                     match.postSpace
-                ]
-            })
-        }
+                ];
+            });
+        };
     }
 });
 
@@ -773,4 +772,4 @@ endModule();
 
 // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 47fd94db2214804890fd76f9f85f26bdd788570b..b9f5fda9b7ba6a7f7010be5e09a402038467b306 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -168,7 +168,6 @@ var Template = Module("Template", {
         return res;
     },
 
-
     bookmarkDescription: function (item, text) [
         !(item.extra && item.extra.length) ? [] :
         ["span", { highlight: "URLExtra" },
@@ -264,7 +263,6 @@ var Template = Module("Template", {
         })(), this[help ? "HelpLink" : "helpLink"]);
     },
 
-
     // Fixes some strange stack rewinds on NS_ERROR_OUT_OF_MEMORY
     // exceptions that we can't catch.
     stringify: function stringify(arg) {
@@ -417,7 +415,6 @@ var Template = Module("Template", {
                                 util.losslessDecodeURI(val.URI.spec)]]])];
     },
 
-
     options: function options(title, opts, verbose) {
         return ["table", {},
                 ["tr", { highlight: "Title", align: "left" },
@@ -459,26 +456,24 @@ var Template = Module("Template", {
     },
 
     tabular: function tabular(headings, style, iter) {
-        let self = this;
         // TODO: This might be mind-bogglingly slow. We'll see.
         return ["table", {},
             ["tr", { highlight: "Title", align: "left" },
                 this.map(headings, function (h)
                     ["th", {}, h])],
-            this.map(iter, function (row)
+            this.map(iter, (row) =>
                 ["tr", {},
-                    self.map(Iterator(row), function ([i, d])
+                    this.map(Iterator(row), function ([i, d])
                         ["td", { style: style[i] || "" }, d])])];
     },
 
     usage: function usage(iter, format) {
-        let self = this;
 
         format = format || {};
-        let desc = format.description || function (item) self.linkifyHelp(item.description);
-        let help = format.help || function (item) item.name;
-        function sourceLink(frame) {
-            let source = self.sourceLink(frame);
+        let desc = format.description || (item => this.linkifyHelp(item.description));
+        let help = format.help || (item => item.name);
+        let sourceLink = (frame) => {
+            let source = this.sourceLink(frame);
             source[1]["dactyl:hint"] = source[2];
             return source;
         }
@@ -486,29 +481,29 @@ var Template = Module("Template", {
             format.headings ?
                 ["thead", { highlight: "UsageHead" },
                     ["tr", { highlight: "Title", align: "left" },
-                        this.map(format.headings, function (h) ["th", {}, h])]] :
+                        this.map(format.headings, (h) => ["th", {}, h])]] :
                 [],
             format.columns ?
                 ["colgroup", {},
-                    this.map(format.columns, function (c) ["col", { style: c }])] :
+                    this.map(format.columns, (c) => ["col", { style: c }])] :
                 [],
             ["tbody", { highlight: "UsageBody" },
-                this.map(iter, function (item)
+                this.map(iter, (item) =>
                     // Urgh.
                     let (name = item.name || item.names[0], frame = item.definedAt)
                         ["tr", { highlight: "UsageItem" },
                             ["td", { style: "padding-right: 2em;" },
                                 ["span", { highlight: "Usage Link" },
                                     !frame ? name :
-                                        [self.helpLink(help(item), name, "Title"),
+                                        [this.helpLink(help(item), name, "Title"),
                                          ["span", { highlight: "LinkInfo" },
                                             _("io.definedAt"), " ",
                                             sourceLink(frame)]]]],
-                            item.columns ? self.map(item.columns, function (c) ["td", {}, c]) : [],
-                            ["td", {}, desc(item)]])]]
+                            item.columns ? this.map(item.columns, (c) => ["td", {}, c]) : [],
+                            ["td", {}, desc(item)]])]];
     }
 });
 
 endModule();
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 0e83efe7a15a6ea7e81fb1111181360e06d296c0..bf7b67eeefa1ad7427becced9a9890a5b5db3184 100644 (file)
@@ -467,7 +467,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
                             acc.push(vals);
 
                         if (acc.length == pattern.length)
-                            this.res.push(acc.join(""))
+                            this.res.push(acc.join(""));
                         else
                             for (let val in values(vals))
                                 this.rec(acc.concat(val));
@@ -492,7 +492,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
                 }
                 res.push(pattern.substr(end));
                 return res.map(function (s) util.dequote(s, dequote));
-            }
+            };
 
             let patterns = [];
             let substrings = split(pattern, /((?:[^\\{]|\\.)*)\{((?:[^\\}]|\\.)*)\}/gy,
@@ -507,7 +507,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
                 else
                     for (let [, pattern] in Iterator(patterns[acc.length]))
                         rec(acc.concat(pattern));
-            }
+            };
             rec([]);
             return res;
         }
@@ -659,7 +659,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
         [hours, minutes]   = div(minutes, 60);
         [days, hours]      = div(hours,   24);
         if (days)
-            return /*L*/days + " days " + hours + " hours"
+            return /*L*/days + " days " + hours + " hours";
         if (hours)
             return /*L*/hours + "h " + minutes + "m";
         if (minutes)
@@ -755,11 +755,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
 
             let async = params.callback || params.onload || params.onerror;
             if (async) {
-                xmlhttp.addEventListener("load",  function handler(event) { util.trapErrors(params.onload  || params.callback, params, xmlhttp, event) }, false);
-                xmlhttp.addEventListener("error", function handler(event) { util.trapErrors(params.onerror || params.callback, params, xmlhttp, event) }, false);
+                xmlhttp.addEventListener("load",  function handler(event) { util.trapErrors(params.onload  || params.callback, params, xmlhttp, event); }, false);
+                xmlhttp.addEventListener("error", function handler(event) { util.trapErrors(params.onerror || params.callback, params, xmlhttp, event); }, false);
             }
 
-
             if (isObject(params.params)) {
                 let data = [encodeURIComponent(k) + "=" + encodeURIComponent(v)
                             for ([k, v] in iter(params.params))];
@@ -882,7 +881,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
                     let (viewer = docShells.getNext().QueryInterface(Ci.nsIDocShell).contentViewer) {
                         if (viewer)
                             yield viewer.DOMDocument;
-                    }
+                    };
             }
         }
     },
@@ -1017,7 +1016,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
             }
             let keyIter = object;
             if ("__iterator__" in object && !callable(object.__iterator__))
-                keyIter = keys(object)
+                keyIter = keys(object);
 
             for (let i in keyIter) {
                 let value = Magic("<no value>");
@@ -1097,28 +1096,28 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
                 if (data.length == 0)
                     res.push("[]");
                 else {
-                    res.push("[\n")
+                    res.push("[\n");
                     for (let [i, val] in Iterator(data)) {
                         if (i)
                             res.push(",\n");
-                        res.push(prefix)
+                        res.push(prefix);
                         rec(val, prefix, seen);
                     }
                     res.push("\n", level, "]");
                 }
             }
             else if (isObject(data)) {
-                res.push("{\n")
+                res.push("{\n");
 
                 let i = 0;
                 for (let [key, val] in Iterator(data)) {
                     if (i++)
                         res.push(",\n");
-                    res.push(prefix, JSON.stringify(key), ": ")
+                    res.push(prefix, JSON.stringify(key), ": ");
                     rec(val, prefix, seen);
                 }
                 if (i > 0)
-                    res.push("\n", level, "}")
+                    res.push("\n", level, "}");
                 else
                     res[res.length - 1] = "{}";
             }
@@ -1623,11 +1622,11 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
      * @param {function} func The function to call
      * @param {object} self The 'this' object for the function.
      */
-    trapErrors: function trapErrors(func, self) {
+    trapErrors: function trapErrors(func, self, ...args) {
         try {
             if (!callable(func))
                 func = self[func];
-            return func.apply(self || this, Array.slice(arguments, 2));
+            return func.apply(self || this, args);
         }
         catch (e) {
             this.reportError(e);
@@ -1709,9 +1708,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
      * @param {object} self The 'this' object of the method.
      * @param ... Arguments to pass to *meth*.
      */
-    withProperErrors: function withProperErrors(meth, self) {
+    withProperErrors: function withProperErrors(meth, self, ...args) {
         try {
-            return (callable(meth) ? meth : self[meth]).apply(self, Array.slice(arguments, withProperErrors.length));
+            return (callable(meth) ? meth : self[meth]).apply(self, args);
         }
         catch (e) {
             throw e.stack ? e : Error(e);
@@ -1721,7 +1720,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
     Array: array
 });
 
-
 /**
  * Math utility methods.
  * @singleton
@@ -1743,4 +1741,4 @@ endModule();
 
 } catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
index 5f7bda5a4b50d4462a2399f9615c09a1860ddf1c..d738da635b1cfb630e5be285e2384e7d26c94f0b 100644 (file)
@@ -40,7 +40,6 @@ function assertMessage(funcName, want, got, message) {
  * @param {MozMillController} controller The browser's MozMill controller.
  */
 function Controller(controller) {
-    var self = this;
     this.controller = controller;
 
     /**
@@ -51,13 +50,13 @@ function Controller(controller) {
 
     this.errorCount = 0;
 
-    this._countBeep = function countBeep() {
-        self.beepCount++;
+    this._countBeep = () => {
+        this.beepCount++;
     }
     this.errors = [];
-    this._countError = function countError(message, highlight) {
+    this._countError = (message, highlight) => {
         if (/\b(Error|Warning)Msg\b/.test(highlight))
-            self.errors.push(String(message));
+            this.errors.push(String(message));
     }
     this.modules.dactyl.registerObserver("beep", this._countBeep);
     this.modules.dactyl.registerObserver("echoLine", this._countError);
@@ -251,8 +250,7 @@ Controller.prototype = {
      * @param {string} message The message to display upon assertion failure. @optional
      */
     wrapAssertNoErrors: function (func, message) {
-        let self = this;
-        return function wrapped() self.assertNoErrors(func, this, arguments, message);
+        return () => this.assertNoErrors(func, this, arguments, message);
     },
 
     /**
@@ -391,10 +389,10 @@ Controller.prototype = {
      * @param {...} Extra arguments are passed to the completion
      *     function directly.
      */
-    testCompleter: wrapAssertNoErrors(function testCompleter(self, func, string, message) {
+    testCompleter: wrapAssertNoErrors(function testCompleter(self, func, string, message, ...args) {
         var context = this.modules.CompletionContext(string || "");
         context.tabPressed = true;
-        context.forkapply("completions", 0, self, func, Array.slice(arguments, testCompleter.length));
+        context.forkapply("completions", 0, self, func, args);
 
         utils.assert("dactyl.runCompletions", context.wait(5000),
                      message || "Completion failed: " + self + "." + func);
index 2f986259556b4c1d8333ab7b49dd262bbd444093..3382cd98b1dd2136a3d37adacc20d78bb4541be9 100644 (file)
@@ -985,9 +985,9 @@ function _runCommands(cmdName, testName, commands) {
     });
 }
 
-function runTest(message, test) {
+function runTest(message, test, ...args) {
     if (test)
-        var res = test.apply(null, Array.slice(arguments, runTest.length));
+        var res = test.apply(null, args);
     if (res !== undefined)
         jumlib.assert(res, message);
 }
index 273a80cd5dc91f59364a4f1fbba20fe620221a0e..20a12983e84cff4d0d743bbb6e896e2906573e00 100644 (file)
@@ -324,4 +324,4 @@ const Config = Module("config", ConfigBase, {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 95f165921e2f6cc454aa94c8031c5e35d54f2726..5ab691ebd72625f7802ce6c9394b40d6fa56b3e5 100644 (file)
@@ -61,4 +61,4 @@ const Library = Module("library", {
 }, {
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 8a7bab2979e9aea989c2a2f9fe96ecf4f4741cd5..96e97a04254fdc8587b63282e0f6d7afeace4eef 100644 (file)
@@ -715,7 +715,7 @@ const Player = Module("player", {
 
         mappings.add([modes.PLAYER],
             ["z"], "Previous track",
-            function (args) { ex.playerprev({ "#": args.count }); },
+            function ({ count }) { ex.playerprev({ "#": count }); },
             { count: true });
 
         mappings.add([modes.PLAYER],
@@ -724,7 +724,7 @@ const Player = Module("player", {
 
         mappings.add([modes.PLAYER],
             ["b"], "Next track",
-            function (args) { ex.playernext({ "#": args.count }); },
+            function ({ count }) { ex.playernext({ "#": count }); },
             { count: true });
 
         mappings.add([modes.PLAYER],
@@ -753,22 +753,22 @@ const Player = Module("player", {
 
         mappings.add([modes.PLAYER],
             ["h", "<Left>"], "Seek -10s",
-            function (args) { player.seekBackward(Math.max(1, args.count) * 10000); },
+            function ({ count} ) { player.seekBackward(Math.max(1, count) * 10000); },
             { count: true });
 
         mappings.add([modes.PLAYER],
             ["l", "<Right>"], "Seek +10s",
-            function (args) { player.seekForward(Math.max(1, args.count) * 10000); },
+            function ({ count} ) { player.seekForward(Math.max(1, count) * 10000); },
             { count: true });
 
         mappings.add([modes.PLAYER],
             ["H", "<S-Left>"], "Seek -1m",
-            function (args) { player.seekBackward(Math.max(1, args.count) * 60000); },
+            function ({ count }) { player.seekBackward(Math.max(1, count) * 60000); },
             { count: true });
 
         mappings.add([modes.PLAYER],
             ["L", "<S-Right>"], "Seek +1m",
-            function (args) { player.seekForward(Math.max(1, args.count) * 60000); },
+            function ({ count }) { player.seekForward(Math.max(1, count) * 60000); },
             { count: true });
 
         mappings.add([modes.PLAYER],
@@ -830,4 +830,4 @@ const Player = Module("player", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 8c10f837e3f352f252d88136b3bf5c2d7648700d..183f6d103999f489740ed12869f14a1d53f3e66c 100644 (file)
@@ -79,16 +79,6 @@ var Config = Module("config", ConfigBase, {
                 else
                     dactyl.beep();
             }
-        },
-
-        get tempFile() {
-            let prefix = this.name;
-            try {
-                prefix += "-" + window.content.document.location.hostname;
-            }
-            catch (e) {}
-
-            return prefix + ".txt";
         }
     })
 
@@ -221,7 +211,8 @@ var Config = Module("config", ConfigBase, {
         completion.sidebar = function sidebar(context) {
             let menu = document.getElementById("viewSidebarMenu");
             context.title = ["Sidebar Panel"];
-            context.completions = Array.map(menu.childNodes, function (n) [n.getAttribute("label"), ""]);
+            context.completions = Array.filter(menu.childNodes, function (n) n.hasAttribute("label"))
+                                       .map(function (n) [n.getAttribute("label"), ""]);
         };
     },
     events: function initEvents(dactyl, modules, window) {
@@ -252,4 +243,4 @@ var Config = Module("config", ConfigBase, {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 51305ac3a51544220579f54006f41d084d2af6b0..45fb55351cc724ae7b306b12356eb13e7487a92a 100644 (file)
@@ -31,8 +31,8 @@
         <em:targetApplication>
             <Description
                 em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
-                em:minVersion="8.0"
-                em:maxVersion="22.0a1"/>
+                em:minVersion="22.0"
+                em:maxVersion="24.*"/>
         </em:targetApplication>
     </Description>
 </RDF>
index cd9fe12a91ef0da17b206fc5d752d5268f8126d9..6171b4132778f65622090425145b7e070f276c79 100644 (file)
@@ -152,4 +152,4 @@ var Addressbook = Module("addressbook", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 33c5f23919d7fcc8158920e2ae45863dad8143a9..fd883339370bd59d402ee743542c13e509f3cb1c 100644 (file)
@@ -80,4 +80,4 @@ var Compose = Module("compose", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index 0fae1d292864d6bfdb329063630d936d0c9d788b..72215c8610feccc66c60956cbf6a36f822eaf16c 100644 (file)
@@ -116,10 +116,7 @@ var Config = Module("config", ConfigBase, {
                     modes.main = modes.MESSAGE;
             }
         }
-    },
-
-    // to allow Vim to :set ft=mail automatically
-    tempFile: "teledactyl.eml"
+    }
 }, {
 }, {
     commands: function initCommands(dactyl, modules, window) {
@@ -165,4 +162,4 @@ var Config = Module("config", ConfigBase, {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
index cdfe22d4b6ad4ba6d4b138945673281d6fedb6ce..9c4502ddad9fa02786b2e8a16813b522ec3a55f8 100644 (file)
@@ -518,47 +518,47 @@ var Mail = Module("mail", {
 
         mappings.add(myModes, ["j", "<Right>"],
             "Select next message",
-            function (args) { mail.selectMessage(function (msg) true, false, false, false, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) true, false, false, false, count); },
             { count: true });
 
         mappings.add(myModes, ["gj"],
             "Select next message, including closed threads",
-            function (args) { mail.selectMessage(function (msg) true, false, true, false, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) true, false, true, false, count); },
             { count: true });
 
         mappings.add(myModes, ["J", "<Tab>"],
             "Select next unread message",
-            function (args) { mail.selectMessage(function (msg) !msg.isRead, true, true, false, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) !msg.isRead, true, true, false, count); },
             { count: true });
 
         mappings.add(myModes, ["k", "<Left>"],
             "Select previous message",
-            function (args) { mail.selectMessage(function (msg) true, false, false, true, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) true, false, false, true, count); },
             { count: true });
 
         mappings.add(myModes, ["gk"],
             "Select previous message",
-            function (args) { mail.selectMessage(function (msg) true, false, true, true, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) true, false, true, true, count); },
             { count: true });
 
         mappings.add(myModes, ["K"],
             "Select previous unread message",
-            function (args) { mail.selectMessage(function (msg) !msg.isRead, true, true, true, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) !msg.isRead, true, true, true, count); },
             { count: true });
 
         mappings.add(myModes, ["*"],
             "Select next message from the same sender",
-            function (args) {
+            function ({ count }) {
                 let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
-                mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, false, args.count);
+                mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, false, count);
             },
             { count: true });
 
         mappings.add(myModes, ["#"],
             "Select previous message from the same sender",
-            function (args) {
+            function ({ count }) {
                 let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
-                mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, true, args.count);
+                mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, true, count);
             },
             { count: true });
 
@@ -593,22 +593,22 @@ var Mail = Module("mail", {
         // SCROLLING
         mappings.add(myModes, ["<Down>"],
             "Scroll message down",
-            function (args) { buffer.scrollLines(Math.max(args.count, 1)); },
+            function ({ count }) { buffer.scrollLines(Math.max(count, 1)); },
             { count: true });
 
         mappings.add(myModes, ["<Up>"],
             "Scroll message up",
-            function (args) { buffer.scrollLines(-Math.max(args.count, 1)); },
+            function ({ count }) { buffer.scrollLines(-Math.max(count, 1)); },
             { count: true });
 
         mappings.add([modes.MESSAGE], ["<Left>"],
             "Select previous message",
-            function (args) { mail.selectMessage(function (msg) true, false, false, true, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) true, false, false, true, count); },
             { count: true });
 
         mappings.add([modes.MESSAGE], ["<Right>"],
             "Select next message",
-            function (args) { mail.selectMessage(function (msg) true, false, false, false, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) true, false, false, false, count); },
             { count: true });
 
         // UNDO/REDO
@@ -657,29 +657,29 @@ var Mail = Module("mail", {
 
         mappings.add(myModes, ["]s"],
             "Select next starred message",
-            function (args) { mail.selectMessage(function (msg) msg.isFlagged, true, true, false, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) msg.isFlagged, true, true, false, count); },
             { count: true });
 
         mappings.add(myModes, ["[s"],
             "Select previous starred message",
-            function (args) { mail.selectMessage(function (msg) msg.isFlagged, true, true, true, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) msg.isFlagged, true, true, true, count); },
             { count: true });
 
         mappings.add(myModes, ["]a"],
             "Select next message with an attachment",
-            function (args) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, false, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, false, count); },
             { count: true });
 
         mappings.add(myModes, ["[a"],
             "Select previous message with an attachment",
-            function (args) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, true, args.count); },
+            function ({ count }) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, true, count); },
             { count: true });
 
         // FOLDER SWITCHING
         mappings.add(myModes, ["gi"],
             "Go to inbox",
-            function (args) {
-                let folder = mail.getFolders("Inbox", false, true)[(args.count > 0) ? (args.count - 1) : 0];
+            function ({ count }) {
+                let folder = mail.getFolders("Inbox", false, true)[(count > 0) ? (count - 1) : 0];
                 if (folder)
                     SelectFolder(folder.URI);
                 else
@@ -689,8 +689,8 @@ var Mail = Module("mail", {
 
         mappings.add(myModes, ["<C-n>"],
             "Select next folder",
-            function (args) {
-                let newPos = mail._getCurrentFolderIndex() + Math.max(1, args.count);
+            function ({ count }) {
+                let newPos = mail._getCurrentFolderIndex() + Math.max(1, count);
                 if (newPos >= gFolderTreeView.rowCount) {
                     newPos = newPos % gFolderTreeView.rowCount;
                     commandline.echo(_("finder.atBottom"), commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES);
@@ -701,15 +701,15 @@ var Mail = Module("mail", {
 
         mappings.add(myModes, ["<C-N>"],
             "Go to next mailbox with unread messages",
-            function (args) {
-                mail._selectUnreadFolder(false, args.count);
+            function ({ count }) {
+                mail._selectUnreadFolder(false, count);
             },
             { count: true });
 
         mappings.add(myModes, ["<C-p>"],
             "Select previous folder",
-            function (args) {
-                let newPos = mail._getCurrentFolderIndex() - Math.max(1, args.count);
+            function ({ count }) {
+                let newPos = mail._getCurrentFolderIndex() - Math.max(1, count);
                 if (newPos < 0) {
                     newPos = (newPos % gFolderTreeView.rowCount) + gFolderTreeView.rowCount;
                     commandline.echo(_("finder.atTop"), commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES);
@@ -720,8 +720,8 @@ var Mail = Module("mail", {
 
         mappings.add(myModes, ["<C-P>"],
             "Go to previous mailbox with unread messages",
-            function (args) {
-                mail._selectUnreadFolder(true, args.count);
+            function ({ count }) {
+                mail._selectUnreadFolder(true, count);
             },
             { count: true });
 
@@ -769,7 +769,7 @@ var Mail = Module("mail", {
         // tagging messages
         mappings.add(myModes, ["l"],
             "Label message",
-            function (arg) {
+            function ({ arg }) {
                 if (!GetSelectedMessages())
                     return void dactyl.beep();
 
@@ -930,4 +930,4 @@ var Mail = Module("mail", {
     }
 });
 
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et: