mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 05:58:03 +01:00
Run style bot.
--HG-- extra : rebase_source : 3661ea16c48258e44239734cdad6bc18abc70b5f
This commit is contained in:
9
HACKING
9
HACKING
@@ -87,7 +87,7 @@ In general: Just look at the existing source code!
|
|||||||
https://developer.mozilla.org/en/New_in_JavaScript_1.7#Block_scope_with_let
|
https://developer.mozilla.org/en/New_in_JavaScript_1.7#Block_scope_with_let
|
||||||
|
|
||||||
* Reuse common local variable names E.g. "elem" is generally used for element,
|
* Reuse common local variable names E.g. "elem" is generally used for element,
|
||||||
"win" for windows, "func" for functions, "ret" for return values etc.
|
"win" for windows, "func" for functions, "res" for return values etc.
|
||||||
|
|
||||||
* Prefer // over /* */ comments (exceptions for big comments are usually OK)
|
* Prefer // over /* */ comments (exceptions for big comments are usually OK)
|
||||||
Right: if (HACK) // TODO: remove hack
|
Right: if (HACK) // TODO: remove hack
|
||||||
@@ -138,12 +138,7 @@ In general: Just look at the existing source code!
|
|||||||
Functional tests are implemented using the Mozmill automated testing framework
|
Functional tests are implemented using the Mozmill automated testing framework
|
||||||
-- https://developer.mozilla.org/en/Mozmill_Tests.
|
-- https://developer.mozilla.org/en/Mozmill_Tests.
|
||||||
|
|
||||||
A fresh profile is created for the duration of the test run, however, passing
|
A fresh profile is created for the duration of the test run.
|
||||||
arguments to the host application won't be supported until Mozmill 1.5.2, the
|
|
||||||
next release, so any user RC and plugin files should be temporarily disabled.
|
|
||||||
This can be done by adding the following to the head of the RC file:
|
|
||||||
set loadplugins=
|
|
||||||
finish
|
|
||||||
|
|
||||||
The host application binary tested can be overridden via the HOSTAPP_PATH
|
The host application binary tested can be overridden via the HOSTAPP_PATH
|
||||||
makefile variable. E.g.,
|
makefile variable. E.g.,
|
||||||
|
|||||||
1
common/bootstrap.js
vendored
1
common/bootstrap.js
vendored
@@ -41,7 +41,6 @@ if (!JSMLoader && "@mozilla.org/fuel/application;1" in Components.classes)
|
|||||||
.getService(Components.interfaces.extIApplication)
|
.getService(Components.interfaces.extIApplication)
|
||||||
.storage.get("dactyl.JSMLoader", null);
|
.storage.get("dactyl.JSMLoader", null);
|
||||||
|
|
||||||
|
|
||||||
function reportError(e) {
|
function reportError(e) {
|
||||||
dump("\ndactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack) + "\n");
|
dump("\ndactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack) + "\n");
|
||||||
Cu.reportError(e);
|
Cu.reportError(e);
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
completer: function title(context, args) {
|
completer: function title(context, args) {
|
||||||
let frames = buffer.allFrames();
|
let frames = buffer.allFrames();
|
||||||
if (!args.bang)
|
if (!args.bang)
|
||||||
return [
|
return [
|
||||||
[win.document.title, frames.length == 1 ? "Current Location" : "Frame: " + win.location.href]
|
[win.document.title, frames.length == 1 ? "Current Location" : "Frame: " + win.location.href]
|
||||||
for ([, win] in Iterator(frames))];
|
for ([, win] in Iterator(frames))];
|
||||||
context.keys.text = "title";
|
context.keys.text = "title";
|
||||||
@@ -521,7 +521,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
let context = CompletionContext(args.join(" "));
|
let context = CompletionContext(args.join(" "));
|
||||||
context.fork("bookmark", 0, completion, "bookmark",
|
context.fork("bookmark", 0, completion, "bookmark",
|
||||||
args["-tags"], { keyword: args["-keyword"], title: args["-title"] });
|
args["-tags"], { keyword: args["-keyword"], title: args["-title"] });
|
||||||
var deletedCount = bookmarks.remove(context.allItems.items.map(function (item) item.item.id));
|
deletedCount = bookmarks.remove(context.allItems.items.map(function (item) item.item.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
dactyl.echomsg({ message: _("bookmark.deleted", deletedCount) });
|
dactyl.echomsg({ message: _("bookmark.deleted", deletedCount) });
|
||||||
|
|||||||
@@ -742,7 +742,7 @@ var Buffer = Module("buffer", {
|
|||||||
* Shifts the focus to another frame within the buffer. Each buffer
|
* Shifts the focus to another frame within the buffer. Each buffer
|
||||||
* contains at least one frame.
|
* contains at least one frame.
|
||||||
*
|
*
|
||||||
* @param {number} count The number of frames to skip through. A negative
|
* @param {number} count The number of frames to skip through. A negative
|
||||||
* count skips backwards.
|
* count skips backwards.
|
||||||
*/
|
*/
|
||||||
shiftFrameFocus: function shiftFrameFocus(count) {
|
shiftFrameFocus: function shiftFrameFocus(count) {
|
||||||
@@ -1006,14 +1006,14 @@ var Buffer = Module("buffer", {
|
|||||||
* Adjusts the page zoom of the current buffer relative to the
|
* Adjusts the page zoom of the current buffer relative to the
|
||||||
* current zoom level.
|
* current zoom level.
|
||||||
*
|
*
|
||||||
* @param {number} steps The integral number of natural fractions by
|
* @param {number} steps The integral number of natural fractions by which
|
||||||
* which to adjust the current page zoom. If positive, the zoom
|
* to adjust the current page zoom. If positive, the zoom level is
|
||||||
* level is increased, if negative it is decreased.
|
* increased, if negative it is decreased.
|
||||||
* @param {boolean} fullZoom If true, zoom all content of the page,
|
* @param {boolean} fullZoom If true, zoom all content of the page,
|
||||||
* including raster images. If false, zoom only text. If omitted,
|
* including raster images. If false, zoom only text. If omitted, use
|
||||||
* use the current zoom function. @optional
|
* the current zoom function. @optional
|
||||||
* @throws {FailedAssertion} if the buffer's zoom level is already
|
* @throws {FailedAssertion} if the buffer's zoom level is already at its
|
||||||
* at its extreme in the given direction.
|
* extreme in the given direction.
|
||||||
*/
|
*/
|
||||||
bumpZoomLevel: function bumpZoomLevel(steps, fullZoom) {
|
bumpZoomLevel: function bumpZoomLevel(steps, fullZoom) {
|
||||||
if (fullZoom === undefined)
|
if (fullZoom === undefined)
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ var CommandWidgets = Class("CommandWidgets", {
|
|||||||
if (obj.value != null)
|
if (obj.value != null)
|
||||||
return [obj.value[0],
|
return [obj.value[0],
|
||||||
obj.get ? obj.get.call(this, elem) : elem.value]
|
obj.get ? obj.get.call(this, elem) : elem.value]
|
||||||
.concat(obj.value.slice(2))
|
.concat(obj.value.slice(2));
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -732,7 +732,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
if (!list)
|
if (!list)
|
||||||
res += list = <ul/>;
|
res += list = <ul/>;
|
||||||
let li = <li/>;
|
let li = <li/>;
|
||||||
li.* += rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1, li)
|
li.* += rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1, li);
|
||||||
list.* += li;
|
list.* += li;
|
||||||
}
|
}
|
||||||
else if (match.par) {
|
else if (match.par) {
|
||||||
@@ -853,51 +853,51 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
.split(" "));
|
.split(" "));
|
||||||
function fix(node) {
|
function fix(node) {
|
||||||
switch(node.nodeType) {
|
switch(node.nodeType) {
|
||||||
case Node.ELEMENT_NODE:
|
case Node.ELEMENT_NODE:
|
||||||
if (isinstance(node, [HTMLBaseElement]))
|
if (isinstance(node, [HTMLBaseElement]))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
data.push("<"); data.push(node.localName);
|
data.push("<"); data.push(node.localName);
|
||||||
if (node instanceof HTMLHtmlElement)
|
if (node instanceof HTMLHtmlElement)
|
||||||
data.push(" xmlns=" + XHTML.uri.quote());
|
data.push(" xmlns=" + XHTML.uri.quote());
|
||||||
|
|
||||||
for (let { name, value } in array.iterValues(node.attributes)) {
|
for (let { name, value } in array.iterValues(node.attributes)) {
|
||||||
if (name == "dactyl:highlight") {
|
if (name == "dactyl:highlight") {
|
||||||
set.add(styles, value);
|
set.add(styles, value);
|
||||||
name = "class";
|
name = "class";
|
||||||
value = "hl-" + value;
|
value = "hl-" + value;
|
||||||
}
|
|
||||||
if (name == "href") {
|
|
||||||
value = node.href || value;
|
|
||||||
if (value.indexOf("dactyl://help-tag/") == 0) {
|
|
||||||
let uri = services.io.newChannel(value, null, null).originalURI;
|
|
||||||
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
|
|
||||||
}
|
|
||||||
if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
|
|
||||||
value = value.replace(/(#|$)/, ".xhtml$1");
|
|
||||||
}
|
|
||||||
if (name == "src" && value.indexOf(":") > 0) {
|
|
||||||
chromeFiles[value] = value.replace(/.*\//, "");
|
|
||||||
value = value.replace(/.*\//, "");
|
|
||||||
}
|
|
||||||
data.push(" ");
|
|
||||||
data.push(name);
|
|
||||||
data.push('="');
|
|
||||||
data.push(<>{value}</>.toXMLString().replace(/"/g, """));
|
|
||||||
data.push('"');
|
|
||||||
}
|
}
|
||||||
if (node.localName in empty)
|
if (name == "href") {
|
||||||
data.push(" />");
|
value = node.href || value;
|
||||||
else {
|
if (value.indexOf("dactyl://help-tag/") == 0) {
|
||||||
data.push(">");
|
let uri = services.io.newChannel(value, null, null).originalURI;
|
||||||
if (node instanceof HTMLHeadElement)
|
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
|
||||||
data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString());
|
}
|
||||||
Array.map(node.childNodes, fix);
|
if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
|
||||||
data.push("</"); data.push(node.localName); data.push(">");
|
value = value.replace(/(#|$)/, ".xhtml$1");
|
||||||
}
|
}
|
||||||
break;
|
if (name == "src" && value.indexOf(":") > 0) {
|
||||||
case Node.TEXT_NODE:
|
chromeFiles[value] = value.replace(/.*\//, "");
|
||||||
data.push(<>{node.textContent}</>.toXMLString());
|
value = value.replace(/.*\//, "");
|
||||||
|
}
|
||||||
|
data.push(" ");
|
||||||
|
data.push(name);
|
||||||
|
data.push('="');
|
||||||
|
data.push(<>{value}</>.toXMLString().replace(/"/g, """));
|
||||||
|
data.push('"');
|
||||||
|
}
|
||||||
|
if (node.localName in empty)
|
||||||
|
data.push(" />");
|
||||||
|
else {
|
||||||
|
data.push(">");
|
||||||
|
if (node instanceof HTMLHeadElement)
|
||||||
|
data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString());
|
||||||
|
Array.map(node.childNodes, fix);
|
||||||
|
data.push("</"); data.push(node.localName); data.push(">");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Node.TEXT_NODE:
|
||||||
|
data.push(<>{node.textContent}</>.toXMLString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1811,7 +1811,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
bang: true,
|
bang: true,
|
||||||
keepQuotes: true,
|
keepQuotes: true,
|
||||||
serialGroup: 10,
|
serialGroup: 10,
|
||||||
serialize: function () [
|
serialize: function () [
|
||||||
{
|
{
|
||||||
command: this.name,
|
command: this.name,
|
||||||
literalArg: options["loadplugins"].join(" ")
|
literalArg: options["loadplugins"].join(" ")
|
||||||
|
|||||||
@@ -230,11 +230,11 @@ var Editor = Module("editor", {
|
|||||||
* Edits the given file in the external editor as specified by the
|
* Edits the given file in the external editor as specified by the
|
||||||
* 'editor' option.
|
* 'editor' option.
|
||||||
*
|
*
|
||||||
* @param {object|File|string} args An object specifying the file,
|
* @param {object|File|string} args An object specifying the file, line,
|
||||||
* line, and column to edit. If a non-object is specified, it is
|
* and column to edit. If a non-object is specified, it is treated as
|
||||||
* treated as the file parameter of the object.
|
* the file parameter of the object.
|
||||||
* @param {boolean} blocking If true, this function does not return
|
* @param {boolean} blocking If true, this function does not return
|
||||||
* until the editor exits.
|
* until the editor exits.
|
||||||
*/
|
*/
|
||||||
editFileExternally: function (args, blocking) {
|
editFileExternally: function (args, blocking) {
|
||||||
if (!isObject(args) || args instanceof File)
|
if (!isObject(args) || args instanceof File)
|
||||||
|
|||||||
@@ -837,7 +837,7 @@ var Hints = Module("hints", {
|
|||||||
* returns true if each set of characters typed can be found, in any
|
* returns true if each set of characters typed can be found, in any
|
||||||
* order, in the link.
|
* order, in the link.
|
||||||
*
|
*
|
||||||
* @param {string} hintString The string typed by the user.
|
* @param {string} hintString The string typed by the user.
|
||||||
* @returns {function(String):boolean} A function that takes the text
|
* @returns {function(String):boolean} A function that takes the text
|
||||||
* of a hint and returns true if all the (space-delimited) sets of
|
* of a hint and returns true if all the (space-delimited) sets of
|
||||||
* characters typed by the user can be found in it.
|
* characters typed by the user can be found in it.
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ var StatusLine = Module("statusline", {
|
|||||||
util.overlayWindow(window, { append: <><statusbar id="status-bar" ordinal="0"/></> });
|
util.overlayWindow(window, { append: <><statusbar id="status-bar" ordinal="0"/></> });
|
||||||
|
|
||||||
highlight.loadCSS(util.compileMacro(<![CDATA[
|
highlight.loadCSS(util.compileMacro(<![CDATA[
|
||||||
!AddonBar;#addon-bar {
|
!AddonBar;#addon-bar {
|
||||||
padding-left: 0 !important;
|
padding-left: 0 !important;
|
||||||
min-height: 18px !important;
|
min-height: 18px !important;
|
||||||
-moz-appearance: none !important;
|
-moz-appearance: none !important;
|
||||||
<padding>
|
<padding>
|
||||||
}
|
}
|
||||||
!AddonButton;#addon-bar xul|toolbarbutton {
|
!AddonButton;#addon-bar xul|toolbarbutton {
|
||||||
-moz-appearance: none !important;
|
-moz-appearance: none !important;
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
border-width: 0px !important;
|
border-width: 0px !important;
|
||||||
@@ -149,7 +149,7 @@ var StatusLine = Module("statusline", {
|
|||||||
this.timeout(function () {
|
this.timeout(function () {
|
||||||
this.status = message || buffer.uri;
|
this.status = message || buffer.uri;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -300,7 +300,7 @@ var StatusLine = Module("statusline", {
|
|||||||
*/
|
*/
|
||||||
progress: Modes.boundProperty({
|
progress: Modes.boundProperty({
|
||||||
get: function progress() this._progress,
|
get: function progress() this._progress,
|
||||||
set: function progress(progress) {
|
set: function progress(progress) {
|
||||||
this._progress = progress || "";
|
this._progress = progress || "";
|
||||||
|
|
||||||
if (typeof progress == "string")
|
if (typeof progress == "string")
|
||||||
|
|||||||
@@ -1398,7 +1398,7 @@ var Commands = Module("commands", {
|
|||||||
util.assert(args["-group"].modifiable,
|
util.assert(args["-group"].modifiable,
|
||||||
_("group.cantChangeBuiltin", _("command.commands")));
|
_("group.cantChangeBuiltin", _("command.commands")));
|
||||||
|
|
||||||
let completer = args["-complete"];
|
let completer = args["-complete"];
|
||||||
let completerFunc = null; // default to no completion for user commands
|
let completerFunc = null; // default to no completion for user commands
|
||||||
|
|
||||||
if (completer) {
|
if (completer) {
|
||||||
|
|||||||
@@ -1056,7 +1056,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
}</span>;
|
}</span>;
|
||||||
|
|
||||||
let tag = "<" + [namespaced(elem)].concat(
|
let tag = "<" + [namespaced(elem)].concat(
|
||||||
[namespaced(a) + "=" + template.highlight(a.value, true)
|
[namespaced(a) + "=" + template.highlight(a.value, true)
|
||||||
for ([i, a] in array.iterItems(elem.attributes))]).join(" ");
|
for ([i, a] in array.iterItems(elem.attributes))]).join(" ");
|
||||||
return tag + (!hasChildren ? "/>" : ">...</" + namespaced(elem) + ">");
|
return tag + (!hasChildren ? "/>" : ">...</" + namespaced(elem) + ">");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user