mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 06:38:00 +01:00
Properly quote strings.
This commit is contained in:
@@ -986,7 +986,7 @@ const Commands = Module("commands", {
|
|||||||
var completer = liberator.eval(completeOpt);
|
var completer = liberator.eval(completeOpt);
|
||||||
|
|
||||||
if (!(completer instanceof Function))
|
if (!(completer instanceof Function))
|
||||||
throw new TypeError("User-defined custom completer '" + completeOpt + "' is not a function");
|
throw new TypeError("User-defined custom completer " + completeOpt.quote() + " is not a function");
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
liberator.echo(":" + this.name + " ...");
|
liberator.echo(":" + this.name + " ...");
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ const Events = Module("events", {
|
|||||||
|
|
||||||
if (dirs.length > 0) {
|
if (dirs.length > 0) {
|
||||||
for (let [, dir] in Iterator(dirs)) {
|
for (let [, dir] in Iterator(dirs)) {
|
||||||
liberator.echomsg('Searching for "macros/*" in "' + dir.path + '"', 2);
|
liberator.echomsg('Searching for "macros/*" in ' + dir.path.quote(), 2);
|
||||||
liberator.log("Sourcing macros directory: " + dir.path + "...", 3);
|
liberator.log("Sourcing macros directory: " + dir.path + "...", 3);
|
||||||
|
|
||||||
for (let file in dir.iterDirectory()) {
|
for (let file in dir.iterDirectory()) {
|
||||||
|
|||||||
@@ -117,13 +117,13 @@ const Hints = Module("hints", {
|
|||||||
* @returns [text, showText]
|
* @returns [text, showText]
|
||||||
*/
|
*/
|
||||||
_getInputHint: function (elem, doc) {
|
_getInputHint: function (elem, doc) {
|
||||||
// <input type="submit|button|this._reset"> Always use the value
|
// <input type="submit|button|reset"/> Always use the value
|
||||||
// <input type="radio|checkbox"> Use the value if it is not numeric or label or name
|
// <input type="radio|checkbox"/> Use the value if it is not numeric or label or name
|
||||||
// <input type="password"> Never use the value, use label or name
|
// <input type="password"/> Never use the value, use label or name
|
||||||
// <input type="text|file"> <textarea> Use value if set or label or name
|
// <input type="text|file"/> <textarea/> Use value if set or label or name
|
||||||
// <input type="image"> Use the alt text if present (showText) or label or name
|
// <input type="image"/> Use the alt text if present (showText) or label or name
|
||||||
// <input type="hidden"> Never gets here
|
// <input type="hidden"/> Never gets here
|
||||||
// <select> Use the text of the selected item or label or name
|
// <select/> Use the text of the selected item or label or name
|
||||||
|
|
||||||
let type = elem.type;
|
let type = elem.type;
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ const Hints = Module("hints", {
|
|||||||
else if (option == "label") {
|
else if (option == "label") {
|
||||||
if (elem.id) {
|
if (elem.id) {
|
||||||
// TODO: (possibly) do some guess work for label-like objects
|
// TODO: (possibly) do some guess work for label-like objects
|
||||||
let label = util.evaluateXPath("//label[@for='" + elem.id + "']", doc).snapshotItem(0);
|
let label = util.evaluateXPath(["label[@for=" + elem.id.quote() + "]"], doc).snapshotItem(0);
|
||||||
if (label)
|
if (label)
|
||||||
return [label.textContent.toLowerCase(), true];
|
return [label.textContent.toLowerCase(), true];
|
||||||
}
|
}
|
||||||
@@ -400,7 +400,7 @@ const Hints = Module("hints", {
|
|||||||
for (let [, { doc: doc }] in Iterator(this._docs)) {
|
for (let [, { doc: doc }] in Iterator(this._docs)) {
|
||||||
for (let elem in util.evaluateXPath(" {//*[@liberator:highlight and @number]", doc)) {
|
for (let elem in util.evaluateXPath(" {//*[@liberator:highlight and @number]", doc)) {
|
||||||
let group = elem.getAttributeNS(NS.uri, "highlight");
|
let group = elem.getAttributeNS(NS.uri, "highlight");
|
||||||
css.push(highlight.selector(group) + "[number='" + elem.getAttribute("number") + "'] { " + elem.style.cssText + " }");
|
css.push(highlight.selector(group) + "[number=" + elem.getAttribute("number").quote() + "] { " + elem.style.cssText + " }");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
styles.addSheet(true, "hint-positions", "*", css.join("\n"));
|
styles.addSheet(true, "hint-positions", "*", css.join("\n"));
|
||||||
|
|||||||
@@ -1284,7 +1284,7 @@ const Liberator = Module("liberator", {
|
|||||||
liberator.echoerr("E475: Invalid argument: " + arg);
|
liberator.echoerr("E475: Invalid argument: " + arg);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
liberator.echoerr("Error opening '" + arg + "': " + e);
|
liberator.echoerr("Error opening " + arg.quote() + ": " + e);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
argCount: "1",
|
argCount: "1",
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ const Options = Module("options", {
|
|||||||
|
|
||||||
if (option.name in this._optionHash) {
|
if (option.name in this._optionHash) {
|
||||||
// never replace for now
|
// never replace for now
|
||||||
liberator.log("Warning: '" + names[0] + "' already exists, NOT replacing existing option.", 1);
|
liberator.log("Warning: " + names[0].quote() + " already exists, NOT replacing existing option.", 1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -357,9 +357,9 @@ function Styles(name, store) {
|
|||||||
const storage = modules.storage;
|
const storage = modules.storage;
|
||||||
const ios = services.get("io");
|
const ios = services.get("io");
|
||||||
const sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
|
const sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
|
||||||
const namespace = '@namespace html "' + XHTML + '";\n' +
|
const namespace = "@namespace html " + XHTML.uri.quote() + ";\n" +
|
||||||
'@namespace xul "' + XUL + '";\n' +
|
"@namespace xul " + XUL.uri.quote() + ";\n" +
|
||||||
'@namespace liberator "' + NS.uri + '";\n';
|
"@namespace liberator " + NS.uri.quote() + ";\n";
|
||||||
|
|
||||||
const Sheet = Struct("name", "id", "sites", "css", "system", "agent");
|
const Sheet = Struct("name", "id", "sites", "css", "system", "agent");
|
||||||
Sheet.prototype.__defineGetter__("fullCSS", function wrapCSS() {
|
Sheet.prototype.__defineGetter__("fullCSS", function wrapCSS() {
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ const Util = Module("util", {
|
|||||||
|
|
||||||
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 + '"');
|
data.push(" xmlns=" + XHTML.uri.quote());
|
||||||
|
|
||||||
for (let { name: name, value: value } in util.Array.itervalues(node.attributes)) {
|
for (let { name: name, value: value } in util.Array.itervalues(node.attributes)) {
|
||||||
if (name == "liberator:highlight") {
|
if (name == "liberator:highlight") {
|
||||||
|
|||||||
Reference in New Issue
Block a user