Skip to content

Commit 0daf18c

Browse files
committed
Merge pull request #113 from caisui/fix/string.quote
Fix/string.quote (Firefox 37 compatibility)
2 parents d978bb5 + 914bd8c commit 0daf18c

File tree

12 files changed

+18
-18
lines changed

12 files changed

+18
-18
lines changed

common/content/bookmarks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ const Bookmarks = Module("bookmarks", {
620620
let url = args.string || buffer.URL;
621621
let deletedCount = bookmarks.remove(url);
622622

623-
liberator.echomsg("Deleted " + deletedCount + " bookmark(s) with url: " + url.quote());
623+
liberator.echomsg("Deleted " + deletedCount + " bookmark(s) with url: " + JSON.stringify(url));
624624
}
625625

626626
},

common/content/buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ const Buffer = Module("buffer", {
912912
if (bookmarks.isBookmarked(this.URL))
913913
xml["+="](info, ", bookmarked");
914914

915-
let pageInfoText = xml`${file.quote()} [${info}] ${title}`;
915+
let pageInfoText = xml`${JSON.stringify(file)} [${info}] ${title}`;
916916
liberator.echo(pageInfoText, commandline.FORCE_SINGLELINE);
917917
return;
918918
}

common/content/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ const Commands = Module("commands", {
10681068
var completer = liberator.eval(completeOpt);
10691069

10701070
if (!(completer instanceof Function))
1071-
throw new TypeError("User-defined custom completer " + completeOpt.quote() + " is not a function");
1071+
throw new TypeError("User-defined custom completer " + JSON.stringify(completeOpt) + " is not a function");
10721072
}
10731073
catch (e) {
10741074
liberator.echoerr("Unknown function: " + completeOpt);

common/content/hints.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ const Hints = Module("hints", {
155155
case "label":
156156
if (elem.id) {
157157
// TODO: (possibly) do some guess work for label-like objects
158-
let label = util.evaluateXPath(["label[@for=" + elem.id.quote() + "]"], doc).snapshotItem(0);
158+
let label = util.evaluateXPath(["label[@for=" + JSON.stringify(elem.id) + "]"], doc).snapshotItem(0);
159159
if (label)
160160
return [label.textContent.toLowerCase(), true];
161161
}
@@ -507,9 +507,9 @@ const Hints = Module("hints", {
507507
let css = [];
508508
// FIXME: Broken for imgspans.
509509
for (let { doc } of this._docs) {
510-
for (let elem in util.evaluateXPath(" {//*[@liberator:highlight and @number]", doc)) {
510+
for (let elem in util.evaluateXPath("//*[@liberator:highlight and @number]", doc)) {
511511
let group = elem.getAttributeNS(NS.uri, "highlight");
512-
css.push(highlight.selector(group) + "[number=" + elem.getAttribute("number").quote() + "] { " + elem.style.cssText + " }");
512+
css.push(highlight.selector(group) + "[number=" + JSON.stringify(elem.getAttribute("number")) + "] { " + elem.style.cssText + " }");
513513
}
514514
}
515515
styles.addSheet(true, "hint-positions", "*", css.join("\n"));

common/content/io.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ lookup:
886886
}
887887

888888
if (!found)
889-
liberator.echoerr("Can't find directory " + arg.quote() + " in cdpath\n" + "Command failed");
889+
liberator.echoerr("Can't find directory " + JSON.stringify(arg) + " in cdpath\n" + "Command failed");
890890
}
891891
}, {
892892
argCount: "?",

common/content/liberator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ const Liberator = Module("liberator", {
646646
if (helpFile in services.get("liberator:").FILE_MAP)
647647
liberator.open("liberator://help/" + helpFile, { from: "help" });
648648
else
649-
liberator.echomsg("Sorry, help file " + helpFile.quote() + " not found");
649+
liberator.echomsg("Sorry, help file " + JSON.stringify(helpFile) + " not found");
650650
return;
651651
}
652652

@@ -1357,7 +1357,7 @@ const Liberator = Module("liberator", {
13571357
liberator.echoerr("Invalid argument: " + arg);
13581358
}
13591359
catch (e) {
1360-
liberator.echoerr("Error opening " + arg.quote() + ": " + e);
1360+
liberator.echoerr("Error opening " + JSON.stringify(arg) + ": " + e);
13611361
}
13621362
}, {
13631363
argCount: "1",

common/content/marks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const Marks = Module("marks", {
166166

167167
if (filter.length > 0) {
168168
marks = marks.filter(function (mark) filter.indexOf(mark[0]) >= 0);
169-
liberator.assert(marks.length > 0, "No matching marks for: " + filter.quote());
169+
liberator.assert(marks.length > 0, "No matching marks for: " + JSON.stringify(filter));
170170
}
171171

172172
let list = template.tabular(
@@ -306,7 +306,7 @@ const Marks = Module("marks", {
306306

307307
// ignore invalid mark characters unless there are no valid mark chars
308308
liberator.assert(!args || /[a-zA-Z]/.test(args),
309-
"No matching marks for: " + args.quote());
309+
"No matching marks for: " + JSON.stringify(args));
310310

311311
let filter = args.replace(/[^a-zA-Z]/g, "");
312312
marks.list(filter);

common/content/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ const Options = Module("options", {
532532

533533
if (option.name in this._optionHash) {
534534
// never replace for now
535-
liberator.echomsg("Option '" + names[0].quote() + "' already exists, NOT replacing existing option.");
535+
liberator.echomsg("Option '" + JSON.stringify(names[0]) + "' already exists, NOT replacing existing option.");
536536
return false;
537537
}
538538

common/content/style.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,9 @@ function Styles(name, store) {
339339
const storage = modules.storage;
340340
const ios = services.get("io");
341341
const sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
342-
const namespace = "@namespace html " + XHTML.uri.quote() + ";\n" +
343-
"@namespace xul " + XUL.uri.quote() + ";\n" +
344-
"@namespace liberator " + NS.uri.quote() + ";\n";
342+
const namespace = "@namespace html " + JSON.stringify(XHTML.uri) + ";\n" +
343+
"@namespace xul " + JSON.stringify(XUL.uri) + ";\n" +
344+
"@namespace liberator " + JSON.stringify(NS.uri) + ";\n";
345345

346346
const Sheet = Struct("name", "id", "sites", "css", "system", "agent");
347347
Sheet.prototype.__defineGetter__("fullCSS", function wrapCSS() {

common/content/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const Template = Module("template", {
9898
return xml`<span highlight="Number">${str}</span>`;
9999
case "string":
100100
if (processStrings)
101-
str = str.quote();
101+
str = JSON.stringify(str);
102102
return xml`<span highlight="String">${str}</span>`;
103103
case "boolean":
104104
return xml`<span highlight="Boolean">${str}</span>`;

0 commit comments

Comments
 (0)