diff --git a/common/bootstrap.js b/common/bootstrap.js index 3d586d98..b47153bc 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -134,7 +134,8 @@ let JSMLoader = { return; } catch (e) { - delete this.globals[uri]; + debug("Loading " + name + ": " + e); + if (typeof e != "string") throw e; } diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm index d2187775..15a91e6c 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -4,7 +4,7 @@ // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; defineModule("completion", { exports: ["CompletionContext", "Completion", "completion"] diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm index e6a014fc..72137b89 100644 --- a/common/modules/contexts.jsm +++ b/common/modules/contexts.jsm @@ -2,7 +2,7 @@ // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; defineModule("contexts", { exports: ["Contexts", "Group", "contexts"], diff --git a/common/modules/io.jsm b/common/modules/io.jsm index b64ee70e..962c2557 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -5,7 +5,7 @@ // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; try { @@ -173,7 +173,7 @@ var IO = Module("io", { e.fileName = util.fixURI(e.fileName); if (e.fileName == uri.spec) e.fileName = filename; - e.echoerr = <>{e.fileName}:{e.lineNumber}: {e}; + e.echoerr = [e.fileName, ":", e.lineNumber, ": ", e].join(""); } catch (e) {} throw e; diff --git a/common/modules/options.jsm b/common/modules/options.jsm index fda3cd47..c9df130b 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -4,7 +4,7 @@ // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; try { diff --git a/common/modules/protocol.jsm b/common/modules/protocol.jsm index bea0f5ca..861bcaf8 100644 --- a/common/modules/protocol.jsm +++ b/common/modules/protocol.jsm @@ -2,7 +2,7 @@ // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; defineModule("protocol", { exports: ["LocaleChannel", "Protocol", "RedirectChannel", "StringChannel", "XMLChannel"], diff --git a/common/modules/template.jsm b/common/modules/template.jsm index c127434c..256ce7e8 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -720,7 +720,7 @@ var Template_ = Module("Template_", { case "object": if (arg instanceof Ci.nsIDOMElement) return util.objectToString(arg, !bw); - if (arg instanceof Magic) + if (arg instanceof util.Magic) return String(arg); if (processStrings && false) @@ -735,7 +735,7 @@ var Template_ = Module("Template_", { } } catch (e) { - return ""; + return ""; } }, diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 6a16628b..5cf3a147 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -4,7 +4,7 @@ // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; try { @@ -15,7 +15,7 @@ defineModule("util", { lazyRequire("overlay", ["overlay"]); lazyRequire("storage", ["File", "storage"]); -lazyRequire("template", ["template"]); +lazyRequire("template", ["template", "template_"]); var Magic = Class("Magic", { init: function init(str) { @@ -965,13 +965,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), * @returns {string} */ 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 :foo. - XML.prettyPrinting = false; - XML.ignoreWhitespace = false; - if (object == null) return object + "\n"; @@ -992,8 +985,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), catch (e) { obj = Object.prototype.toString.call(obj); } - obj = template.highlightFilter(util.clip(obj, 150), "\n", !color ? function () "^J" : function () ^J); - let string = <>{obj}:: ; + + 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 = []; @@ -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 = i; if (!isNaN(i)) i = parseInt(i); else if (/^[A-Z_]+$/.test(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) { @@ -1041,8 +1052,12 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), return a[0] - b[0]; return String.localeCompare(a[0], b[0]); } - string += template.map(keys.sort(compare), function (f) f[1]); - return color ?
{string}
: [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) {