1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-04-24 16:21:24 +02:00

Replace expression closures (getters).

Expression closures are to be axed. See https://bugzil.la/1083458.
This commit is contained in:
Doug Kearns
2015-05-27 04:42:30 +10:00
parent ce82387cdd
commit 6e8040286a
48 changed files with 808 additions and 532 deletions
+4 -4
View File
@@ -69,15 +69,15 @@ let JSMLoader = {
SANDBOX: Cu.nukeSandbox, SANDBOX: Cu.nukeSandbox,
get addon() addon, get addon() { return addon; },
currentModule: null, currentModule: null,
factories: [], factories: [],
get name() name, get name() { return name; },
get module() moduleName, get module() { return moduleName; },
globals: {}, globals: {},
modules: {}, modules: {},
@@ -192,7 +192,7 @@ let JSMLoader = {
}, },
// Cuts down on stupid, fscking url mangling. // Cuts down on stupid, fscking url mangling.
get loadSubScript() bootstrap_jsm.loadSubScript, get loadSubScript() { return bootstrap_jsm.loadSubScript; },
cleanup: function cleanup() { cleanup: function cleanup() {
for (let factory of this.factories.splice(0)) for (let factory of this.factories.splice(0))
+5 -1
View File
@@ -82,7 +82,11 @@ CommandLineHandler.prototype = {
} }
}, },
get helpInfo() " -" + config.name + " <opts>" + " Additional options for " + config.appName + " startup\n".substr(config.name.length) get helpInfo() {
return " -" + config.name + " <opts>" +
" Additional options for " +
config.appName + " startup\n".substr(config.name.length);
}
}; };
if (XPCOMUtils.generateNSGetFactory) if (XPCOMUtils.generateNSGetFactory)
+4 -4
View File
@@ -88,7 +88,7 @@ var Abbreviation = Class("Abbreviation", {
* @property {string} The mode display characters associated with the * @property {string} The mode display characters associated with the
* supported mode combination. * supported mode combination.
*/ */
get modeChar() Abbreviation.modeChar(this.modes) get modeChar() { return Abbreviation.modeChar(this.modes); }
}, { }, {
modeChar: function (_modes) { modeChar: function (_modes) {
let result = Ary.uniq(_modes.map(m => m.char)).join(""); let result = Ary.uniq(_modes.map(m => m.char)).join("");
@@ -105,7 +105,7 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, {
}, },
/** @property {boolean} True if there are no abbreviations. */ /** @property {boolean} True if there are no abbreviations. */
get empty() !values(this._store).find(util.identity), get empty() { return !values(this._store).find(util.identity); },
/** /**
* Adds a new abbreviation. * Adds a new abbreviation.
@@ -229,9 +229,9 @@ var Abbreviations = Module("abbreviations", {
*/$), "x", params); */$), "x", params);
}, },
get allHives() contexts.allGroups.abbrevs, get allHives() { return contexts.allGroups.abbrevs; },
get userHives() this.allHives.filter(h => h !== this.builtin), get userHives() { return this.allHives.filter(h => h !== this.builtin); },
get: deprecated("group.abbrevs.get", { get: function get() this.user.bound.get }), get: deprecated("group.abbrevs.get", { get: function get() this.user.bound.get }),
set: deprecated("group.abbrevs.set", { get: function set() this.user.bound.set }), set: deprecated("group.abbrevs.set", { get: function set() this.user.bound.set }),
+3 -1
View File
@@ -70,7 +70,9 @@ var AutoCmdHive = Class("AutoCmdHive", Contexts.Hive, {
* @instance autocommands * @instance autocommands
*/ */
var AutoCommands = Module("autocommands", { var AutoCommands = Module("autocommands", {
get activeHives() contexts.allGroups.autocmd.filter(h => h._store.length), get activeHives() {
return contexts.allGroups.autocmd.filter(h => h._store.length);
},
add: deprecated("group.autocmd.add", { get: function add() autocommands.user.bound.add }), add: deprecated("group.autocmd.add", { get: function add() autocommands.user.bound.add }),
get: deprecated("group.autocmd.get", { get: function get() autocommands.user.bound.get }), get: deprecated("group.autocmd.get", { get: function get() autocommands.user.bound.get }),
+8 -6
View File
@@ -33,12 +33,14 @@ var Bookmarks = Module("bookmarks", {
} }
}, },
get format() ({ get format() {
anchored: false, return {
title: ["URL", "Info"], anchored: false,
keys: { text: "url", description: "title", icon: "icon", extra: "extra", tags: "tags", isURI: function () true }, title: ["URL", "Info"],
process: [template.icon, template.bookmarkDescription] keys: { text: "url", description: "title", icon: "icon", extra: "extra", tags: "tags", isURI: function () true },
}), process: [template.icon, template.bookmarkDescription]
};
},
// TODO: why is this a filter? --djk // TODO: why is this a filter? --djk
get: function get(filter, tags, maxItems, extra) { get: function get(filter, tags, maxItems, extra) {
+1 -1
View File
@@ -18,7 +18,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
util.addObserver(this); util.addObserver(this);
this._unoverlay = overlay.overlayObject(FullZoom, { this._unoverlay = overlay.overlayObject(FullZoom, {
get siteSpecific() false, get siteSpecific() { return false; },
set siteSpecific(val) {} set siteSpecific(val) {}
}); });
+79 -66
View File
@@ -324,12 +324,12 @@ var CommandMode = Class("CommandMode", {
this.keepCommand = userContext.hidden_option_command_afterimage; this.keepCommand = userContext.hidden_option_command_afterimage;
}, },
get autocomplete() options["autocomplete"].length, get autocomplete() { return options["autocomplete"].length; },
get command() this.widgets.command[1], get command() { return this.widgets.command[1]; },
set command(val) this.widgets.command = val, set command(val) { this.widgets.command = val; },
get prompt() this._open ? this.widgets.prompt : this._prompt, get prompt() { return this._open ? this.widgets.prompt : this._prompt; },
set prompt(val) { set prompt(val) {
if (this._open) if (this._open)
this.widgets.prompt = val; this.widgets.prompt = val;
@@ -362,13 +362,13 @@ var CommandMode = Class("CommandMode", {
this.completions.autocompleteTimer.flush(true); this.completions.autocompleteTimer.flush(true);
}, },
get active() this === commandline.commandSession, get active() { return this === commandline.commandSession; },
get holdFocus() this.widgets.active.command.inputField, get holdFocus() { return this.widgets.active.command.inputField; },
get mappingSelf() this, get mappingSelf() { return this; },
get widgets() commandline.widgets, get widgets() { return commandline.widgets; },
enter: function CM_enter(stack) { enter: function CM_enter(stack) {
commandline.commandSession = this; commandline.commandSession = this;
@@ -453,7 +453,7 @@ var CommandMode = Class("CommandMode", {
var CommandExMode = Class("CommandExMode", CommandMode, { var CommandExMode = Class("CommandExMode", CommandMode, {
get mode() modes.EX, get mode() { return modes.EX; },
historyKey: "command", historyKey: "command",
@@ -492,7 +492,7 @@ var CommandPromptMode = Class("CommandPromptMode", CommandMode, {
context.forkapply("prompt", 0, this, "completer", args); context.forkapply("prompt", 0, this, "completer", args);
}, },
get mode() modes.PROMPT get mode() { return modes.PROMPT; }
}); });
/** /**
@@ -528,7 +528,7 @@ var CommandLine = Module("commandline", {
return this._messages; return this._messages;
}, },
get length() this._messages.length, get length() { return this._messages.length; },
clear: function clear() { clear: function clear() {
this._messages = []; this._messages = [];
@@ -563,7 +563,7 @@ var CommandLine = Module("commandline", {
* *
* @returns {boolean} * @returns {boolean}
*/ */
get commandVisible() !!this.commandSession, get commandVisible() { return !!this.commandSession; },
/** /**
* Ensure that the multiline input widget is the correct size. * Ensure that the multiline input widget is the correct size.
@@ -591,17 +591,17 @@ var CommandLine = Module("commandline", {
APPEND_TO_MESSAGES : 1 << 3, // Add the string to the message history. APPEND_TO_MESSAGES : 1 << 3, // Add the string to the message history.
ACTIVE_WINDOW : 1 << 4, // Only echo in active window. ACTIVE_WINDOW : 1 << 4, // Only echo in active window.
get completionContext() this._completions.context, get completionContext() { return this._completions.context; },
_silent: false, _silent: false,
get silent() this._silent, get silent() { return this._silent; },
set silent(val) { set silent(val) {
this._silent = val; this._silent = val;
this.quiet = this.quiet; this.quiet = this.quiet;
}, },
_quite: false, _quite: false,
get quiet() this._quiet, get quiet() { return this._quiet; },
set quiet(val) { set quiet(val) {
this._quiet = val; this._quiet = val;
["commandbar", "statusbar"].forEach(function (nodeSet) { ["commandbar", "statusbar"].forEach(function (nodeSet) {
@@ -736,7 +736,7 @@ var CommandLine = Module("commandline", {
}, },
_hiddenMessages: 0, _hiddenMessages: 0,
get hiddenMessages() this._hiddenMessages, get hiddenMessages() { return this._hiddenMessages; },
set hiddenMessages(val) { set hiddenMessages(val) {
this._hiddenMessages = val; this._hiddenMessages = val;
if (val) if (val)
@@ -917,7 +917,10 @@ var CommandLine = Module("commandline", {
}); });
}, },
get commandMode() this.commandSession && isinstance(modes.main, modes.COMMAND_LINE), get commandMode() {
return this.commandSession &&
isinstance(modes.main, modes.COMMAND_LINE);
},
events: update( events: update(
iter(CommandMode.prototype.events).map( iter(CommandMode.prototype.events).map(
@@ -938,7 +941,7 @@ var CommandLine = Module("commandline", {
} }
), ),
get mowEvents() mow.events, get mowEvents() { return mow.events; },
/** /**
* Multiline input events, they will come straight from * Multiline input events, they will come straight from
@@ -989,7 +992,7 @@ var CommandLine = Module("commandline", {
this.reset(); this.reset();
this.session = session; this.session = session;
}, },
get store() commandline._store.get(this.mode, []), get store() { return commandline._store.get(this.mode, []); },
set store(ary) { commandline._store.set(this.mode, ary); }, set store(ary) { commandline._store.set(this.mode, ary); },
/** /**
* Reset the history index to the first entry. * Reset the history index to the first entry.
@@ -1165,8 +1168,10 @@ var CommandLine = Module("commandline", {
this.tabTimer.tell(event); this.tabTimer.tell(event);
}, },
get activeContexts() this.context.contextList get activeContexts() {
.filter(c => c.items.length || c.incomplete), return this.context.contextList
.filter(c => c.items.length || c.incomplete);
},
/** /**
* Returns the current completion string relative to the * Returns the current completion string relative to the
@@ -1226,7 +1231,7 @@ var CommandLine = Module("commandline", {
+ this.originalValue.substr(this.originalCaret); + this.originalValue.substr(this.originalCaret);
}, },
get selected() this.itemList.selected, get selected() { return this.itemList.selected; },
set selected(tuple) { set selected(tuple) {
if (!Ary.equals(tuple || [], if (!Ary.equals(tuple || [],
this.itemList.selected || [])) this.itemList.selected || []))
@@ -1240,18 +1245,20 @@ var CommandLine = Module("commandline", {
} }
}, },
get caret() this.editor.selection.getRangeAt(0).startOffset, get caret() {
return this.editor.selection.getRangeAt(0).startOffset;
},
set caret(offset) { set caret(offset) {
this.editor.selection.collapse(this.editor.rootElement.firstChild, offset); this.editor.selection.collapse(this.editor.rootElement.firstChild, offset);
}, },
get start() this.context.allItems.start, get start() { return this.context.allItems.start; },
get items() this.context.allItems.items, get items() { return this.context.allItems.items; },
get substring() this.context.longestAllSubstring, get substring() { return this.context.longestAllSubstring; },
get wildtype() this.wildtypes[this.wildIndex] || "", get wildtype() { return this.wildtypes[this.wildIndex] || ""; },
/** /**
* Cleanup resources used by this completion session. This * Cleanup resources used by this completion session. This
@@ -1726,7 +1733,7 @@ var CommandLine = Module("commandline", {
description: "Active when the command line is focused", description: "Active when the command line is focused",
insert: true, insert: true,
ownsFocus: true, ownsFocus: true,
get mappingSelf() commandline.commandSession get mappingSelf() { return commandline.commandSession; }
}); });
// this._extended modes, can include multiple modes, and even main modes // this._extended modes, can include multiple modes, and even main modes
modes.addMode("EX", { modes.addMode("EX", {
@@ -1961,28 +1968,33 @@ var ItemList = Class("ItemList", {
DOM(this.win).resize(this._onResize.bound.tell); DOM(this.win).resize(this._onResize.bound.tell);
}, },
get rootXML() get rootXML() {
["div", { highlight: "Normal", style: "white-space: nowrap", key: "root" }, return ["div", { highlight: "Normal", style: "white-space: nowrap", key: "root" },
["div", { key: "wrapper" }, ["div", { key: "wrapper" },
["div", { highlight: "Completions", key: "noCompletions" }, ["div", { highlight: "Completions", key: "noCompletions" },
["span", { highlight: "Title" }, ["span", { highlight: "Title" },
_("completion.noCompletions")]], _("completion.noCompletions")]],
["div", { key: "completions" }]], ["div", { key: "completions" }]],
["div", { highlight: "Completions" }, ["div", { highlight: "Completions" },
template.map(util.range(0, options["maxitems"] * 2), i => template.map(util.range(0, options["maxitems"] * 2), i =>
["div", { highlight: "CompItem NonText" }, ["div", { highlight: "CompItem NonText" },
"~"])]], "~"])]];
},
get itemCount() this.context.contextList get itemCount() {
.reduce((acc, ctxt) => acc + ctxt.items.length, 0), return this.context.contextList
.reduce((acc, ctxt) => acc + ctxt.items.length, 0);
},
get visible() !this.container.collapsed, get visible() { return !this.container.collapsed; },
set visible(val) this.container.collapsed = !val, set visible(val) { this.container.collapsed = !val; },
get activeGroups() this.context.contextList get activeGroups() {
.filter(c => c.items.length || c.message || c.incomplete) return this.context.contextList
.map(this.getGroup, this), .filter(c => c.items.length || c.message || c.incomplete)
.map(this.getGroup, this);
},
get selected() { get selected() {
let g = this.selectedGroup; let g = this.selectedGroup;
@@ -2307,26 +2319,27 @@ var ItemList = Class("ItemList", {
this.range = ItemList.Range(0, 0); this.range = ItemList.Range(0, 0);
}, },
get rootXML() get rootXML() {
["div", { key: "root", highlight: "CompGroup" }, return ["div", { key: "root", highlight: "CompGroup" },
["div", { highlight: "Completions" }, ["div", { highlight: "Completions" },
this.context.createRow(this.context.title || [], "CompTitle")], this.context.createRow(this.context.title || [], "CompTitle")],
["div", { highlight: "CompTitleSep" }], ["div", { highlight: "CompTitleSep" }],
["div", { key: "contents" }, ["div", { key: "contents" },
["div", { key: "up", highlight: "CompLess" }], ["div", { key: "up", highlight: "CompLess" }],
["div", { key: "message", highlight: "CompMsg" }, ["div", { key: "message", highlight: "CompMsg" },
this.context.message || []], this.context.message || []],
["div", { key: "itemsContainer", class: "completion-items-container" }, ["div", { key: "itemsContainer", class: "completion-items-container" },
["div", { key: "items", highlight: "Completions" }]], ["div", { key: "items", highlight: "Completions" }]],
["div", { key: "waiting", highlight: "CompMsg" }, ["div", { key: "waiting", highlight: "CompMsg" },
ItemList.WAITING_MESSAGE], ItemList.WAITING_MESSAGE],
["div", { key: "down", highlight: "CompMore" }]]], ["div", { key: "down", highlight: "CompMore" }]]];
},
get doc() this.parent.doc, get doc() { return this.parent.doc; },
get win() this.parent.win, get win() { return this.parent.win; },
get maxItems() this.parent.maxItems, get maxItems() { return this.parent.maxItems; },
get itemCount() this.context.items.length, get itemCount() { return this.context.items.length; },
/** /**
* Returns a function which will update the scroll offsets * Returns a function which will update the scroll offsets
@@ -2440,9 +2453,9 @@ var ItemList = Class("ItemList", {
getOffset: function getOffset(idx) this.offsets.start + (idx || 0), getOffset: function getOffset(idx) this.offsets.start + (idx || 0),
get selectedRow() this.getRow(this._selectedIdx), get selectedRow() { return this.getRow(this._selectedIdx); },
get selectedIdx() this._selectedIdx, get selectedIdx() { return this._selectedIdx; },
set selectedIdx(idx) { set selectedIdx(idx) {
if (this.selectedRow && this._selectedIdx != idx) if (this.selectedRow && this._selectedIdx != idx)
DOM(this.selectedRow).attr("selected", null); DOM(this.selectedRow).attr("selected", null);
+12 -8
View File
@@ -152,7 +152,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
return items; return items;
}, },
get menuItems() this.getMenuItems(), get menuItems() { return this.getMenuItems(); },
// Global constants // Global constants
CURRENT_TAB: "here", CURRENT_TAB: "here",
@@ -164,8 +164,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
forcePrivate: null, forcePrivate: null,
forceTarget: null, forceTarget: null,
get forceOpen() ({ background: this.forceBackground, get forceOpen() {
target: this.forceTarget }), return { background: this.forceBackground,
target: this.forceTarget };
},
set forceOpen(val) { set forceOpen(val) {
for (let [k, v] of iter({ background: "forceBackground", target: "forceTarget" })) for (let [k, v] of iter({ background: "forceBackground", target: "forceTarget" }))
if (k in val) if (k in val)
@@ -604,8 +606,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}, },
/** @property {Element} The currently focused element. */ /** @property {Element} The currently focused element. */
get focusedElement() services.focus.getFocusedElementForWindow(window, true, {}), get focusedElement() {
set focusedElement(elem) dactyl.focus(elem), return services.focus.getFocusedElementForWindow(window, true, {});
},
set focusedElement(elem) { dactyl.focus(elem); },
/** /**
* Returns whether this Dactyl extension supports *feature*. * Returns whether this Dactyl extension supports *feature*.
@@ -1067,7 +1071,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
pluginFiles: {}, pluginFiles: {},
get plugins() plugins, get plugins() { return plugins; },
setNodeVisible: function setNodeVisible(node, visible) { setNodeVisible: function setNodeVisible(node, visible) {
if (window.setToolbarVisibility && node.localName == "toolbar") if (window.setToolbarVisibility && node.localName == "toolbar")
@@ -1116,7 +1120,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
services.appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart); services.appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}, },
get assert() util.assert, get assert() { return util.assert; },
/** /**
* Traps errors in the called function, possibly reporting them. * Traps errors in the called function, possibly reporting them.
@@ -1213,7 +1217,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
* @property {[Window]} Returns an array of all the host application's * @property {[Window]} Returns an array of all the host application's
* open windows. * open windows.
*/ */
get windows() [w for (w of overlay.windows)] get windows() { return [w for (w of overlay.windows)]; }
}, { }, {
toolbarHidden: function toolbarHidden(elem) "true" == (elem.getAttribute("autohide") || toolbarHidden: function toolbarHidden(elem) "true" == (elem.getAttribute("autohide") ||
+19 -9
View File
@@ -26,8 +26,14 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
}); });
}, },
get registers() storage.newMap("registers", { privateData: true, store: true }), get registers() {
get registerRing() storage.newArray("register-ring", { privateData: true, store: true }), return storage.newMap("registers",
{ privateData: true, store: true });
},
get registerRing() {
return storage.newArray("register-ring",
{ privateData: true, store: true });
},
skipSave: false, skipSave: false,
@@ -118,10 +124,10 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
} }
}, },
get isCaret() modes.getStack(1).main == modes.CARET, get isCaret() { return modes.getStack(1).main == modes.CARET; },
get isTextEdit() modes.getStack(1).main == modes.TEXT_EDIT, get isTextEdit() { return modes.getStack(1).main == modes.TEXT_EDIT; },
get editor() DOM(this.element).editor, get editor() { return DOM(this.element).editor; },
getController: function getController(cmd) { getController: function getController(cmd) {
let controllers = this.element && this.element.controllers; let controllers = this.element && this.element.controllers;
@@ -130,8 +136,10 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
return controllers.getControllerForCommand(cmd || "cmd_beginLine"); return controllers.getControllerForCommand(cmd || "cmd_beginLine");
}, },
get selection() this.editor && this.editor.selection || null, get selection() { return this.editor && this.editor.selection || null; },
get selectionController() this.editor && this.editor.selectionController || null, get selectionController() {
return this.editor && this.editor.selectionController || null;
},
deselect: function () { deselect: function () {
if (this.selection && this.selection.focusNode) if (this.selection && this.selection.focusNode)
@@ -156,9 +164,11 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
this.selection.addRange(range); this.selection.addRange(range);
}, },
get selectedText() String(this.selection), get selectedText() { return String(this.selection); },
get preserveSelection() this.editor && !this.editor.shouldTxnSetSelection, get preserveSelection() {
return this.editor && !this.editor.shouldTxnSetSelection;
},
set preserveSelection(val) { set preserveSelection(val) {
if (this.editor) if (this.editor)
this.editor.setShouldTxnSetSelection(!val); this.editor.setShouldTxnSetSelection(!val);
+11 -7
View File
@@ -90,7 +90,7 @@ var EventHive = Class("EventHive", Contexts.Hive, {
}); });
}, },
get wrapListener() events.bound.wrapListener get wrapListener() { return events.bound.wrapListener; }
}); });
/** /**
@@ -211,7 +211,7 @@ var Events = Module("events", {
} }
}, },
get listen() this.builtin.bound.listen, get listen() { return this.builtin.bound.listen; },
addSessionListener: deprecated("events.listen", { get: function addSessionListener() this.listen }), addSessionListener: deprecated("events.listen", { get: function addSessionListener() this.listen }),
/** /**
@@ -248,7 +248,7 @@ var Events = Module("events", {
* @param {string} macro The name for the macro. * @param {string} macro The name for the macro.
*/ */
_recording: null, _recording: null,
get recording() this._recording, get recording() { return this._recording; },
set recording(macro) { set recording(macro) {
dactyl.assert(macro == null || /[a-zA-Z0-9]/.test(macro), dactyl.assert(macro == null || /[a-zA-Z0-9]/.test(macro),
@@ -437,7 +437,11 @@ var Events = Module("events", {
return apply(DOM.Event, "stringify", arguments); return apply(DOM.Event, "stringify", arguments);
}, },
get defaultTarget() dactyl.focusedElement || content.document.body || document.documentElement, get defaultTarget() {
return dactyl.focusedElement ||
content.document.body ||
document.documentElement;
},
/** /**
* Returns true if there's a known native key handler for the given * Returns true if there's a known native key handler for the given
@@ -1097,7 +1101,7 @@ var Events = Module("events", {
events._macroKeys.pop(); events._macroKeys.pop();
events.recording = arg; events.recording = arg;
}, },
{ get arg() !modes.recording }); { get arg() { return !modes.recording; }});
mappings.add([modes.COMMAND], mappings.add([modes.COMMAND],
["@", "<play-macro>"], "Play a macro", ["@", "<play-macro>"], "Play a macro",
@@ -1140,7 +1144,7 @@ var Events = Module("events", {
} }
}, },
get active() this.stack.length, get active() { return this.stack.length; },
get: function get(mode, key) this.stack.mappings[key], get: function get(mode, key) this.stack.mappings[key],
@@ -1158,7 +1162,7 @@ var Events = Module("events", {
has: function (key) this.pass.has(key) || hasOwnProperty(this.commandHive.stack.mappings, key), has: function (key) this.pass.has(key) || hasOwnProperty(this.commandHive.stack.mappings, key),
get pass() (this.flush(), this.pass), get pass() { this.flush(); return this.pass; },
parse: function parse() { parse: function parse() {
let value = parse.superapply(this, arguments); let value = parse.superapply(this, arguments);
+11 -8
View File
@@ -10,7 +10,7 @@
/** @instance hints */ /** @instance hints */
var HintSession = Class("HintSession", CommandMode, { var HintSession = Class("HintSession", CommandMode, {
get extendedMode() modes.HINTS, get extendedMode() { return modes.HINTS; },
init: function init(mode, opts={}) { init: function init(mode, opts={}) {
init.supercall(this); init.supercall(this);
@@ -54,13 +54,16 @@ var HintSession = Class("HintSession", CommandMode, {
this.checkUnique(); this.checkUnique();
}, },
get docs() this._docs = this._docs.filter(({ doc }) => !Cu.isDeadWrapper(doc)), get docs() {
return this._docs = this._docs.filter(({ doc }) =>
!Cu.isDeadWrapper(doc));
},
set docs(docs) { set docs(docs) {
this._docs = docs; this._docs = docs;
}, },
Hint: { Hint: {
get active() this._active, get active() { return this._active; },
set active(val) { set active(val) {
this._active = val; this._active = val;
if (val) if (val)
@@ -73,7 +76,7 @@ var HintSession = Class("HintSession", CommandMode, {
hints.setClass(this.imgSpan, this.valid ? val : null); hints.setClass(this.imgSpan, this.valid ? val : null);
}, },
get ambiguous() this.span.hasAttribute("ambiguous"), get ambiguous() { return this.span.hasAttribute("ambiguous"); },
set ambiguous(val) { set ambiguous(val) {
let meth = val ? "setAttribute" : "removeAttribute"; let meth = val ? "setAttribute" : "removeAttribute";
this.elem[meth]("ambiguous", "true"); this.elem[meth]("ambiguous", "true");
@@ -82,7 +85,7 @@ var HintSession = Class("HintSession", CommandMode, {
this.imgSpan[meth]("ambiguous", "true"); this.imgSpan[meth]("ambiguous", "true");
}, },
get valid() this._valid, get valid() { return this._valid; },
set valid(val) { set valid(val) {
this._valid = val, this._valid = val,
@@ -93,9 +96,9 @@ var HintSession = Class("HintSession", CommandMode, {
} }
}, },
get mode() modes.HINTS, get mode() { return modes.HINTS; },
get prompt() ["Question", UTF8(this.hintMode.prompt) + ": "], get prompt() { return ["Question", UTF8(this.hintMode.prompt) + ": "]; },
leave: function leave(stack) { leave: function leave(stack) {
leave.superapply(this, arguments); leave.superapply(this, arguments);
@@ -142,7 +145,7 @@ var HintSession = Class("HintSession", CommandMode, {
}, },
_escapeNumbers: false, _escapeNumbers: false,
get escapeNumbers() this._escapeNumbers, get escapeNumbers() { return this._escapeNumbers; },
set escapeNumbers(val) { set escapeNumbers(val) {
this.clearTimeout(); this.clearTimeout();
this._escapeNumbers = !!val; this._escapeNumbers = !!val;
+3 -3
View File
@@ -9,9 +9,9 @@
var History = Module("history", { var History = Module("history", {
SORT_DEFAULT: "-date", SORT_DEFAULT: "-date",
get format() bookmarks.format, get format() { return bookmarks.format; },
get service() services.history, get service() { return services.history; },
get: function get(filter, maxItems, sort=this.SORT_DEFAULT) { get: function get(filter, maxItems, sort=this.SORT_DEFAULT) {
if (isString(filter)) if (isString(filter))
@@ -310,7 +310,7 @@ var History = Module("history", {
jumps = jumps.locations.map(l => ({ jumps = jumps.locations.map(l => ({
__proto__: l, __proto__: l,
title: buffer.title, title: buffer.title,
get URI() util.newURI(this.location) get URI() { return util.newURI(this.location); }
})); }));
} }
+5 -2
View File
@@ -224,11 +224,14 @@ var KeyProcessor = Class("KeyProcessor", {
this.wantCount = this.main.count; this.wantCount = this.main.count;
}, },
get toStringParams() [this.main.name, this.hive.name], get toStringParams() { return [this.main.name, this.hive.name]; },
countStr: "", countStr: "",
command: "", command: "",
get count() this.countStr ? Number(this.countStr) : this.main.params.count || null, get count() {
return this.countStr ? Number(this.countStr)
: this.main.params.count || null;
},
append: function append(event) { append: function append(event) {
this.events.push(event); this.events.push(event);
+14 -9
View File
@@ -50,10 +50,15 @@ var Map = Class("Map", {
/** @property {[string]} All of this mapping's names (key sequences). */ /** @property {[string]} All of this mapping's names (key sequences). */
names: Class.Memoize(function () this._keys.map(k => DOM.Event.canonicalKeys(k))), names: Class.Memoize(function () this._keys.map(k => DOM.Event.canonicalKeys(k))),
get toStringParams() [this.modes.map(m => m.name), get toStringParams() {
this.names.map(JSON.stringify)], return [this.modes.map(m => m.name),
this.names.map(JSON.stringify)];
},
get identifier() [this.modes[0].name, this.hive.prefix + this.names[0]].join("."), get identifier() {
return [this.modes[0].name, this.hive.prefix + this.names[0]]
.join(".");
},
/** @property {number} A unique ID for this mapping. */ /** @property {number} A unique ID for this mapping. */
id: null, id: null,
@@ -107,7 +112,7 @@ var Map = Class("Map", {
*/ */
hasName: function (name) this.keys.indexOf(name) >= 0, hasName: function (name) this.keys.indexOf(name) >= 0,
get keys() Ary.flatten(this.names.map(mappings.bound.expand)), get keys() { return Ary.flatten(this.names.map(mappings.bound.expand)); },
/** /**
* Execute the action for this mapping. * Execute the action for this mapping.
@@ -286,8 +291,8 @@ var MapHive = Class("MapHive", Contexts.Hive, {
"@@iterator": function () Ary.iterValues(this), "@@iterator": function () Ary.iterValues(this),
get candidates() this.states.candidates, get candidates() { return this.states.candidates; },
get mappings() this.states.mappings, get mappings() { return this.states.mappings; },
add: function (map) { add: function (map) {
this.push(map); this.push(map);
@@ -349,9 +354,9 @@ var Mappings = Module("mappings", {
repeat: Modes.boundProperty(), repeat: Modes.boundProperty(),
get allHives() contexts.allGroups.mappings, get allHives() { return contexts.allGroups.mappings; },
get userHives() this.allHives.filter(h => h !== this.builtin), get userHives() { return this.allHives.filter(h => h !== this.builtin); },
expandLeader: deprecated("your brain", function expandLeader(keyString) keyString), expandLeader: deprecated("your brain", function expandLeader(keyString) keyString),
@@ -557,7 +562,7 @@ var Mappings = Module("mappings", {
count: args["-count"] || !(args["-ex"] || args["-javascript"]), count: args["-count"] || !(args["-ex"] || args["-javascript"]),
noremap: args["-builtin"], noremap: args["-builtin"],
persist: !args["-nopersist"], persist: !args["-nopersist"],
get rhs() String(this.action), get rhs() { return String(this.action); },
silent: args["-silent"] silent: args["-silent"]
}); });
} }
+9 -5
View File
@@ -28,12 +28,16 @@ var Marks = Module("marks", {
* @property {Array} Returns all marks, both local and URL, in a sorted * @property {Array} Returns all marks, both local and URL, in a sorted
* array. * array.
*/ */
get all() iter(this._localMarks.get(this.localURI) || {}, get all() {
this._urlMarks return iter(this._localMarks.get(this.localURI) || {},
).sort((a, b) => String.localeCompare(a[0], b[0])) this._urlMarks
.toArray(), ).sort((a, b) => String.localeCompare(a[0], b[0]))
.toArray();
},
get localURI() buffer.focusedFrame.document.documentURI.replace(/#.*/, ""), get localURI() {
return buffer.focusedFrame.document.documentURI.replace(/#.*/, "");
},
Mark: function Mark(params={}) { Mark: function Mark(params={}) {
let win = buffer.focusedFrame; let win = buffer.focusedFrame;
+40 -27
View File
@@ -57,8 +57,12 @@ var Modes = Module("modes", {
bases: [this.NORMAL] bases: [this.NORMAL]
}, { }, {
get pref() prefs.get("accessibility.browsewithcaret"), get pref() {
set pref(val) prefs.set("accessibility.browsewithcaret", val), return prefs.get("accessibility.browsewithcaret");
},
set pref(val) {
prefs.set("accessibility.browsewithcaret", val);
},
enter: function (stack) { enter: function (stack) {
if (stack.pop && !this.pref) if (stack.pop && !this.pref)
@@ -196,17 +200,22 @@ var Modes = Module("modes", {
"@@iterator": function __iterator__() Ary.iterValues(this.all), "@@iterator": function __iterator__() Ary.iterValues(this.all),
get all() this._modes.slice(), get all() { return this._modes.slice(); },
get mainModes() (mode get mainModes() {
for ([k, mode] of iter(modes._modeMap)) return (mode
if (!mode.extended && mode.name == k)), for ([k, mode] of iter(modes._modeMap))
if (!mode.extended && mode.name == k));
},
get mainMode() this._modeMap[this._main], get mainMode() { return this._modeMap[this._main]; },
get passThrough() !!(this.main & (this.PASS_THROUGH|this.QUOTE)) ^ (this.getStack(1).main === this.PASS_THROUGH), get passThrough() {
return !!(this.main & (this.PASS_THROUGH|this.QUOTE)) ^
(this.getStack(1).main === this.PASS_THROUGH);
},
get topOfStack() this._modeStack[this._modeStack.length - 1], get topOfStack() { return this._modeStack[this._modeStack.length - 1]; },
addMode: function addMode(name, options, params) { addMode: function addMode(name, options, params) {
let mode = Modes.Mode(name, options, params); let mode = Modes.Mode(name, options, params);
@@ -246,7 +255,7 @@ var Modes = Module("modes", {
getStack: function getStack(idx) this._modeStack[this._modeStack.length - idx - 1] || this._modeStack[0], getStack: function getStack(idx) this._modeStack[this._modeStack.length - idx - 1] || this._modeStack[0],
get stack() this._modeStack.slice(), get stack() { return this._modeStack.slice(); },
getCharModes: function getCharModes(chr) (this.modeChars[chr] || []).slice(), getCharModes: function getCharModes(chr) (this.modeChars[chr] || []).slice(),
@@ -410,16 +419,16 @@ var Modes = Module("modes", {
this.pop(); this.pop();
}, },
get recording() this._recording, get recording() { return this._recording; },
set recording(value) { this._recording = value; this.show(); }, set recording(value) { this._recording = value; this.show(); },
get replaying() this._replaying, get replaying() { return this._replaying; },
set replaying(value) { this._replaying = value; this.show(); }, set replaying(value) { this._replaying = value; this.show(); },
get main() this._main, get main() { return this._main; },
set main(value) { this.set(value); }, set main(value) { this.set(value); },
get extended() this._extended, get extended() { return this._extended; },
set extended(value) { this.set(null, value); } set extended(value) { this.set(null, value); }
}, { }, {
Mode: Class("Mode", { Mode: Class("Mode", {
@@ -455,9 +464,9 @@ var Modes = Module("modes", {
return res; return res;
}), }),
get bases() this.input ? [modes.INPUT] : [modes.MAIN], get bases() { return this.input ? [modes.INPUT] : [modes.MAIN]; },
get count() !this.insert, get count() { return !this.insert; },
_display: Class.Memoize(function _display() this.name.replace(/_/g, " ")), _display: Class.Memoize(function _display() this.name.replace(/_/g, " ")),
@@ -477,9 +486,9 @@ var Modes = Module("modes", {
passUnknown: Class.Memoize(function () options.get("passunknown").getKey(this.name)), passUnknown: Class.Memoize(function () options.get("passunknown").getKey(this.name)),
get mask() this, get mask() { return this; },
get toStringParams() [this.name], get toStringParams() { return [this.name]; },
valueOf: function valueOf() this.id valueOf: function valueOf() this.id
}, { }, {
@@ -499,13 +508,15 @@ var Modes = Module("modes", {
StackElement.defaultValue("params", function () this.main.params); StackElement.defaultValue("params", function () this.main.params);
update(StackElement.prototype, { update(StackElement.prototype, {
get toStringParams() !loaded.has("modes") ? [this.main.name] : [ get toStringParams() {
this.main.name, return !loaded.has("modes") ? [this.main.name] : [
["(", modes.all.filter(m => this.extended & m) this.main.name,
.map(m => m.name) ["(", modes.all.filter(m => this.extended & m)
.join("|"), .map(m => m.name)
")"].join("") .join("|"),
] ")"].join("")
];
}
}); });
return StackElement; return StackElement;
})(), })(),
@@ -633,8 +644,10 @@ var Modes = Module("modes", {
validator: function validator(vals) vals.map(v => v.replace(/^!/, "")) validator: function validator(vals) vals.map(v => v.replace(/^!/, ""))
.every(k => hasOwnProperty(this.values, k)), .every(k => hasOwnProperty(this.values, k)),
get values() Ary.toObject([[m.name.toLowerCase(), m.description] get values() {
for (m of modes._modes) if (!m.hidden)]) return Ary.toObject([[m.name.toLowerCase(), m.description]
for (m of modes._modes) if (!m.hidden)]);
}
}; };
options.add(["passunknown", "pu"], options.add(["passunknown", "pu"],
+3 -3
View File
@@ -68,13 +68,13 @@ var MOW = Module("mow", {
__noSuchMethod__: function (meth, args) apply(Buffer, meth, [this.body].concat(args)), __noSuchMethod__: function (meth, args) apply(Buffer, meth, [this.body].concat(args)),
get widget() this.widgets.multilineOutput, get widget() { return this.widgets.multilineOutput; },
widgets: Class.Memoize(function widgets() commandline.widgets), widgets: Class.Memoize(function widgets() commandline.widgets),
body: Class.Memoize(function body() this.widget.contentDocument.documentElement), body: Class.Memoize(function body() this.widget.contentDocument.documentElement),
get document() this.widget.contentDocument, get document() { return this.widget.contentDocument; },
get window() this.widget.contentWindow, get window() { return this.widget.contentWindow; },
/** /**
* Display a multi-line message. * Display a multi-line message.
+13 -7
View File
@@ -110,7 +110,9 @@ var StatusLine = Module("statusline", {
})(prepend); })(prepend);
overlay.overlayWindow(window, { overlay.overlayWindow(window, {
objects: this.widgets = { get status() this.container }, objects: this.widgets = {
get status() { return this.container; }
},
prepend: prepend prepend: prepend
}); });
@@ -125,7 +127,9 @@ var StatusLine = Module("statusline", {
CustomizableUI.unregisterArea(this.statusBar.id, false); CustomizableUI.unregisterArea(this.statusBar.id, false);
}, },
get visible() !this.statusBar.collapsed && !this.statusBar.hidden, get visible() {
return !this.statusBar.collapsed && !this.statusBar.hidden;
},
signals: { signals: {
"browser.locationChange": function (webProgress, request, uri) { "browser.locationChange": function (webProgress, request, uri) {
@@ -223,7 +227,7 @@ var StatusLine = Module("statusline", {
highlight.highlightNode(this.statusBar, this.baseGroup + highlightGroup[type]); highlight.highlightNode(this.statusBar, this.baseGroup + highlightGroup[type]);
}, },
get security() this._security, get security() { return this._security; },
// update all fields of the statusline // update all fields of the statusline
update: function update() { update: function update() {
@@ -246,7 +250,7 @@ var StatusLine = Module("statusline", {
* *
* @param {string} url The URL to display. * @param {string} url The URL to display.
*/ */
get status() this._uri, get status() { return this._uri; },
set status(uri) { set status(uri) {
let modified = ""; let modified = "";
let url = uri; let url = uri;
@@ -285,7 +289,7 @@ var StatusLine = Module("statusline", {
this._status = uri; this._status = uri;
}, },
get bookmarked() this._bookmarked, get bookmarked() { return this._bookmarked; },
set bookmarked(val) { set bookmarked(val) {
this._bookmarked = val; this._bookmarked = val;
if (this.status) if (this.status)
@@ -309,8 +313,10 @@ var StatusLine = Module("statusline", {
* @param {string} buffer * @param {string} buffer
* @optional * @optional
*/ */
get inputBuffer() this.widgets.inputbuffer.value, get inputBuffer() { return this.widgets.inputbuffer.value; },
set inputBuffer(val) this.widgets.inputbuffer.value = val == null ? "" : val, set inputBuffer(val) {
this.widgets.inputbuffer.value = val == null ? "" : val;
},
updateInputBuffer: deprecated("statusline.inputBuffer", function updateInputBuffer(val) { this.inputBuffer = val; }), updateInputBuffer: deprecated("statusline.inputBuffer", function updateInputBuffer(val) { this.inputBuffer = val; }),
/** /**
+21 -9
View File
@@ -88,7 +88,9 @@ var Tabs = Module("tabs", {
document).appendTo(img.parentNode); document).appendTo(img.parentNode);
update(tab, { update(tab, {
get dactylOrdinal() Number(dom.nodes.icon.value), get dactylOrdinal() {
return Number(dom.nodes.icon.value);
},
set dactylOrdinal(i) { set dactylOrdinal(i) {
dom.nodes.icon.value = dom.nodes.label.textContent = i; dom.nodes.icon.value = dom.nodes.label.textContent = i;
this.setAttribute("dactylOrdinal", i); this.setAttribute("dactylOrdinal", i);
@@ -109,13 +111,18 @@ var Tabs = Module("tabs", {
this.updateSelectionHistory(); this.updateSelectionHistory();
}, },
get allTabs() Array.slice(config.tabbrowser.tabContainer.childNodes), get allTabs() {
return Array.slice(config.tabbrowser.tabContainer.childNodes);
},
/** /**
* @property {Object} The previously accessed tab or null if no tab * @property {Object} The previously accessed tab or null if no tab
* other than the current one has been accessed. * other than the current one has been accessed.
*/ */
get alternate() this.allTabs.indexOf(this._alternates[1]) > -1 ? this._alternates[1] : null, get alternate() {
let alt = this._alternates[1];
return this.allTabs.indexOf(alt) > -1 ? alt : null;
},
/** /**
* @property {Iterator(Object)} A genenerator that returns all browsers * @property {Iterator(Object)} A genenerator that returns all browsers
@@ -131,14 +138,17 @@ var Tabs = Module("tabs", {
/** /**
* @property {number} The number of tabs in the current window. * @property {number} The number of tabs in the current window.
*/ */
get count() config.tabbrowser.mTabs.length, get count() { return config.tabbrowser.mTabs.length; },
/** /**
* @property {Object} The local options store for the current tab. * @property {Object} The local options store for the current tab.
*/ */
get options() this.localStore.options, get options() { return this.localStore.options; },
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(tab => !tab.hidden), get visibleTabs() {
return config.tabbrowser.visibleTabs ||
this.allTabs.filter(tab => !tab.hidden);
},
/** /**
* Returns the local state store for the tab at the specified *tabIndex*. * Returns the local state store for the tab at the specified *tabIndex*.
@@ -163,18 +173,20 @@ var Tabs = Module("tabs", {
* @property {Object} The local state store for the currently selected * @property {Object} The local state store for the currently selected
* tab. * tab.
*/ */
get localStore() this.getLocalStore(), get localStore() { return this.getLocalStore(); },
localStorePrototype: memoize({ localStorePrototype: memoize({
instance: {}, instance: {},
get options() ({}) get options() { return {}; }
}), }),
/** /**
* @property {[Object]} The array of closed tabs for the current * @property {[Object]} The array of closed tabs for the current
* session. * session.
*/ */
get closedTabs() JSON.parse(services.sessionStore.getClosedTabData(window)), get closedTabs() {
return JSON.parse(services.sessionStore.getClosedTabData(window));
},
/** /**
* Clones the specified *tab* and append it to the tab list. * Clones the specified *tab* and append it to the tab list.
+4 -4
View File
@@ -1028,8 +1028,8 @@ Class.prototype = {
*/ */
init: function c_init() {}, init: function c_init() {},
get instance() ({}), get instance() { return {}; },
set instance(val) Class.replaceProperty(this, "instance", val), set instance(val) { Class.replaceProperty(this, "instance", val); },
withSavedValues: function withSavedValues(names, callback, self) { withSavedValues: function withSavedValues(names, callback, self) {
let vals = names.map(name => this[name]); let vals = names.map(name => this[name]);
@@ -1173,7 +1173,7 @@ var closureHooks = {
return { return {
configurable: false, configurable: false,
writable: false, writable: false,
get value() self.get(target, prop) get value() { return self.get(target, prop); }
} }
} }
*/ */
@@ -1365,7 +1365,7 @@ var StructBase = Class("StructBase", Array, {
this[i] = arguments[i]; this[i] = arguments[i];
}, },
get toStringParams() this, get toStringParams() { return this; },
clone: function struct_clone() this.constructor.apply(null, this.slice()), clone: function struct_clone() this.constructor.apply(null, this.slice()),
+7 -5
View File
@@ -24,12 +24,14 @@ var Bookmark = Struct("url", "title", "icon", "post", "keyword", "tags", "charse
var Keyword = Struct("keyword", "title", "icon", "url"); var Keyword = Struct("keyword", "title", "icon", "url");
Bookmark.defaultValue("icon", function () BookmarkCache.getFavicon(this.url)); Bookmark.defaultValue("icon", function () BookmarkCache.getFavicon(this.url));
update(Bookmark.prototype, { update(Bookmark.prototype, {
get extra() [ get extra() {
["keyword", this.keyword, "Keyword"], return [
["tags", this.tags.join(", "), "Tag"] ["keyword", this.keyword, "Keyword"],
].filter(item => item[1]), ["tags", this.tags.join(", "), "Tag"]
].filter(item => item[1]);
},
get uri() newURI(this.url), get uri() { return newURI(this.url); },
set uri(uri) { set uri(uri) {
let tags = this.tags; let tags = this.tags;
this.tags = null; this.tags = null;
+60 -37
View File
@@ -47,9 +47,9 @@ var Buffer = Module("Buffer", {
this.win = win; this.win = win;
}, },
get addPageInfoSection() Buffer.bound.addPageInfoSection, get addPageInfoSection() { return Buffer.bound.addPageInfoSection; },
get pageInfo() Buffer.pageInfo, get pageInfo() { return Buffer.pageInfo; },
// called when the active document is scrolled // called when the active document is scrolled
_updateBufferPosition: function _updateBufferPosition() { _updateBufferPosition: function _updateBufferPosition() {
@@ -73,7 +73,7 @@ var Buffer = Module("Buffer", {
/** /**
* The load context of the window bound to this buffer. * The load context of the window bound to this buffer.
*/ */
get loadContext() sanitizer.getContext(this.win), get loadContext() { return sanitizer.getContext(this.win); },
/** /**
* Content preference methods. * Content preference methods.
@@ -211,10 +211,12 @@ var Buffer = Module("Buffer", {
/** /**
* @property {number} True when the buffer is fully loaded. * @property {number} True when the buffer is fully loaded.
*/ */
get loaded() apply(Math, "min", get loaded() {
this.allFrames() return apply(Math, "min",
.map(frame => ["loading", "interactive", "complete"] this.allFrames()
.indexOf(frame.document.readyState))), .map(frame => ["loading", "interactive", "complete"]
.indexOf(frame.document.readyState)));
},
/** /**
* @property {Object} The local state store for the currently selected * @property {Object} The local state store for the currently selected
@@ -231,7 +233,7 @@ var Buffer = Module("Buffer", {
localStorePrototype: memoize({ localStorePrototype: memoize({
instance: {}, instance: {},
get jumps() [], get jumps() { return []; },
jumpsIndex: -1 jumpsIndex: -1
}), }),
@@ -251,11 +253,11 @@ var Buffer = Module("Buffer", {
/** /**
* @property {nsIURI} The current top-level document. * @property {nsIURI} The current top-level document.
*/ */
get doc() this.win.document, get doc() { return this.win.document; },
get docShell() util.docShell(this.win), get docShell() { return util.docShell(this.win); },
get modules() this.topWindow.dactyl.modules, get modules() { return this.topWindow.dactyl.modules; },
set modules(val) {}, set modules(val) {},
topWindow: Class.Memoize(function () util.topWindow(this.win)), topWindow: Class.Memoize(function () util.topWindow(this.win)),
@@ -263,7 +265,7 @@ var Buffer = Module("Buffer", {
/** /**
* @property {nsIURI} The current top-level document's URI. * @property {nsIURI} The current top-level document's URI.
*/ */
get uri() util.newURI(this.win.location.href), get uri() { return util.newURI(this.win.location.href); },
/** /**
* @property {nsIURI} The current top-level document's URI, sans * @property {nsIURI} The current top-level document's URI, sans
@@ -280,20 +282,29 @@ var Buffer = Module("Buffer", {
* @property {nsIURI} The current top-level document's URI, sans any * @property {nsIURI} The current top-level document's URI, sans any
* fragment identifier. * fragment identifier.
*/ */
get documentURI() this.doc.documentURIObject || util.newURI(this.doc.documentURI), get documentURI() {
return this.doc.documentURIObject ||
util.newURI(this.doc.documentURI);
},
/** /**
* @property {string} The current top-level document's URL. * @property {string} The current top-level document's URL.
*/ */
get URL() update(new String(this.win.location.href), util.newURI(this.win.location.href)), get URL() {
return update(new String(this.win.location.href),
util.newURI(this.win.location.href));
},
/** /**
* @property {number} The buffer's height in pixels. * @property {number} The buffer's height in pixels.
*/ */
get pageHeight() this.win.innerHeight, get pageHeight() { return this.win.innerHeight; },
get contentViewer() this.docShell.contentViewer get contentViewer() {
.QueryInterface(Ci.nsIMarkupDocumentViewer || Ci.nsIContentViewer), return this.docShell.contentViewer
.QueryInterface(Ci.nsIMarkupDocumentViewer ||
Ci.nsIContentViewer);
},
/** /**
* @property {number} The current browser's zoom level, as a * @property {number} The current browser's zoom level, as a
@@ -309,15 +320,15 @@ var Buffer = Module("Buffer", {
* @property {boolean} Whether the current browser is using full * @property {boolean} Whether the current browser is using full
* zoom, as opposed to text zoom. * zoom, as opposed to text zoom.
*/ */
get fullZoom() this.ZoomManager.useFullZoom, get fullZoom() { return this.ZoomManager.useFullZoom; },
set fullZoom(value) { this.setZoom(this.zoomLevel, value); }, set fullZoom(value) { this.setZoom(this.zoomLevel, value); },
get ZoomManager() this.topWindow.ZoomManager, get ZoomManager() { return this.topWindow.ZoomManager; },
/** /**
* @property {string} The current document's title. * @property {string} The current document's title.
*/ */
get title() this.doc.title, get title() { return this.doc.title; },
/** /**
* @property {number} The buffer's horizontal scroll percentile. * @property {number} The buffer's horizontal scroll percentile.
@@ -343,7 +354,9 @@ var Buffer = Module("Buffer", {
* @property {{ x: number, y: number }} The buffer's current scroll position * @property {{ x: number, y: number }} The buffer's current scroll position
* as reported by {@link Buffer.getScrollPosition}. * as reported by {@link Buffer.getScrollPosition}.
*/ */
get scrollPosition() Buffer.getScrollPosition(this.findScrollable(0, false)), get scrollPosition() {
return Buffer.getScrollPosition(this.findScrollable(0, false));
},
/** /**
* Returns a list of all frames in the given window or current buffer. * Returns a list of all frames in the given window or current buffer.
@@ -380,7 +393,7 @@ var Buffer = Module("Buffer", {
* *
* @returns {string} * @returns {string}
*/ */
get currentWord() Buffer.currentWord(this.focusedFrame), get currentWord() { return Buffer.currentWord(this.focusedFrame); },
getCurrentWord: deprecated("buffer.currentWord", function getCurrentWord() Buffer.currentWord(this.focusedFrame, true)), getCurrentWord: deprecated("buffer.currentWord", function getCurrentWord() Buffer.currentWord(this.focusedFrame, true)),
/** /**
@@ -694,13 +707,15 @@ var Buffer = Module("Buffer", {
/** /**
* @property {nsISelection} The current document's normal selection. * @property {nsISelection} The current document's normal selection.
*/ */
get selection() this.win.getSelection(), get selection() { return this.win.getSelection(); },
/** /**
* @property {nsISelectionController} The current document's selection * @property {nsISelectionController} The current document's selection
* controller. * controller.
*/ */
get selectionController() util.selectionController(this.focusedFrame), get selectionController() {
return util.selectionController(this.focusedFrame);
},
/** /**
* @property {string|null} The canonical short URL for the current * @property {string|null} The canonical short URL for the current
@@ -1458,26 +1473,34 @@ var Buffer = Module("Buffer", {
win: elem.defaultView || elem.ownerDocument.defaultView, win: elem.defaultView || elem.ownerDocument.defaultView,
get clientWidth() this.win.innerWidth, get clientWidth() { return this.win.innerWidth; },
get clientHeight() this.win.innerHeight, get clientHeight() { return this.win.innerHeight; },
get scrollWidth() this.win.scrollMaxX + this.win.innerWidth, get scrollWidth() {
get scrollHeight() this.win.scrollMaxY + this.win.innerHeight, return this.win.scrollMaxX + this.win.innerWidth;
},
get scrollHeight() {
return this.win.scrollMaxY + this.win.innerHeight;
},
get scrollLeftMax() this.win.scrollMaxX, get scrollLeftMax() { return this.win.scrollMaxX; },
get scrollRightMax() this.win.scrollMaxY, get scrollRightMax() { return this.win.scrollMaxY; },
get scrollLeft() this.win.scrollX, get scrollLeft() { return 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, get scrollTop() { return 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; return elem;
}, },
get ZOOM_MIN() prefs.get("zoom.minPercent"), get ZOOM_MIN() { return prefs.get("zoom.minPercent"); },
get ZOOM_MAX() prefs.get("zoom.maxPercent"), get ZOOM_MAX() { return prefs.get("zoom.maxPercent"); },
setZoom: deprecated("buffer.setZoom", setZoom: deprecated("buffer.setZoom",
function setZoom(...args) apply(overlay.activeModules.buffer, "setZoom", args)), function setZoom(...args) apply(overlay.activeModules.buffer, "setZoom", args)),
@@ -2565,7 +2588,7 @@ var Buffer = Module("Buffer", {
options.add(["pageinfo", "pa"], options.add(["pageinfo", "pa"],
"Define which sections are shown by the :pageinfo command", "Define which sections are shown by the :pageinfo command",
"charlist", "gesfm", "charlist", "gesfm",
{ get values() values(Buffer.pageInfo).toObject() }); { get values() { return values(Buffer.pageInfo).toObject(); }});
options.add(["scroll", "scr"], options.add(["scroll", "scr"],
"Number of lines to scroll with <C-u> and <C-d> commands", "Number of lines to scroll with <C-u> and <C-d> commands",
+1 -1
View File
@@ -97,7 +97,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
return this._cacheReader; return this._cacheReader;
}, },
get inQueue() this._cacheWriter && this._cacheWriter.inQueue, get inQueue() { return this._cacheWriter && this._cacheWriter.inQueue; },
getCacheWriter: function () { getCacheWriter: function () {
if (!this._cacheWriter) if (!this._cacheWriter)
+21 -14
View File
@@ -140,13 +140,15 @@ var Command = Class("Command", {
this.update(extraInfo); this.update(extraInfo);
}, },
get toStringParams() [this.name, this.hive.name], get toStringParams() { return [this.name, this.hive.name]; },
get identifier() this.hive.prefix + this.name, get identifier() { return this.hive.prefix + this.name; },
get helpTag() ":" + this.name, get helpTag() { return ":" + this.name; },
get lastCommand() this._lastCommand || this.modules.commandline.command, get lastCommand() {
return this._lastCommand || this.modules.commandline.command;
},
set lastCommand(val) { this._lastCommand = val; }, set lastCommand(val) { this._lastCommand = val; },
/** /**
@@ -326,7 +328,10 @@ var Command = Class("Command", {
has: function AP_has(opt) hasOwnProperty(this.explicitOpts, opt) has: function AP_has(opt) hasOwnProperty(this.explicitOpts, opt)
|| typeof opt === "number" && hasOwnProperty(this, opt), || typeof opt === "number" && hasOwnProperty(this, opt),
get literalArg() this.command.literal != null && this[this.command.literal] || "", get literalArg() {
let { literal } = this.command;
return literal != null && this[literal] || "";
},
// TODO: string: Class.Memoize(function () { ... }), // TODO: string: Class.Memoize(function () { ... }),
@@ -431,8 +436,8 @@ var Command = Class("Command", {
// Prototype. // Prototype.
var Ex = Module("Ex", { var Ex = Module("Ex", {
Local: function Local(dactyl, modules, window) ({ Local: function Local(dactyl, modules, window) ({
get commands() modules.commands, get commands() { return modules.commands; },
get context() modules.contexts.context get context() { return modules.contexts.context; }
}), }),
_args: function E_args(cmd, args) { _args: function E_args(cmd, args) {
@@ -528,7 +533,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
} }
}, },
get cacheKey() "commands/hives/" + this.name + ".json", get cacheKey() { return "commands/hives/" + this.name + ".json"; },
/** @property {Iterator(Command)} @private */ /** @property {Iterator(Command)} @private */
"@@iterator": function __iterator__() { "@@iterator": function __iterator__() {
@@ -678,13 +683,15 @@ var Commands = Module("commands", {
this.modules.moduleManager.initDependencies("commands"); this.modules.moduleManager.initDependencies("commands");
}, },
get context() contexts.context, get context() { return contexts.context; },
get readHeredoc() modules.io.readHeredoc, get readHeredoc() { return modules.io.readHeredoc; },
get allHives() contexts.allGroups.commands, get allHives() { return contexts.allGroups.commands; },
get userHives() this.allHives.filter(h => h !== this.builtin), get userHives() {
return this.allHives.filter(h => h !== this.builtin);
},
/** /**
* Executes an Ex command script. * Executes an Ex command script.
@@ -1391,10 +1398,10 @@ var Commands = Module("commands", {
}, },
/** @property */ /** @property */
get complQuote() Commands.complQuote, get complQuote() { return Commands.complQuote; },
/** @property */ /** @property */
get quoteArg() Commands.quoteArg // XXX: better somewhere else? get quoteArg() { return Commands.quoteArg; } // XXX: better somewhere else?
}, { }, {
// returns [count, parsed_argument] // returns [count, parsed_argument]
+44 -35
View File
@@ -219,9 +219,11 @@ var CompletionContext = Class("CompletionContext", {
delete this.__title; delete this.__title;
return this._title = val; return this._title = val;
}, },
get title() this.__title, get title() { return this.__title; },
get activeContexts() this.contextList.filter(function f(c) c.items.length), get activeContexts() {
return this.contextList.filter(function f(c) c.items.length);
},
// Temporary // Temporary
/** /**
@@ -248,17 +250,19 @@ var CompletionContext = Class("CompletionContext", {
this.cache.allItemsResult = memoize({ this.cache.allItemsResult = memoize({
start: minStart, start: minStart,
get longestSubstring() self.longestAllSubstring, get longestSubstring() { return self.longestAllSubstring; },
get items() Ary.flatten(self.activeContexts.map(function m(context) { get items() {
let prefix = self.value.substring(minStart, context.offset); return Ary.flatten(self.activeContexts.map(function m(context) {
let prefix = self.value.substring(minStart, context.offset);
return context.items.map(function m(item) ({ return context.items.map(function m(item) ({
text: prefix + item.text, text: prefix + item.text,
result: prefix + item.result, result: prefix + item.result,
__proto__: item __proto__: item
}));
})); }));
})) }
}); });
return this.cache.allItemsResult; return this.cache.allItemsResult;
@@ -292,13 +296,13 @@ var CompletionContext = Class("CompletionContext", {
return this.allSubstrings.reduce(function r(a, b) a.length > b.length ? a : b, ""); return this.allSubstrings.reduce(function r(a, b) a.length > b.length ? a : b, "");
}, },
get caret() this._caret - this.offset, get caret() { return this._caret - this.offset; },
set caret(val) this._caret = val + this.offset, set caret(val) { this._caret = val + this.offset; },
get compare() this._compare || function compare() 0, get compare() { return this._compare || function compare() 0; },
set compare(val) this._compare = val, set compare(val) { this._compare = val; },
get completions() this._completions || [], get completions() { return this._completions || []; },
set completions(items) { set completions(items) {
if (items && isArray(items.array)) if (items && isArray(items.array))
items = items.array; items = items.array;
@@ -320,24 +324,29 @@ var CompletionContext = Class("CompletionContext", {
util.trapErrors("onUpdate", this); util.trapErrors("onUpdate", this);
}, },
get createRow() this._createRow || template.completionRow, // XXX get createRow() { return this._createRow || template.completionRow; }, // XXX
set createRow(createRow) this._createRow = createRow, set createRow(createRow) { return this._createRow = createRow; },
get filterFunc() this._filterFunc || util.identity, get filterFunc() { return this._filterFunc || util.identity; },
set filterFunc(val) this._filterFunc = val, set filterFunc(val) { this._filterFunc = val; },
get filter() this._filter != null ? this._filter : this.value.substr(this.offset, this.caret), get filter() {
return this._filter != null ? this._filter
: this.value.substr(this.offset, this.caret);
},
set filter(val) { set filter(val) {
delete this.ignoreCase; delete this.ignoreCase;
return this._filter = val; return this._filter = val;
}, },
get format() ({ get format() {
anchored: this.anchored, return {
title: this.title, anchored: this.anchored,
keys: this.keys, title: this.title,
process: this.process keys: this.keys,
}), process: this.process
};
},
set format(format) { set format(format) {
this.anchored = format.anchored, this.anchored = format.anchored,
this.title = format.title || this.title; this.title = format.title || this.title;
@@ -350,8 +359,8 @@ var CompletionContext = Class("CompletionContext", {
* The message displayed at the head of the completions for the * The message displayed at the head of the completions for the
* current context. * current context.
*/ */
get message() this._message || (this.waitingForTab && this.hasItems !== false ? _("completion.waitingFor", "<Tab>") : null), get message() { return this._message || (this.waitingForTab && this.hasItems !== false ? _("completion.waitingFor", "<Tab>") : null); },
set message(val) this._message = val, set message(val) { this._message = val; },
/** /**
* The prototype object for items returned by {@link items}. * The prototype object for items returned by {@link items}.
@@ -387,7 +396,7 @@ var CompletionContext = Class("CompletionContext", {
* must be regenerated. May be set to true to invalidate the current * must be regenerated. May be set to true to invalidate the current
* completions. * completions.
*/ */
get regenerate() this._generate && (!this.completions || !this.itemCache[this.key] || this._cache.offset != this.offset), get regenerate() { return this._generate && (!this.completions || !this.itemCache[this.key] || this._cache.offset != this.offset); },
set regenerate(val) { if (val) delete this.itemCache[this.key]; }, set regenerate(val) { if (val) delete this.itemCache[this.key]; },
/** /**
@@ -396,7 +405,7 @@ var CompletionContext = Class("CompletionContext", {
* completions are linked to the value in {@link #key} and may be * completions are linked to the value in {@link #key} and may be
* invalidated by setting the {@link #regenerate} property. * invalidated by setting the {@link #regenerate} property.
*/ */
get generate() this._generate || null, get generate() { return this._generate || null; },
set generate(arg) { set generate(arg) {
this.hasItems = true; this.hasItems = true;
this._generate = arg; this._generate = arg;
@@ -900,13 +909,13 @@ var Completion = Module("completion", {
init: function init() { init: function init() {
}, },
get setFunctionCompleter() JavaScript.setCompleter, // Backward compatibility get setFunctionCompleter() { return JavaScript.setCompleter; }, // Backward compatibility
Local: function Local(dactyl, modules, window) ({ Local: function Local(dactyl, modules, window) ({
urlCompleters: {}, urlCompleters: {},
get modules() modules, get modules() { return modules; },
get options() modules.options, get options() { return modules.options; },
// FIXME // FIXME
_runCompleter: function _runCompleter(name, filter, maxItems, ...args) { _runCompleter: function _runCompleter(name, filter, maxItems, ...args) {
@@ -1054,7 +1063,7 @@ var Completion = Module("completion", {
for (i of util.range(0, result.matchCount)) for (i of util.range(0, result.matchCount))
]; ];
}), }),
get onUpdateSearchResult() this.onSearchResult get onUpdateSearchResult() { return this.onSearchResult; }
}); });
running[provider] = true; running[provider] = true;
} }
@@ -1118,7 +1127,7 @@ var Completion = Module("completion", {
return init.superapply(this, arguments); return init.superapply(this, arguments);
}, },
get options() this.modules.options get options() { return this.modules.options; }
}); });
}, },
commands: function initCommands(dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
+34 -24
View File
@@ -25,11 +25,11 @@ lazyRequire("util", ["util"]);
function AboutHandler() {} function AboutHandler() {}
AboutHandler.prototype = { AboutHandler.prototype = {
get classDescription() "About " + config.appName + " Page", get classDescription() { return "About " + config.appName + " Page"; },
classID: Components.ID("81495d80-89ee-4c36-a88d-ea7c4e5ac63f"), classID: Components.ID("81495d80-89ee-4c36-a88d-ea7c4e5ac63f"),
get contractID() services.ABOUT + config.name, get contractID() { return services.ABOUT + config.name; },
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]), QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
@@ -79,7 +79,7 @@ var ConfigBase = Class("ConfigBase", {
}); });
}, },
get prefs() localPrefs, get prefs() { return localPrefs; },
has: function (feature) this.features.has(feature), has: function (feature) this.features.has(feature),
@@ -194,14 +194,14 @@ var ConfigBase = Class("ConfigBase", {
}; };
}, },
get addonID() this.name + "@dactyl.googlecode.com", get addonID() { return this.name + "@dactyl.googlecode.com"; },
addon: Class.Memoize(function () { addon: Class.Memoize(function () {
return (JSMLoader.bootstrap || {}).addon || return (JSMLoader.bootstrap || {}).addon ||
AddonManager.getAddonByID(this.addonID); AddonManager.getAddonByID(this.addonID);
}), }),
get styleableChrome() Object.keys(this.overlays), get styleableChrome() { return Object.keys(this.overlays); },
/** /**
* The current application locale. * The current application locale.
@@ -335,17 +335,23 @@ var ConfigBase = Class("ConfigBase", {
* @property {string} The normalised name of the OS. This is one of * @property {string} The normalised name of the OS. This is one of
* "Windows", "Mac OS X" or "Unix". * "Windows", "Mac OS X" or "Unix".
*/ */
get name() this.isWindows ? "Windows" : this.isMacOSX ? "Mac OS X" : "Unix", get name() {
return this.isWindows ? "Windows"
: this.isMacOSX ? "Mac OS X"
: "Unix";
},
/** @property {boolean} True if the OS is Windows. */ /** @property {boolean} True if the OS is Windows. */
get isWindows() this._arch == "WINNT", get isWindows() { return this._arch == "WINNT"; },
/** @property {boolean} True if the OS is Mac OS X. */ /** @property {boolean} True if the OS is Mac OS X. */
get isMacOSX() this._arch == "Darwin", get isMacOSX() { return this._arch == "Darwin"; },
/** @property {boolean} True if the OS is some other *nix variant. */ /** @property {boolean} True if the OS is some other *nix variant. */
get isUnix() !this.isWindows, get isUnix() { return !this.isWindows; },
/** @property {RegExp} A RegExp which matches illegal characters in path components. */ /** @property {RegExp} A RegExp which matches illegal characters in path components. */
get illegalCharacters() this.isWindows ? /[<>:"/\\|?*\x00-\x1f]/g : /[\/\x00]/g, get illegalCharacters() {
return this.isWindows ? /[<>:"/\\|?*\x00-\x1f]/g : /[\/\x00]/g;
},
get pathListSep() this.isWindows ? ";" : ":" get pathListSep() { return this.isWindows ? ";" : ":"; }
}), }),
/** /**
@@ -407,7 +413,7 @@ var ConfigBase = Class("ConfigBase", {
return _("dactyl.created", "@DATE@"); return _("dactyl.created", "@DATE@");
}), }),
get fileExt() this.name.slice(0, -6), get fileExt() { return this.name.slice(0, -6); },
dtd: Class.Memoize(function () dtd: Class.Memoize(function ()
iter(this.dtdExtra, iter(this.dtdExtra,
@@ -416,13 +422,15 @@ var ConfigBase = Class("ConfigBase", {
.toObject()), .toObject()),
dtdDactyl: memoize({ dtdDactyl: memoize({
get name() config.name, get name() { return config.name; },
get home() "http://5digits.org/", get home() { return "http://5digits.org/"; },
get apphome() this.home + this.name, get apphome() { return this.home + this.name; },
code: "http://code.google.com/p/dactyl/", code: "http://code.google.com/p/dactyl/",
get issues() this.home + "bug/" + this.name, get issues() { return this.home + "bug/" + this.name; },
get plugins() "http://5digits.org/" + this.name + "/plugins", get plugins() {
get faq() this.home + this.name + "/faq", return "http://5digits.org/" + this.name + "/plugins";
},
get faq() { return this.home + this.name + "/faq"; },
"list.mailto": Class.Memoize(() => config.name + "@googlegroups.com"), "list.mailto": Class.Memoize(() => config.name + "@googlegroups.com"),
"list.href": Class.Memoize(() => "http://groups.google.com/group/" + config.name), "list.href": Class.Memoize(() => "http://groups.google.com/group/" + config.name),
@@ -483,18 +491,18 @@ var ConfigBase = Class("ConfigBase", {
util.overlayWindow(window, { append: append }); util.overlayWindow(window, { append: append });
}, },
get window() window, get window() { return window; },
get document() document, get document() { return document; },
ids: Class.Update({ ids: Class.Update({
get commandContainer() document.documentElement.id get commandContainer() { return document.documentElement.id; }
}), }),
browser: Class.Memoize(() => window.gBrowser), browser: Class.Memoize(() => window.gBrowser),
tabbrowser: Class.Memoize(() => window.gBrowser), tabbrowser: Class.Memoize(() => window.gBrowser),
get browserModes() [modules.modes.NORMAL], get browserModes() { return [modules.modes.NORMAL]; },
/** /**
* @property {string} The ID of the application's main XUL window. * @property {string} The ID of the application's main XUL window.
@@ -505,7 +513,9 @@ var ConfigBase = Class("ConfigBase", {
* @property {number} The height (px) that is available to the output * @property {number} The height (px) that is available to the output
* window. * window.
*/ */
get outputHeight() this.browser.mPanelContainer.boxObject.height, get outputHeight() {
return 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)
}), }),
@@ -556,7 +566,7 @@ var ConfigBase = Class("ConfigBase", {
* @property {string} The file extension used for command script files. * @property {string} The file extension used for command script files.
* This is the name string sans "dactyl". * This is the name string sans "dactyl".
*/ */
get fileExtension() this.name.slice(0, -6), get fileExtension() { return this.name.slice(0, -6); },
guioptions: {}, guioptions: {},
+32 -22
View File
@@ -27,10 +27,12 @@ var Group = Class("Group", {
this.children = []; this.children = [];
}, },
get contexts() this.modules.contexts, get contexts() { return this.modules.contexts; },
set lastDocument(val) { this._lastDocument = util.weakReference(val); }, set lastDocument(val) { this._lastDocument = util.weakReference(val); },
get lastDocument() this._lastDocument && this._lastDocument.get(), get lastDocument() {
return this._lastDocument && this._lastDocument.get();
},
modifiable: true, modifiable: true,
@@ -60,9 +62,11 @@ var Group = Class("Group", {
return update(res, this.argsExtra(res), args); return update(res, this.argsExtra(res), args);
}, },
get toStringParams() [this.name], get toStringParams() { return [this.name]; },
get builtin() this.modules.contexts.builtinGroups.indexOf(this) >= 0 get builtin() {
return this.modules.contexts.builtinGroups.indexOf(this) >= 0;
}
}, { }, {
compileFilter: function (patterns, default_=false) { compileFilter: function (patterns, default_=false) {
function siteFilter(uri) { function siteFilter(uri) {
@@ -132,13 +136,17 @@ var Contexts = Module("contexts", {
}); });
}, },
get toStringParams() [this.name], get toStringParams() { return [this.name]; },
names: ["-group", "-g"], names: ["-group", "-g"],
description: "Group to which to add", description: "Group to which to add",
get default() (contexts.context && contexts.context.group || contexts.user)[this.name], get default() {
return (contexts.context &&
contexts.context.group ||
contexts.user)[this.name];
},
completer: function (context) modules.completion.group(context) completer: function (context) modules.completion.group(context)
}); });
@@ -171,7 +179,9 @@ var Contexts = Module("contexts", {
} }
}, },
Group: Class("Group", Group, { modules: modules, get hiveMap() modules.contexts.hives }), Group: Class("Group", Group,
{ modules: modules,
get hiveMap() { return modules.contexts.hives; }}),
Hives: Class("Hives", Class.Property, { Hives: Class("Hives", Class.Property, {
init: function init(name, constructor) { init: function init(name, constructor) {
@@ -203,7 +213,7 @@ var Contexts = Module("contexts", {
if (hasOwnProperty(group, name))]); if (hasOwnProperty(group, name))]);
}, },
get toStringParams() [this.name, this.Hive] get toStringParams() { return [this.name, this.Hive]; }
}) })
}), }),
@@ -330,7 +340,7 @@ var Contexts = Module("contexts", {
CONTEXT: Const(self), CONTEXT: Const(self),
get isGlobalModule() true, get isGlobalModule() { return true; },
set isGlobalModule(val) { set isGlobalModule(val) {
util.assert(val, "Loading non-global module as global", util.assert(val, "Loading non-global module as global",
false); false);
@@ -580,27 +590,27 @@ var Contexts = Module("contexts", {
cleanup: function cleanup() {}, cleanup: function cleanup() {},
destroy: function destroy() {}, destroy: function destroy() {},
get modifiable() this.group.modifiable, get modifiable() { return this.group.modifiable; },
get argsExtra() this.group.argsExtra, get argsExtra() { return this.group.argsExtra; },
get makeArgs() this.group.makeArgs, get makeArgs() { return this.group.makeArgs; },
get builtin() this.group.builtin, get builtin() { return this.group.builtin; },
get name() this.group.name, get name() { return this.group.name; },
set name(val) this.group.name = val, set name(val) { this.group.name = val; },
get description() this.group.description, get description() { return this.group.description; },
set description(val) this.group.description = val, set description(val) { this.group.description = val; },
get filter() this.group.filter, get filter() { return this.group.filter; },
set filter(val) this.group.filter = val, set filter(val) { this.group.filter = val; },
get persist() this.group.persist, get persist() { return this.group.persist; },
set persist(val) this.group.persist = val, set persist(val) { this.group.persist = val; },
prefix: Class.Memoize(function () this.name === "builtin" ? "" : this.name + ":"), prefix: Class.Memoize(function () this.name === "builtin" ? "" : this.name + ":"),
get toStringParams() [this.name] get toStringParams() { return [this.name]; }
}) })
}, { }, {
commands: function initCommands(dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
+73 -42
View File
@@ -98,8 +98,11 @@ var DOM = Class("DOM", {
}.call(this); }.call(this);
}, },
get document() this._document || this[0] && (this[0].ownerDocument || this[0].document || this[0]), get document() {
set document(val) this._document = val, return this._document || this[0] &&
(this[0].ownerDocument || this[0].document || this[0]);
},
set document(val) { this._document = val; },
attrHooks: { attrHooks: {
"": { "": {
@@ -240,34 +243,50 @@ var DOM = Class("DOM", {
return false; return false;
}, },
get parent() this.map(elem => elem.parentNode, this), get parent() { return this.map(elem => elem.parentNode, this); },
get offsetParent() this.map(function (elem) { get offsetParent() {
do { return this.map(function (elem) {
var parent = elem.offsetParent; do {
if (parent instanceof Ci.nsIDOMElement && DOM(parent).position != "static") var parent = elem.offsetParent;
return parent; if (parent instanceof Ci.nsIDOMElement && DOM(parent).position != "static")
} return parent;
while (parent); }
}, this), while (parent);
}, this);
},
get ancestors() this.all(elem => elem.parentNode), get ancestors() { return this.all(elem => elem.parentNode); },
get children() this.map(elem => Array.filter(elem.childNodes, get children() {
e => e instanceof Ci.nsIDOMElement), return this.map(
this), elem => Array.filter(elem.childNodes,
e => e instanceof Ci.nsIDOMElement),
this);
},
get contents() this.map(elem => elem.childNodes, this), get contents() { return this.map(elem => elem.childNodes, this); },
get siblings() this.map(elem => Array.filter(elem.parentNode.childNodes, get siblings() {
e => e != elem && e instanceof Ci.nsIDOMElement), return this.map(
this), elem => Array.filter(elem.parentNode.childNodes,
e => e != elem && e instanceof Ci.nsIDOMElement),
this);
},
get siblingsBefore() this.all(elem => elem.previousElementSibling), get siblingsBefore() {
get siblingsAfter() this.all(elem => elem.nextElementSibling), return this.all(elem => elem.previousElementSibling);
},
get siblingsAfter() {
return this.all(elem => elem.nextElementSibling);
},
get allSiblingsBefore() this.all(elem => elem.previousSibling), get allSiblingsBefore() {
get allSiblingsAfter() this.all(elem => elem.nextSibling), return this.all(elem => elem.previousSibling);
},
get allSiblingsAfter() {
return this.all(elem => elem.nextSibling);
},
get class() { get class() {
let self = this; let self = this;
@@ -275,8 +294,8 @@ var DOM = Class("DOM", {
return { return {
toString: function () self[0].className, toString: function () self[0].className,
get list() Array.slice(self[0].classList), get list() { return Array.slice(self[0].classList); },
set list(val) self.attr("class", val.join(" ")), set list(val) { self.attr("class", val.join(" ")); },
each: function each(meth, arg) { each: function each(meth, arg) {
return self.each(function (elem) { return self.each(function (elem) {
@@ -335,13 +354,15 @@ var DOM = Class("DOM", {
}; };
}, },
get rect() this[0] instanceof Ci.nsIDOMWindow ? { width: this[0].scrollMaxX + this[0].innerWidth, get rect() {
return this[0] instanceof Ci.nsIDOMWindow ? { width: this[0].scrollMaxX + this[0].innerWidth,
height: this[0].scrollMaxY + this[0].innerHeight, height: this[0].scrollMaxY + this[0].innerHeight,
get right() this.width + this.left, get right() this.width + this.left,
get bottom() this.height + this.top, get bottom() this.height + this.top,
top: -this[0].scrollY, top: -this[0].scrollY,
left: -this[0].scrollX } : left: -this[0].scrollX } :
this[0] ? this[0].getBoundingClientRect() : {}, this[0] ? this[0].getBoundingClientRect() : {};
},
get viewport() { get viewport() {
let node = this[0]; let node = this[0];
@@ -350,8 +371,8 @@ var DOM = Class("DOM", {
if (node instanceof Ci.nsIDOMWindow) if (node instanceof Ci.nsIDOMWindow)
return { return {
get width() this.right - this.left, get width() { return this.right - this.left; },
get height() this.bottom - this.top, get height() { return this.bottom - this.top; },
bottom: node.innerHeight, bottom: node.innerHeight,
right: node.innerWidth, right: node.innerWidth,
top: 0, left: 0 top: 0, left: 0
@@ -362,9 +383,9 @@ var DOM = Class("DOM", {
width: node.clientWidth, width: node.clientWidth,
height: node.clientHeight, height: node.clientHeight,
top: r.top + node.clientTop, top: r.top + node.clientTop,
get bottom() this.top + this.height, get bottom() { return this.top + this.height; },
left: r.left + node.clientLeft, left: r.left + node.clientLeft,
get right() this.left + this.width get right() { return this.left + this.width; }
}; };
}, },
@@ -436,12 +457,18 @@ var DOM = Class("DOM", {
return editor; return editor;
}, },
get isEditable() !!this.editor || this[0] instanceof Ci.nsIDOMElement && this.style.MozUserModify == "read-write", get isEditable() {
return !!this.editor ||
this[0] instanceof Ci.nsIDOMElement &&
this.style.MozUserModify == "read-write";
},
get isInput() isinstance(this[0], [Ci.nsIDOMHTMLInputElement, get isInput() {
Ci.nsIDOMHTMLTextAreaElement, return isinstance(this[0], [Ci.nsIDOMHTMLInputElement,
Ci.nsIDOMXULTextBoxElement]) Ci.nsIDOMHTMLTextAreaElement,
&& this.isEditable, Ci.nsIDOMXULTextBoxElement])
&& this.isEditable;
},
/** /**
* Returns an object representing a Node's computed CSS style. * Returns an object representing a Node's computed CSS style.
@@ -987,10 +1014,14 @@ var DOM = Class("DOM", {
bubbles: true, cancelable: true, bubbles: true, cancelable: true,
view: doc.defaultView, view: doc.defaultView,
detail: 1, detail: 1,
get screenX() this.view.mozInnerScreenX get screenX() {
+ Math.max(0, this.clientX + (DOM(target || opts.target).rect.left || 0)), return this.view.mozInnerScreenX
get screenY() this.view.mozInnerScreenY + Math.max(0, this.clientX + (DOM(target || opts.target).rect.left || 0));
+ Math.max(0, this.clientY + (DOM(target || opts.target).rect.top || 0)), },
get screenY() {
return this.view.mozInnerScreenY
+ Math.max(0, this.clientY + (DOM(target || opts.target).rect.top || 0));
},
clientX: 0, clientX: 0,
clientY: 0, clientY: 0,
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
@@ -1847,8 +1878,8 @@ var DOM = Class("DOM", {
let res = { let res = {
iterateNext: function () result.iterateNext(), iterateNext: function () result.iterateNext(),
get resultType() result.resultType, get resultType() { return result.resultType; },
get snapshotLength() result.snapshotLength, get snapshotLength() { return result.snapshotLength; },
snapshotItem: function (i) result.snapshotItem(i) snapshotItem: function (i) result.snapshotItem(i)
}; };
if (asIterator) if (asIterator)
+20 -11
View File
@@ -68,24 +68,29 @@ var Download = Class("Download", {
return this; return this;
}, },
get active() !this.stopped, get active() { return !this.stopped; },
get targetFile() File(this.download.target.path), get targetFile() { return File(this.download.target.path); },
get displayName() this.targetFile.leafName, get displayName() { return this.targetFile.leafName; },
get status() states[this.state], get status() { return states[this.state]; },
inState: function inState(states) states.indexOf(this.status) >= 0, inState: function inState(states) states.indexOf(this.status) >= 0,
allowedCommands: Class.Memoize(function () { allowedCommands: Class.Memoize(function () {
let self = this; let self = this;
return { return {
get delete() !self.active && (self.targetFile.exists() || self.hasPartialData), get delete() {
get launch() self.targetFile.exists() && self.succeeded, return !self.active &&
get stop() self.active, (self.targetFile.exists() || self.hasPartialData);
get remove() !self.active, },
get resume() self.canceled get launch() {
return self.targetFile.exists() && self.succeeded;
},
get stop() { return self.active; },
get remove() { return !self.active; },
get resume() { return self.canceled; }
}; };
}), }),
@@ -318,7 +323,9 @@ var DownloadList = Class("DownloadList",
allowedCommands: Class.Memoize(function () { allowedCommands: Class.Memoize(function () {
let self = this; let self = this;
return { return {
get clear() iter(self.downloads.values()).some(dl => dl.allowedCommands.remove) get clear() {
return iter(self.downloads.values()).some(dl => dl.allowedCommands.remove);
}
}; };
}), }),
@@ -482,7 +489,9 @@ var Downloads_ = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), {
names: ["-sort", "-s"], names: ["-sort", "-s"],
description: "Sort order (see 'downloadsort')", description: "Sort order (see 'downloadsort')",
type: CommandOption.LIST, type: CommandOption.LIST,
get default() modules.options["downloadsort"], get default() {
return modules.options["downloadsort"];
},
completer: function (context, args) modules.options.get("downloadsort").completer(context, { values: args["-sort"] }), completer: function (context, args) modules.options.get("downloadsort").completer(context, { values: args["-sort"] }),
validator: function (value) modules.options.get("downloadsort").validator(value) validator: function (value) modules.options.get("downloadsort").validator(value)
} }
+33 -22
View File
@@ -44,8 +44,10 @@ var RangeFinder = Module("rangefinder", {
return this.rangeFind = null; return this.rangeFind = null;
return find; return find;
}, },
set rangeFind(val) overlay.setData(this.content.document, set rangeFind(val) {
"range-find", val) overlay.setData(this.content.document,
"range-find", val);
}
}), }),
init: function init() { init: function init() {
@@ -64,9 +66,9 @@ var RangeFinder = Module("rangefinder", {
} }
}, },
get commandline() this.modules.commandline, get commandline() { return this.modules.commandline; },
get modes() this.modules.modes, get modes() { return this.modules.modes; },
get options() this.modules.options, get options() { return this.modules.options; },
openPrompt: function openPrompt(mode) { openPrompt: function openPrompt(mode) {
this.modules.marks.push(); this.modules.marks.push();
@@ -256,12 +258,14 @@ var RangeFinder = Module("rangefinder", {
historyKey: "find", historyKey: "find",
get prompt() this.mode === modules.modes.FIND_BACKWARD ? "?" : "/", get prompt() {
return this.mode === modules.modes.FIND_BACKWARD ? "?" : "/";
},
get onCancel() modules.rangefinder.bound.onCancel, get onCancel() { return modules.rangefinder.bound.onCancel; },
get onChange() modules.rangefinder.bound.onChange, get onChange() { return modules.rangefinder.bound.onChange; },
get onHistory() modules.rangefinder.bound.onHistory, get onHistory() { return modules.rangefinder.bound.onHistory; },
get onSubmit() modules.rangefinder.bound.onSubmit get onSubmit() { return modules.rangefinder.bound.onSubmit; }
}); });
}, },
mappings: function initMappings(dactyl, modules, window) { mappings: function initMappings(dactyl, modules, window) {
@@ -384,17 +388,19 @@ var RangeFind = Class("RangeFind", {
this.lastString = ""; this.lastString = "";
}, },
get store() overlay.getData(this.content.document, "buffer", Object), get store() {
return overlay.getData(this.content.document, "buffer", Object);
},
get backward() this.finder.findBackwards, get backward() { return this.finder.findBackwards; },
set backward(val) this.finder.findBackwards = val, set backward(val) { this.finder.findBackwards = val; },
get matchCase() this.finder.caseSensitive, get matchCase() { return this.finder.caseSensitive; },
set matchCase(val) this.finder.caseSensitive = Boolean(val), set matchCase(val) { this.finder.caseSensitive = Boolean(val); },
get findString() this.lastString, get findString() { return this.lastString; },
get flags() this.matchCase ? "" : "i", get flags() { return this.matchCase ? "" : "i"; },
get selectedRange() { get selectedRange() {
let win = this.store.focusedFrame && this.store.focusedFrame.get() || this.content; let win = this.store.focusedFrame && this.store.focusedFrame.get() || this.content;
@@ -707,8 +713,10 @@ var RangeFind = Class("RangeFind", {
return range; return range;
}, },
get stale() this._stale || this.baseDocument.get() != this.content.document, get stale() {
set stale(val) this._stale = val, return this._stale || this.baseDocument.get() != this.content.document;
},
set stale(val) { this._stale = val; },
addListeners: function addListeners() { addListeners: function addListeners() {
for (let range of this.ranges) for (let range of this.ranges)
@@ -766,9 +774,12 @@ var RangeFind = Class("RangeFind", {
} }
}, },
get selectionController() this.docShell get selectionController() {
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsISelectionDisplay) return this.docShell
.QueryInterface(Ci.nsISelectionController), .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsISelectionDisplay)
.QueryInterface(Ci.nsISelectionController);
},
get selection() { get selection() {
try { try {
return this.selectionController.getSelection(Ci.nsISelectionController.SELECTION_NORMAL); return this.selectionController.getSelection(Ci.nsISelectionController.SELECTION_NORMAL);
+4 -4
View File
@@ -215,11 +215,11 @@ var Help = Module("Help", {
cache.flushEntry(entry, time); cache.flushEntry(entry, time);
}, },
get data() this._data || cache.get("help.json"), get data() { return this._data || cache.get("help.json"); },
get files() this.data.files, get files() { return this.data.files; },
get overlays() this.data.overlays, get overlays() { return this.data.overlays; },
get tags() this.data.tags, get tags() { return this.data.tags; },
Local: function Local(dactyl, modules, window) ({ Local: function Local(dactyl, modules, window) ({
init: function init() { init: function init() {
+10 -4
View File
@@ -63,9 +63,15 @@ Highlight.defaultValue("extends", function () this.defaultExtends);
Highlight.defaultValue("value", function () this.defaultValue); Highlight.defaultValue("value", function () this.defaultValue);
update(Highlight.prototype, { update(Highlight.prototype, {
get base() this.baseClass != this.class && highlight.highlight[this.baseClass] || null, get base() {
return this.baseClass != this.class &&
highlight.highlight[this.baseClass] ||
null;
},
get bases() Ary.compact(this.extends.map(name => highlight.get(name))), get bases() {
return Ary.compact(this.extends.map(name => highlight.get(name)));
},
get inheritedCSS() { get inheritedCSS() {
if (this.gettingCSS) if (this.gettingCSS)
@@ -79,9 +85,9 @@ update(Highlight.prototype, {
} }
}, },
get css() this.selector + "{" + this.cssText + "}", get css() { return this.selector + "{" + this.cssText + "}"; },
get cssText() this.inheritedCSS + this.value, get cssText() { return this.inheritedCSS + this.value; },
toString: function () "Highlight(" + this.class + ")\n\t" + toString: function () "Highlight(" + this.class + ")\n\t" +
[k + ": " + JSON.stringify(String(v)) [k + ": " + JSON.stringify(String(v))
+9 -5
View File
@@ -56,7 +56,7 @@ var IO = Module("io", {
historyKey: "file", historyKey: "file",
get mode() modules.modes.FILE_INPUT, get mode() { return modules.modes.FILE_INPUT; },
complete: function (context) { complete: function (context) {
if (this.completer) if (this.completer)
@@ -1161,8 +1161,10 @@ unlet s:cpo_save
"List of directories searched when executing :cd", "List of directories searched when executing :cd",
"stringlist", ["."].concat(services.environment.get("CDPATH").split(/[:;]/).filter(util.identity)).join(","), "stringlist", ["."].concat(services.environment.get("CDPATH").split(/[:;]/).filter(util.identity)).join(","),
{ {
get files() this.value.map(path => File(path, modules.io.cwd)) get files() {
.filter(dir => dir.exists()), return this.value.map(path => File(path, modules.io.cwd))
.filter(dir => dir.exists());
},
setter: function (value) File.expandPathList(value) setter: function (value) File.expandPathList(value)
}); });
@@ -1170,8 +1172,10 @@ unlet s:cpo_save
"List of directories searched for runtime files", "List of directories searched for runtime files",
"stringlist", IO.runtimePath, "stringlist", IO.runtimePath,
{ {
get files() this.value.map(path => File(path, modules.io.cwd)) get files() {
.filter(dir => dir.exists()) return this.value.map(path => File(path, modules.io.cwd))
.filter(dir => dir.exists());
}
}); });
options.add(["shell", "sh"], options.add(["shell", "sh"],
+3 -3
View File
@@ -448,7 +448,7 @@ var JavaScript = Module("javascript", {
return this.evalled(key); return this.evalled(key);
}, },
get cache() this.context.cache, get cache() { return this.context.cache; },
complete: function _complete(context) { complete: function _complete(context) {
const self = this; const self = this;
@@ -695,7 +695,7 @@ var JavaScript = Module("javascript", {
}, },
completion: function (dactyl, modules, window) { completion: function (dactyl, modules, window) {
update(modules.completion, { update(modules.completion, {
get javascript() modules.javascript.bound.complete, get javascript() { return modules.javascript.bound.complete; },
javascriptCompleter: JavaScript // Backwards compatibility javascriptCompleter: JavaScript // Backwards compatibility
}); });
}, },
@@ -808,7 +808,7 @@ var JavaScript = Module("javascript", {
mode: modes.REPL, mode: modes.REPL,
get completionList() this.widgets.statusbar.commandline.id, get completionList() { return this.widgets.statusbar.commandline.id; },
accept: function accept() { accept: function accept() {
dactyl.trapErrors(function () { this.repl.addOutput(this.command); }, this); dactyl.trapErrors(function () { this.repl.addOutput(this.command); }, this);
+7 -3
View File
@@ -176,11 +176,15 @@ var Modules = function Modules(window) {
newContext: newContext, newContext: newContext,
get ownPropertyValues() Ary.compact( get ownPropertyValues() {
return Ary.compact(
Object.getOwnPropertyNames(this) Object.getOwnPropertyNames(this)
.map(name => Object.getOwnPropertyDescriptor(this, name).value)), .map(name => Object.getOwnPropertyDescriptor(this, name).value));
},
get moduleList() this.ownPropertyValues.filter(mod => (mod instanceof this.ModuleBase || mod.isLocalModule)) get moduleList() {
return this.ownPropertyValues.filter(mod => (mod instanceof this.ModuleBase || mod.isLocalModule));
}
}); });
modules.plugins = create(modules); modules.plugins = create(modules);
+29 -26
View File
@@ -72,16 +72,16 @@ var Option = Class("Option", {
*/ */
description: Messages.Localized(""), description: Messages.Localized(""),
get helpTag() "'" + this.name + "'", get helpTag() { return "'" + this.name + "'"; },
initValue: function initValue() { initValue: function initValue() {
util.trapErrors(() => { this.value = this.value; }); util.trapErrors(() => { this.value = this.value; });
}, },
get isDefault() this.stringValue === this.stringDefaultValue, get isDefault() { return this.stringValue === this.stringDefaultValue; },
/** @property {value} The value to reset this option to at cleanup time. */ /** @property {value} The value to reset this option to at cleanup time. */
get cleanupValue() options.cleanupPrefs.get(this.name), get cleanupValue() { return options.cleanupPrefs.get(this.name); },
set cleanupValue(value) { set cleanupValue(value) {
if (options.cleanupPrefs.get(this.name) == null) if (options.cleanupPrefs.get(this.name) == null)
options.cleanupPrefs.set(this.name, value); options.cleanupPrefs.set(this.name, value);
@@ -194,14 +194,14 @@ var Option = Class("Option", {
* or if no local value is set, this is equal to the * or if no local value is set, this is equal to the
* (@link #globalValue). * (@link #globalValue).
*/ */
get value() this.get(), get value() { return this.get(); },
set value(val) this.set(val), set value(val) { this.set(val); },
get stringValue() this.stringify(this.value), get stringValue() { return this.stringify(this.value); },
set stringValue(value) this.value = this.parse(value), set stringValue(value) { this.value = this.parse(value); },
get stringDefaultValue() this.stringify(this.defaultValue), get stringDefaultValue() { return this.stringify(this.defaultValue); },
set stringDefaultValue(val) this.defaultValue = this.parse(val), set stringDefaultValue(val) { this.defaultValue = this.parse(val); },
getKey: function getKey(key) undefined, getKey: function getKey(key) undefined,
@@ -411,8 +411,11 @@ var Option = Class("Option", {
* @property {number} Returns the timestamp when the option's value was * @property {number} Returns the timestamp when the option's value was
* last changed. * last changed.
*/ */
get lastSet() options.store.get(this.name).time, get lastSet() { return options.store.get(this.name).time; },
set lastSet(val) { options.store.set(this.name, { value: this.globalValue, time: Date.now() }); }, set lastSet(val) {
options.store.set(this.name,
{ value: this.globalValue, time: Date.now() });
},
/** /**
* @property {nsIFile} The script in which this option was last set. null * @property {nsIFile} The script in which this option was last set. null
@@ -486,7 +489,7 @@ var Option = Class("Option", {
getKey: { getKey: {
stringlist: function stringlist(k) this.value.indexOf(k) >= 0, stringlist: function stringlist(k) this.value.indexOf(k) >= 0,
get charlist() this.stringlist, get charlist() { return this.stringlist; },
regexplist: function regexplist(k, default_=null) { regexplist: function regexplist(k, default_=null) {
for (let re of this.value) for (let re of this.value)
@@ -494,14 +497,14 @@ var Option = Class("Option", {
return re.result; return re.result;
return default_; return default_;
}, },
get regexpmap() this.regexplist, get regexpmap() { return this.regexplist; },
get sitelist() this.regexplist, get sitelist() { return this.regexplist; },
get sitemap() this.regexplist get sitemap() { return this.regexplist; }
}, },
domains: { domains: {
sitelist: function (vals) Ary.compact(vals.map(site => util.getHost(site.filter))), sitelist: function (vals) Ary.compact(vals.map(site => util.getHost(site.filter))),
get sitemap() this.sitelist get sitemap() { return this.sitelist; }
}, },
stringify: { stringify: {
@@ -512,9 +515,9 @@ var Option = Class("Option", {
stringmap: function (vals) [Option.quote(k, /:/) + ":" + Option.quote(v, /:/) for ([k, v] of iter(vals))].join(","), stringmap: function (vals) [Option.quote(k, /:/) + ":" + Option.quote(v, /:/) for ([k, v] of iter(vals))].join(","),
regexplist: function (vals) vals.join(","), regexplist: function (vals) vals.join(","),
get regexpmap() this.regexplist, get regexpmap() { return this.regexplist; },
get sitelist() this.regexplist, get sitelist() { return this.regexplist; },
get sitemap() this.regexplist get sitemap() { return this.regexplist; }
}, },
parse: { parse: {
@@ -580,7 +583,7 @@ var Option = Class("Option", {
testValues: { testValues: {
regexpmap: function regexpmap(vals, validator) vals.every(re => validator(re.result)), regexpmap: function regexpmap(vals, validator) vals.every(re => validator(re.result)),
get sitemap() this.regexpmap, get sitemap() { return this.regexpmap; },
stringlist: function stringlist(vals, validator) vals.every(validator, this), stringlist: function stringlist(vals, validator) vals.every(validator, this),
stringmap: function stringmap(vals, validator) values(vals).every(validator, this) stringmap: function stringmap(vals, validator) values(vals).every(validator, this)
}, },
@@ -717,11 +720,11 @@ var Option = Class("Option", {
} }
return null; return null;
}, },
get charlist() this.stringlist, get charlist() { return this.stringlist; },
get regexplist() this.stringlist, get regexplist() { return this.stringlist; },
get regexpmap() this.stringlist, get regexpmap() { return this.stringlist; },
get sitelist() this.stringlist, get sitelist() { return this.stringlist; },
get sitemap() this.stringlist get sitemap() { return this.stringlist; }
}, },
validIf: function validIf(test, error) { validIf: function validIf(test, error) {
@@ -1104,7 +1107,7 @@ var Options = Module("options", {
}, },
/** @property {Object} The options store. */ /** @property {Object} The options store. */
get store() storage.options get store() { return storage.options; }
}, { }, {
}, { }, {
commands: function initCommands(dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
+7 -5
View File
@@ -30,9 +30,9 @@ var Overlay = Class("Overlay", {
cleanups: Class.Memoize(() => []), cleanups: Class.Memoize(() => []),
objects: Class.Memoize(() => ({})), objects: Class.Memoize(() => ({})),
get doc() this.window.document, get doc() { return this.window.document; },
get win() this.window, get win() { return this.window; },
$: function $(sel, node) DOM(sel, node || this.doc), $: function $(sel, node) DOM(sel, node || this.doc),
@@ -463,9 +463,11 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
}; };
}, },
get activeModules() this.activeWindow && this.activeWindow.dactyl.modules, get activeModules() {
return this.activeWindow && this.activeWindow.dactyl.modules;
},
get modules() [w.dactyl.modules for (w of this.windows)], get modules() { return [w.dactyl.modules for (w of this.windows)]; },
/** /**
* The most recently active dactyl window. * The most recently active dactyl window.
@@ -475,7 +477,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
return this.windows.has(win) && win; return this.windows.has(win) && win;
}, },
set activeWindow(win) this._activeWindow = util.weakReference(win), set activeWindow(win) { this._activeWindow = util.weakReference(win); },
/** /**
* A list of extant dactyl windows. * A list of extant dactyl windows.
+8 -4
View File
@@ -33,9 +33,13 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
this.branches = memoize({ this.branches = memoize({
__proto__: this, __proto__: this,
get original() this.constructor(this.ORIGINAL + this.root), get original() {
get restore() this.constructor(this.RESTORE + this.root), return this.constructor(this.ORIGINAL + this.root);
get saved() this.constructor(this.SAVED + this.root) },
get restore() {
return this.constructor(this.RESTORE + this.root);
},
get saved() { return this.constructor(this.SAVED + this.root); }
}); });
if (!defaults) if (!defaults)
@@ -90,7 +94,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
/** /**
* Returns the full name of this object's preference branch. * Returns the full name of this object's preference branch.
*/ */
get root() this.branch.root, get root() { return this.branch.root; },
/** /**
* Returns the value of the preference *name*, or *defaultValue* if * Returns the value of the preference *name*, or *defaultValue* if
+2 -2
View File
@@ -100,8 +100,8 @@ function ProtocolBase() {
}; };
} }
ProtocolBase.prototype = { ProtocolBase.prototype = {
get contractID() services.PROTOCOL + this.scheme, get contractID() { return services.PROTOCOL + this.scheme; },
get classDescription() this.scheme + " utility protocol", get classDescription() { return this.scheme + " utility protocol"; },
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]), QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]),
purge: function purge() { purge: function purge() {
+38 -14
View File
@@ -31,10 +31,18 @@ update(Range.prototype, {
contains: function (date) date == null || contains: function (date) date == null ||
(this.min == null || date >= this.min) && (this.max == null || date <= this.max), (this.min == null || date >= this.min) && (this.max == null || date <= this.max),
get isEternity() this.max == null && this.min == null, get isEternity() {
get isSession() this.max == null && this.min == sanitizer.sessionStart, return this.max == null && this.min == null;
},
get isSession() {
return this.max == null && this.min == sanitizer.sessionStart;
},
get native() this.isEternity ? null : [this.min || 0, this.max == null ? Number.MAX_VALUE : this.max] get native() {
return this.isEternity ? null
: [this.min || 0, this.max == null ? Number.MAX_VALUE
: this.max];
}
}); });
var Item = Class("SanitizeItem", { var Item = Class("SanitizeItem", {
@@ -49,10 +57,14 @@ var Item = Class("SanitizeItem", {
description: Messages.Localized(""), description: Messages.Localized(""),
get cpdPref() (this.builtin ? "" : Item.PREFIX) + Item.BRANCH + Sanitizer.argToPref(this.name), get cpdPref() {
get shutdownPref() (this.builtin ? "" : Item.PREFIX) + Item.SHUTDOWN_BRANCH + Sanitizer.argToPref(this.name), return (this.builtin ? "" : Item.PREFIX) + Item.BRANCH + Sanitizer.argToPref(this.name);
get cpd() prefs.get(this.cpdPref), },
get shutdown() prefs.get(this.shutdownPref), get shutdownPref() {
return (this.builtin ? "" : Item.PREFIX) + Item.SHUTDOWN_BRANCH + Sanitizer.argToPref(this.name);
},
get cpd() { return prefs.get(this.cpdPref); },
get shutdown() { return prefs.get(this.shutdownPref); },
shouldSanitize: function (shutdown) (!shutdown || this.builtin || this.persistent) && shouldSanitize: function (shutdown) (!shutdown || this.builtin || this.persistent) &&
prefs.get(shutdown ? this.shutdownPref : this.pref) prefs.get(shutdown ? this.shutdownPref : this.pref)
@@ -317,10 +329,18 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
return thing.QueryInterface(Ci.nsILoadContext); return thing.QueryInterface(Ci.nsILoadContext);
}, },
get ranAtShutdown() config.prefs.get("didSanitizeOnShutdown"), get ranAtShutdown() {
set ranAtShutdown(val) config.prefs.set("didSanitizeOnShutdown", Boolean(val)), return config.prefs.get("didSanitizeOnShutdown");
get runAtShutdown() prefs.get("privacy.sanitize.sanitizeOnShutdown"), },
set runAtShutdown(val) prefs.set("privacy.sanitize.sanitizeOnShutdown", Boolean(val)), set ranAtShutdown(val) {
config.prefs.set("didSanitizeOnShutdown", Boolean(val));
},
get runAtShutdown() {
return prefs.get("privacy.sanitize.sanitizeOnShutdown");
},
set runAtShutdown(val) {
prefs.set("privacy.sanitize.sanitizeOnShutdown", Boolean(val));
},
sanitize: function sanitize(items, range) sanitize: function sanitize(items, range)
this.withSavedValues(["sanitizing"], function () { this.withSavedValues(["sanitizing"], function () {
@@ -607,7 +627,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
"The default list of private items to sanitize", "The default list of private items to sanitize",
"stringlist", "all", "stringlist", "all",
{ {
get values() values(sanitizer.itemMap).toArray(), get values() { return values(sanitizer.itemMap).toArray(); },
completer: function completer(context, extra) { completer: function completer(context, extra) {
if (context.filter[0] == "!") if (context.filter[0] == "!")
@@ -630,7 +650,11 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
"stringlist", "", "stringlist", "",
{ {
initialValue: true, initialValue: true,
get values() [i for (i of values(sanitizer.itemMap)) if (i.persistent || i.builtin)], get values() {
return [i
for (i of values(sanitizer.itemMap))
if (i.persistent || i.builtin)];
},
getter: function () !sanitizer.runAtShutdown ? [] : [ getter: function () !sanitizer.runAtShutdown ? [] : [
item.name for (item of values(sanitizer.itemMap)) item.name for (item of values(sanitizer.itemMap))
if (item.shouldSanitize(true)) if (item.shouldSanitize(true))
@@ -671,7 +695,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
options.add(["cookies", "ck"], options.add(["cookies", "ck"],
"The default mode for newly added cookie permissions", "The default mode for newly added cookie permissions",
"stringlist", "session", "stringlist", "session",
{ get values() Sanitizer.COMMANDS }); { get values() { return Sanitizer.COMMANDS; }});
options.add(["cookieaccept", "ca"], options.add(["cookieaccept", "ca"],
"When to accept cookies", "When to accept cookies",
+15 -9
View File
@@ -25,7 +25,7 @@ var StoreBase = Class("StoreBase", {
fireEvent: function (event, arg) { storage.fireEvent(this.name, event, arg); }, fireEvent: function (event, arg) { storage.fireEvent(this.name, event, arg); },
get serial() JSON.stringify(this._object, this.replacer), get serial() { return JSON.stringify(this._object, this.replacer); },
init: function init(name, store, load, options) { init: function init(name, store, load, options) {
this._load = load; this._load = load;
@@ -76,7 +76,7 @@ var StoreBase = Class("StoreBase", {
var ArrayStore = Class("ArrayStore", StoreBase, { var ArrayStore = Class("ArrayStore", StoreBase, {
_constructor: Array, _constructor: Array,
get length() this._object.length, get length() { return this._object.length; },
set: function set(index, value, quiet) { set: function set(index, value, quiet) {
var orig = this._object[index]; var orig = this._object[index];
@@ -353,7 +353,7 @@ var Storage = Module("Storage", {
}, },
_privateMode: false, _privateMode: false,
get privateMode() this._privateMode, get privateMode() { return this._privateMode; },
set privateMode(enabled) { set privateMode(enabled) {
this._privateMode = Boolean(enabled); this._privateMode = Boolean(enabled);
@@ -452,7 +452,7 @@ var File = Class("File", {
return file.QueryInterface(Ci.nsILocalFile); return file.QueryInterface(Ci.nsILocalFile);
}), }),
get async() AsyncFile(this), get async() { return AsyncFile(this); },
charset: Class.Memoize(() => File.defaultEncoding), charset: Class.Memoize(() => File.defaultEncoding),
@@ -493,15 +493,21 @@ var File = Class("File", {
return this.constructor(newPath, null, this.charset); return this.constructor(newPath, null, this.charset);
}, },
get fileName() OS.Path.basename(this.path), get fileName() { return OS.Path.basename(this.path); },
get parent() this.constructor(OS.Path.dirname(this.path), null, this.charset), get parent() {
return this.constructor(OS.Path.dirname(this.path),
null,
this.charset);
},
/** /**
* Returns an iterator for all lines in a file. * Returns an iterator for all lines in a file.
*/ */
get lines() File.readLines(services.FileInStream(this.file, -1, 0, 0), get lines() {
this.charset), return File.readLines(services.FileInStream(this.file, -1, 0, 0),
this.charset);
},
/** /**
* Reads this file's entire contents in "text" mode and returns the * Reads this file's entire contents in "text" mode and returns the
@@ -834,7 +840,7 @@ var File = Class("File", {
} }
var AsyncFile = Class("AsyncFile", File, { var AsyncFile = Class("AsyncFile", File, {
get async() this, get async() { return this; },
/* /*
* Creates a new directory, along with any parent directories which * Creates a new directory, along with any parent directories which
+39 -26
View File
@@ -40,9 +40,12 @@ update(Sheet.prototype, {
remove: function () { this.hive.remove(this); }, remove: function () { this.hive.remove(this); },
get uri() "dactyl://style/" + this.id + "/" + this.hive.name + "/" + (this.name || ""), get uri() {
return "dactyl://style/" + this.id + "/" +
this.hive.name + "/" + (this.name || "");
},
get enabled() this._enabled, get enabled() { return this._enabled; },
set enabled(on) { set enabled(on) {
if (on != this._enabled || this.fullCSS != this._fullCSS) { if (on != this._enabled || this.fullCSS != this._fullCSS) {
if (on) if (on)
@@ -94,7 +97,7 @@ var Hive = Class("Hive", {
this.persist = persist; this.persist = persist;
}, },
get modifiable() this.name !== "system", get modifiable() { return this.name !== "system"; },
addRef: function (obj) { addRef: function (obj) {
this.refs.push(util.weakReference(obj)); this.refs.push(util.weakReference(obj));
@@ -118,9 +121,11 @@ var Hive = Class("Hive", {
"@@iterator": function () iter(this.sheets), "@@iterator": function () iter(this.sheets),
get sites() Ary(this.sheets).map(s => s.sites) get sites() {
.flatten() return Ary(this.sheets).map(s => s.sites)
.uniq().array, .flatten()
.uniq().array;
},
/** /**
* Add a new style sheet. * Add a new style sheet.
@@ -503,7 +508,8 @@ var Styles = Module("Styles", {
}), }),
patterns: memoize({ patterns: memoize({
get property() util.regexp(literal(function () /* get property() {
return util.regexp(literal(function () /*
(?: (?:
(?P<preSpace> <space>*) (?P<preSpace> <space>*)
(?P<name> [-a-z]*) (?P<name> [-a-z]*)
@@ -514,36 +520,43 @@ var Styles = Module("Styles", {
)? )?
) )
(?P<postSpace> <space>* (?: ; | $) ) (?P<postSpace> <space>* (?: ; | $) )
*/$), "gix", this), */$), "gix", this);
},
get function() util.regexp(literal(function () /* get function() {
return util.regexp(literal(function () /*
(?P<function> (?P<function>
\s* \( \s* \s* \( \s*
(?: <string> | [^)]* ) (?: <string> | [^)]* )
\s* (?: \) | $) \s* (?: \) | $)
) )
*/$), "gx", this), */$), "gx", this);
},
space: /(?: \s | \/\* .*? \*\/ )/, space: /(?: \s | \/\* .*? \*\/ )/,
get string() util.regexp(literal(function () /* get string() {
return util.regexp(literal(function () /*
(?P<string> (?P<string>
" (?:[^\\"]|\\.)* (?:"|$) | " (?:[^\\"]|\\.)* (?:"|$) |
' (?:[^\\']|\\.)* (?:'|$) ' (?:[^\\']|\\.)* (?:'|$)
) )
*/$), "gx", this), */$), "gx", this);
},
get token() util.regexp(literal(function () /* get token() {
(?P<token> return util.regexp(literal(function () /*
(?P<word> [-\w]+) (?P<token>
<function>? (?P<word> [-\w]+)
\s* <function>?
| (?P<important> !important\b) \s*
| \s* <string> \s* | (?P<important> !important\b)
| <space>+ | \s* <string> \s*
| [^;}\s]+ | <space>+
) | [^;}\s]+
*/$), "gix", this) )
*/$), "gix", this);
}
}), }),
/** /**
@@ -713,9 +726,9 @@ var Styles = Module("Styles", {
this.hive = styles.addHive(group.name, this, this.persist); this.hive = styles.addHive(group.name, this, this.persist);
}, },
get names() this.hive.names, get names() { return this.hive.names; },
get sheets() this.hive.sheets, get sheets() { return this.hive.sheets; },
get sites() this.hive.sites, get sites() { return this.hive.sites; },
__noSuchMethod__: function __noSuchMethod__(meth, args) { __noSuchMethod__: function __noSuchMethod__(meth, args) {
return apply(this.hive, meth, args); return apply(this.hive, meth, args);
+5 -2
View File
@@ -30,7 +30,7 @@ var Binding = Class("Binding", {
else else
this.removeAttribute("collapsed"); this.removeAttribute("collapsed");
}, },
get collapsed() !!this.getAttribute("collapsed"), get collapsed() { return !!this.getAttribute("collapsed"); },
__noSuchMethod__: Class.Property({ __noSuchMethod__: Class.Property({
configurable: true, configurable: true,
@@ -103,7 +103,10 @@ var Template = Module("Template", {
this.target = params.commandTarget; this.target = params.commandTarget;
}, },
get command() this.getAttribute("command") || this.getAttribute("key"), get command() {
return this.getAttribute("command") ||
this.getAttribute("key");
},
events: { events: {
"click": function onClick(event) { "click": function onClick(event) {
+3 -3
View File
@@ -22,7 +22,7 @@ var Magic = Class("Magic", {
this.str = str; this.str = str;
}, },
get message() this.str, get message() { return this.str; },
toString: function () this.str toString: function () this.str
}); });
@@ -862,8 +862,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @returns {Object} * @returns {Object}
*/ */
intersection: function intersection(r1, r2) ({ intersection: function intersection(r1, r2) ({
get width() this.right - this.left, get width() { return this.right - this.left; },
get height() this.bottom - this.top, get height() { return this.bottom - this.top; },
left: Math.max(r1.left, r2.left), left: Math.max(r1.left, r2.left),
right: Math.min(r1.right, r2.right), right: Math.min(r1.right, r2.right),
top: Math.max(r1.top, r2.top), top: Math.max(r1.top, r2.top),
+7 -4
View File
@@ -31,8 +31,8 @@ const Config = Module("config", ConfigBase, {
// FIXME: unless I'm seeing double in in the wee small hours gBrowser is // FIXME: unless I'm seeing double in in the wee small hours gBrowser is
// first set from getBrowser which they've deprecated in FF. // first set from getBrowser which they've deprecated in FF.
get browser() window.getBrowser(), get browser() { return window.getBrowser(); },
get tabbrowser() window.getBrowser(), get tabbrowser() { return window.getBrowser(); },
dialogs: { dialogs: {
about: ["About Songbird", about: ["About Songbird",
@@ -86,7 +86,10 @@ const Config = Module("config", ConfigBase, {
modes.pop(); modes.pop();
}, },
get isPlayerWindow() window.SBGetBrowser().mCurrentTab == window.SBGetBrowser().mediaTab, get isPlayerWindow() {
let browser = window.SBGetBrowser();
return browser.mCurrentTab == browser.mediaTab;
},
/** /**
* Shows or hides the main service pane. * Shows or hides the main service pane.
@@ -138,7 +141,7 @@ const Config = Module("config", ConfigBase, {
defaults: { defaults: {
guioptions: "bCmprs", guioptions: "bCmprs",
showtabline: 2, showtabline: 2,
get titlestring() config.name get titlestring() { return config.name; }
}, },
guioptions: { guioptions: {
+8 -6
View File
@@ -80,12 +80,12 @@ const Player = Module("player", {
}, },
/** @property {sbIMediaListView} The current media list view. @private */ /** @property {sbIMediaListView} The current media list view. @private */
get _currentView() SBGetBrowser().currentMediaListView, get _currentView() { return SBGetBrowser().currentMediaListView; },
/** /**
* @property {number} The player volume in the range 0.0-1.0. * @property {number} The player volume in the range 0.0-1.0.
*/ */
get volume() gMM.volumeControl.volume, get volume() { return gMM.volumeControl.volume; },
set volume(value) { set volume(value) {
gMM.volumeControl.volume = value; gMM.volumeControl.volume = value;
}, },
@@ -465,11 +465,13 @@ const Player = Module("player", {
historyKey: "search-view", historyKey: "search-view",
get prompt() this.mode === modules.modes.SEARCH_VIEW_BACKWARD ? "?" : "/", get prompt() {
return this.mode === modules.modes.SEARCH_VIEW_BACKWARD ? "?" : "/";
},
get onCancel() player.closure.onSearchCancel, get onCancel() { return player.closure.onSearchCancel; },
get onChange() player.closure.onSearchKeyPress, get onChange() { return player.closure.onSearchKeyPress; },
get onSubmit() player.closure.onSearchSubmit get onSubmit() { return player.closure.onSearchSubmit; }
}); });
}, },
commands: function initCommands() { commands: function initCommands() {
+18 -13
View File
@@ -16,18 +16,21 @@ var Config = Module("config", ConfigBase, {
util.overlayWindow(window, { append: <><hbox id="statusTextBox" flex=""/></> }); util.overlayWindow(window, { append: <><hbox id="statusTextBox" flex=""/></> });
}, },
get browser() get browser() {
let (tabmail = document.getElementById('tabmail')) return let (tabmail = document.getElementById('tabmail'))
tabmail && tabmail.tabInfo.length ? tabmail.getBrowserForSelectedTab() tabmail && tabmail.tabInfo.length ? tabmail.getBrowserForSelectedTab()
: document.getElementById("messagepane"), : document.getElementById("messagepane");
},
tabbrowser: { tabbrowser: {
__proto__: Class.makeClosure.call(window.document.getElementById("tabmail")), __proto__: Class.makeClosure.call(window.document.getElementById("tabmail")),
get mTabContainer() this.tabContainer, get mTabContainer() { return this.tabContainer; },
get mTabs() this.tabContainer.childNodes, get mTabs() { return this.tabContainer.childNodes; },
get mCurrentTab() this.tabContainer.selectedItem, get mCurrentTab() { return this.tabContainer.selectedItem; },
get mStrip() this.tabStrip, get mStrip() { return this.tabStrip; },
get browsers() [browser for (browser in Iterator(this.mTabs))], get browsers() {
return [browser for (browser in Iterator(this.mTabs))];
},
removeTab: function removeTab(tab) this.closeTab(tab), removeTab: function removeTab(tab) this.closeTab(tab),
@@ -39,13 +42,15 @@ var Config = Module("config", ConfigBase, {
} }
}, },
get tabStip() this.tabbrowser.tabContainer, get tabStip() { return this.tabbrowser.tabContainer; },
get mainWidget() this.isComposeWindow ? document.getElementById("content-frame") : window.GetThreadTree(), get mainWidget() {
return this.isComposeWindow ? document.getElementById("content-frame") : window.GetThreadTree();
},
get browserModes() [modules.modes.MESSAGE], get browserModes() { return [modules.modes.MESSAGE]; },
get mailModes() [modules.modes.NORMAL], get mailModes() { return [modules.modes.NORMAL]; },
// NOTE: as I don't use TB I have no idea how robust this is. --djk // NOTE: as I don't use TB I have no idea how robust this is. --djk
get outputHeight() { get outputHeight() {
+2 -2
View File
@@ -125,9 +125,9 @@ var Mail = Module("mail", {
return "\"" + recipient + "\""; return "\"" + recipient + "\"";
}, },
get currentAccount() this.currentFolder.rootFolder, get currentAccount() { return this.currentFolder.rootFolder; },
get currentFolder() gFolderTreeView.getSelectedFolders()[0], get currentFolder() { return gFolderTreeView.getSelectedFolders()[0]; },
/** @property {[nsISmtpServer]} The list of configured SMTP servers. */ /** @property {[nsISmtpServer]} The list of configured SMTP servers. */
get smtpServers() { get smtpServers() {