diff --git a/common/bootstrap.js b/common/bootstrap.js index 837a2f39..d55734af 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -175,11 +175,11 @@ function init() { reportError(e); } - if (JSMLoader && JSMLoader.bump != 3) // Temporary hack + if (JSMLoader && JSMLoader.bump !== 4) // Temporary hack Services.scriptloader.loadSubScript("resource://dactyl" + suffix + "/bootstrap.jsm", Cu.import("resource://dactyl/bootstrap.jsm", global)); - if (!JSMLoader || JSMLoader.bump != 3) + if (!JSMLoader || JSMLoader.bump !== 4) Cu.import("resource://dactyl/bootstrap.jsm", global); JSMLoader.load("resource://dactyl/bootstrap.jsm", global); diff --git a/common/content/buffer.js b/common/content/buffer.js index c919b517..1827d00c 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1594,13 +1594,21 @@ var Buffer = Module("buffer", { }); context.pushProcessor(0, function (item, text, next) <> - {item.item.indicator} + {item.indicator} { next.call(this, item, text) } ); context.process[1] = function (item, text) template.bookmarkDescription(item, template.highlightFilter(text, this.filter)); context.anchored = false; - context.keys = { text: "text", description: "url", icon: "icon", id: "id", command: function () "tabs.select" }; + context.keys = { + text: "text", + description: "url", + indicator: function (item) item.tab === tabs.getTab() ? "%" : + item.tab === tabs.alternate ? "#" : " ", + icon: "icon", + id: "id", + command: function () "tabs.select" + }; context.compare = CompletionContext.Sort.number; context.filters = [CompletionContext.Filter.textDescription]; @@ -1621,9 +1629,9 @@ var Buffer = Module("buffer", { return { text: [i + ": " + (tab.label || "(Untitled)"), i + ": " + url], + tab: tab, id: i - 1, url: url, - indicator: indicator, icon: tab.image || DEFAULT_FAVICON }; }); diff --git a/common/content/tabs.js b/common/content/tabs.js index 9bae7af0..47a14424 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -456,8 +456,8 @@ var Tabs = Module("tabs", { if (buffer == "#") return tabs.selectAlternateTab(); - count = Math.max(1, count || 1); reverse = Boolean(reverse); + count = Math.max(1, count || 1) * (1 + -2 * reverse); let matches = buffer.match(/^(\d+):?/); if (matches) @@ -467,17 +467,21 @@ var Tabs = Module("tabs", { if (matches) return tabs.select(matches, false); - matches = completion.runCompleter("buffer", buffer); + matches = completion.runCompleter("buffer", buffer).map(function (obj) obj.tab); if (matches.length == 0) dactyl.echoerr("E94: No matching buffer for " + buffer); else if (matches.length > 1 && !allowNonUnique) dactyl.echoerr("E93: More than one match for " + buffer); else { - let index = (count - 1) % matches.length; - if (reverse) - index = matches.length - index - 1; - tabs.select(matches[index].id, false); + let start = matches.indexOf(tabs.getTab()); + if (start == -1 && reverse) + start++; + + let index = (start + count) % matches.length; + if (index < 0) + index = matches.length + index; + tabs.select(matches[index], false); } }, diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 614b0aa7..d91b41dd 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -676,7 +676,8 @@ function Class() { return res !== undefined ? res : self; })]]>, "constructor", (name || superclass.className).replace(/\W/g, "_")) - .replace("PARAMS", /^function .*?\((.*?)\)/.exec(args[0] && args[0].init || Class.prototype.init)[1])); + .replace("PARAMS", /^function .*?\((.*?)\)/.exec(args[0] && args[0].init || Class.prototype.init)[1] + .replace(/\b(self|res|Constructor)\b/g, "$1_"))); Constructor.className = name || superclass.className || superclass.name; diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm index 1d2a3110..45f065c7 100644 --- a/common/modules/bootstrap.jsm +++ b/common/modules/bootstrap.jsm @@ -14,9 +14,9 @@ var storage = Components.classes["@mozilla.org/fuel/application;1"] var JSMLoader = storage.get("dactyl.JSMLoader", undefined); -if (!JSMLoader || JSMLoader.bump != 3) +if (!JSMLoader || JSMLoader.bump != 4) JSMLoader = { - bump: 3, + bump: 4, builtin: Components.utils.Sandbox(this), canonical: {}, factories: [], @@ -33,7 +33,7 @@ if (!JSMLoader || JSMLoader.bump != 3) this.storage.set("dactyl.JSMLoader", this); - let base = JSMLoader.load("base.jsm", global); + let base = this.load("base.jsm", global); global.EXPORTED_SYMBOLS = base.EXPORTED_SYMBOLS; global.JSMLoader = this; base.JSMLoader = this; diff --git a/common/modules/config.jsm b/common/modules/config.jsm index ea88bbc1..91a2e686 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -754,6 +754,6 @@ config.INIT = update(Object.create(config.INIT), config.INIT, { endModule(); -} catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); } +} 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: diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index 26837d54..8302de3b 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -497,10 +497,13 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef case "list": modules.commandline.commandOutput(template.tabular( - ["Host", "Session", "Path", "Value"], ["padding-right: 1em", "padding-right: 1em", "padding-right: 1em"], + ["Host", "Expiry (UTC)", "Path", "Name", "Value"], + ["padding-right: 1em", "padding-right: 1em", "padding-right: 1em", "max-width: 12em; overflow: hidden;", "padding-left: 1ex;"], ([c.host, - {c.isSession ? "session" : "persistent"}, + c.isSession ? session + : (new Date(c.expiry * 1000).toJSON() || "Never").replace(/:\d\d\.000Z/, "").replace("T", " ").replace(/-/g, "/"), c.path, + c.name, c.value] for (c in Sanitizer.iterCookies(host))))); return;