mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 04:57:59 +01:00
Death to E4X and stuff.
This commit is contained in:
3
common/bootstrap.js
vendored
3
common/bootstrap.js
vendored
@@ -134,7 +134,8 @@ let JSMLoader = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
delete this.globals[uri];
|
debug("Loading " + name + ": " + e);
|
||||||
|
|
||||||
if (typeof e != "string")
|
if (typeof e != "string")
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
// This work is licensed for reuse under an MIT license. Details are
|
// This work is licensed for reuse under an MIT license. Details are
|
||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
/* use strict */
|
"use strict";
|
||||||
|
|
||||||
defineModule("completion", {
|
defineModule("completion", {
|
||||||
exports: ["CompletionContext", "Completion", "completion"]
|
exports: ["CompletionContext", "Completion", "completion"]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// This work is licensed for reuse under an MIT license. Details are
|
// This work is licensed for reuse under an MIT license. Details are
|
||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
/* use strict */
|
"use strict";
|
||||||
|
|
||||||
defineModule("contexts", {
|
defineModule("contexts", {
|
||||||
exports: ["Contexts", "Group", "contexts"],
|
exports: ["Contexts", "Group", "contexts"],
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
//
|
//
|
||||||
// This work is licensed for reuse under an MIT license. Details are
|
// This work is licensed for reuse under an MIT license. Details are
|
||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
/* use strict */
|
"use strict";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ var IO = Module("io", {
|
|||||||
e.fileName = util.fixURI(e.fileName);
|
e.fileName = util.fixURI(e.fileName);
|
||||||
if (e.fileName == uri.spec)
|
if (e.fileName == uri.spec)
|
||||||
e.fileName = filename;
|
e.fileName = filename;
|
||||||
e.echoerr = <>{e.fileName}:{e.lineNumber}: {e}</>;
|
e.echoerr = [e.fileName, ":", e.lineNumber, ": ", e].join("");
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
// This work is licensed for reuse under an MIT license. Details are
|
// This work is licensed for reuse under an MIT license. Details are
|
||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
/* use strict */
|
"use strict";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// This work is licensed for reuse under an MIT license. Details are
|
// This work is licensed for reuse under an MIT license. Details are
|
||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
/* use strict */
|
"use strict";
|
||||||
|
|
||||||
defineModule("protocol", {
|
defineModule("protocol", {
|
||||||
exports: ["LocaleChannel", "Protocol", "RedirectChannel", "StringChannel", "XMLChannel"],
|
exports: ["LocaleChannel", "Protocol", "RedirectChannel", "StringChannel", "XMLChannel"],
|
||||||
|
|||||||
@@ -720,7 +720,7 @@ var Template_ = Module("Template_", {
|
|||||||
case "object":
|
case "object":
|
||||||
if (arg instanceof Ci.nsIDOMElement)
|
if (arg instanceof Ci.nsIDOMElement)
|
||||||
return util.objectToString(arg, !bw);
|
return util.objectToString(arg, !bw);
|
||||||
if (arg instanceof Magic)
|
if (arg instanceof util.Magic)
|
||||||
return String(arg);
|
return String(arg);
|
||||||
|
|
||||||
if (processStrings && false)
|
if (processStrings && false)
|
||||||
@@ -735,7 +735,7 @@ var Template_ = Module("Template_", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
return "<unknown>";
|
return "<error: " + e + ">";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
// This work is licensed for reuse under an MIT license. Details are
|
// This work is licensed for reuse under an MIT license. Details are
|
||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
/* use strict */
|
"use strict";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ defineModule("util", {
|
|||||||
|
|
||||||
lazyRequire("overlay", ["overlay"]);
|
lazyRequire("overlay", ["overlay"]);
|
||||||
lazyRequire("storage", ["File", "storage"]);
|
lazyRequire("storage", ["File", "storage"]);
|
||||||
lazyRequire("template", ["template"]);
|
lazyRequire("template", ["template", "template_"]);
|
||||||
|
|
||||||
var Magic = Class("Magic", {
|
var Magic = Class("Magic", {
|
||||||
init: function init(str) {
|
init: function init(str) {
|
||||||
@@ -965,13 +965,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
objectToString: function objectToString(object, color) {
|
objectToString: function objectToString(object, color) {
|
||||||
// Use E4X literals so html is automatically quoted
|
|
||||||
// only when it's asked for. No one wants to see <
|
|
||||||
// on their console or :map :foo in their buffer
|
|
||||||
// when they expect :map <C-f> :foo.
|
|
||||||
XML.prettyPrinting = false;
|
|
||||||
XML.ignoreWhitespace = false;
|
|
||||||
|
|
||||||
if (object == null)
|
if (object == null)
|
||||||
return object + "\n";
|
return object + "\n";
|
||||||
|
|
||||||
@@ -992,8 +985,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
catch (e) {
|
catch (e) {
|
||||||
obj = Object.prototype.toString.call(obj);
|
obj = Object.prototype.toString.call(obj);
|
||||||
}
|
}
|
||||||
obj = template.highlightFilter(util.clip(obj, 150), "\n", !color ? function () "^J" : function () <span highlight="NonText">^J</span>);
|
|
||||||
let string = <><span highlight="Title Object">{obj}</span>::
</>;
|
if (color) {
|
||||||
|
obj = template_.highlightFilter(util.clip(obj, 150), "\n",
|
||||||
|
function () ["span", { highlight: "NonText" }, "^J"]);
|
||||||
|
var head = ["span", { highlight: "Title Object" }, obj, "::\n"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
head = util.clip(obj, 150).replace(/\n/g, "^J") + "::\n";
|
||||||
|
|
||||||
let keys = [];
|
let keys = [];
|
||||||
|
|
||||||
@@ -1023,13 +1022,25 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value = template.highlight(value, true, 150, !color);
|
let key = i;
|
||||||
let key = <span highlight="Key">{i}</span>;
|
|
||||||
if (!isNaN(i))
|
if (!isNaN(i))
|
||||||
i = parseInt(i);
|
i = parseInt(i);
|
||||||
else if (/^[A-Z_]+$/.test(i))
|
else if (/^[A-Z_]+$/.test(i))
|
||||||
i = "";
|
i = "";
|
||||||
keys.push([i, <>{noVal ? value : <>{key}: {value}</>}
</>]);
|
|
||||||
|
if (color)
|
||||||
|
value = template_.highlight(value, true, 150, !color);
|
||||||
|
else
|
||||||
|
value = util.clip(String(value).replace(/\n/g, "^J"), 150);
|
||||||
|
|
||||||
|
if (noVal)
|
||||||
|
var val = value;
|
||||||
|
else if (color)
|
||||||
|
val = [["span", { highlight: "Key" }, key], ": ", value];
|
||||||
|
else
|
||||||
|
val = key + ": " + value;
|
||||||
|
|
||||||
|
keys.push([i, val]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
@@ -1041,8 +1052,12 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
return a[0] - b[0];
|
return a[0] - b[0];
|
||||||
return String.localeCompare(a[0], b[0]);
|
return String.localeCompare(a[0], b[0]);
|
||||||
}
|
}
|
||||||
string += template.map(keys.sort(compare), function (f) f[1]);
|
|
||||||
return color ? <div style="white-space: pre-wrap;">{string}</div> : [s for each (s in string)].join("");
|
let vals = template_.map(keys.sort(compare), function (f) f[1], "\n");
|
||||||
|
if (color) {
|
||||||
|
return ["div", { style: "white-space: pre-wrap" }, head, vals];
|
||||||
|
}
|
||||||
|
return head + vals.join("");
|
||||||
},
|
},
|
||||||
|
|
||||||
prettifyJSON: function prettifyJSON(data, indent, invalidOK) {
|
prettifyJSON: function prettifyJSON(data, indent, invalidOK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user