diff --git a/common/components/commandline-handler.js b/common/components/commandline-handler.js index 738e2751..0be89de6 100644 --- a/common/components/commandline-handler.js +++ b/common/components/commandline-handler.js @@ -17,11 +17,8 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); function init() { Cu.import("resource://dactyl/bootstrap.jsm"); - if (!JSMLoader.initialized) - JSMLoader.init(); - JSMLoader.load("base.jsm", global); - require(global, "config"); - require(global, "util"); + require("config", global); + require("util", global); } function CommandLineHandler() { diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index 806fb932..0f0b3666 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -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"; /** @scope modules */ @@ -213,18 +213,18 @@ var Abbreviations = Module("abbreviations", { nonkeyword: /[ "']/ }; - this._match = util.regexp(<>) (+ )$ | // full-id (^ | \s | ) (+ )$ | // end-id (^ | \s ) (\S* )$ // non-id - ]]>, "x", params); - this._check = util.regexp(<>+ | // full-id + | // end-id \S* // non-id ) $ - ]]>, "x", params); + */), "x", params); }, get: deprecated("group.abbrevs.get", { get: function get() this.user.closure.get }), diff --git a/common/content/mappings.js b/common/content/mappings.js index 9b9efbf7..50db06cc 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -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"; /** @scope modules */ @@ -757,8 +757,10 @@ var Mappings = Module("mappings", { yield { name: name, columns: [ - i === 0 ? "" : {mode.name}, - hive == mappings.builtin ? "" : {hive.name} + i === 0 ? "" : ["span", { highlight: "Object", style: "padding-right: 1em;" }, + mode.name], + hive == mappings.builtin ? "" : ["span", { highlight: "Object", style: "padding-right: 1em;" }, + hive.name] ], __proto__: map }; diff --git a/common/content/tabs.js b/common/content/tabs.js index 8089cebc..c6e9d5a0 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -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"; /** @scope modules */ diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 0c25917b..8be0bf0a 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -154,6 +154,7 @@ this.lazyRequire("cache", ["cache"]); this.lazyRequire("config", ["config"]); this.lazyRequire("messages", ["_", "Messages"]); this.lazyRequire("services", ["services"]); +this.lazyRequire("storage", ["File"]); this.lazyRequire("util", ["FailedAssertion", "util"]); function literal(/* comment */) { @@ -161,7 +162,7 @@ function literal(/* comment */) { let file = caller.filename.replace(/.* -> /, ""); let key = "literal:" + file + ":" + caller.line; - let source = util.httpGet(file).responseText; + let source = File.readURL(file); let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" + ".*literal\\(/\\*([^]*?)\\*/\\)").exec(source); diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index e8a2dbb5..32a81609 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.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/completion.jsm b/common/modules/completion.jsm index ccd5ae40..d2187775 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -660,6 +660,7 @@ var CompletionContext = Class("CompletionContext", { } catch (e) { util.reportError(e); + util.dump(util.prettifyJSON(this.createRow(this.items[idx]), null, true)); cache[idx] = DOM.fromJSON( ["div", { highlight: "CompItem", style: "white-space: nowrap" }, ["li", { highlight: "CompResult" }, this.text + "\u00a0"], diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 60850acb..9c4a7d50 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -422,9 +422,9 @@ var ConfigBase = Class("ConfigBase", { "xmlns.html": "http://www.w3.org/1999/xhtml", "xmlns.xul": "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", - "tag.command-line": command line, - "tag.status-line": status line, - "mode.command-line": Command Line, + "tag.command-line": ["link", { xmlns: "dactyl", topic: "command-line" }, "command line"], + "tag.status-line": ["link", { xmlns: "dactyl", topic: "status-line" }, "status line"], + "mode.command-line": ["link", { xmlns: "dactyl", topic: "command-line-mode" }, "Command Line"] }, dtdStrings: [ diff --git a/common/modules/dom.jsm b/common/modules/dom.jsm index c1ce2148..01f3d2f3 100644 --- a/common/modules/dom.jsm +++ b/common/modules/dom.jsm @@ -1643,6 +1643,14 @@ var DOM = Class("DOM", { } }), + toXML: function toXML(xml) { + // Meh. For now. + let doc = services.XMLDocument(); + let node = this.fromJSON(xml, doc); + return services.XMLSerializer() + .serializeToString(node); + }, + parseNamespace: function parseNamespace(name) { var m = /^(?:(.*):)?(.*)$/.exec(name); return [DOM.fromJSON.namespaces[m[1]], m[2]]; diff --git a/common/modules/services.jsm b/common/modules/services.jsm index 6f7e3c47..065e7c63 100644 --- a/common/modules/services.jsm +++ b/common/modules/services.jsm @@ -107,6 +107,7 @@ var Services = Module("Services", { this.addClass("Xmlhttp", "@mozilla.org/xmlextras/xmlhttprequest;1", [], "open"); this.addClass("XPathEvaluator", "@mozilla.org/dom/xpath-evaluator;1", "nsIDOMXPathEvaluator"); this.addClass("XMLDocument", "@mozilla.org/xml/xml-document;1", ["nsIDOMXMLDocument", "nsIDOMNodeSelector"]); + this.addClass("XMLSerializer","@mozilla.org/xmlextras/xmlserializer;1", ["nsIDOMSerializer"]); this.addClass("ZipReader", "@mozilla.org/libjar/zip-reader;1", "nsIZipReader", "open", false); this.addClass("ZipWriter", "@mozilla.org/zipwriter;1", "nsIZipWriter", "open", false); }, diff --git a/common/modules/template.jsm b/common/modules/template.jsm index 982327e7..914e993e 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -714,15 +714,11 @@ var Template_ = Module("Template_", { arg = String(arg).replace("/* use strict */ \n", "/* use strict */ "); return arg; case "undefined": - return ["span", { highlight: "Null" }, arg]; + return ["span", { highlight: "Null" }, "undefined"]; case "object": if (arg instanceof Ci.nsIDOMElement) return util.objectToString(arg, !bw); - // for java packages value.toString() would crash so badly - // that we cannot even try/catch it - if (/^\[JavaPackage.*\]$/.test(arg)) - return "[JavaPackage]"; if (processStrings && false) str = template._highlightFilter(str, "\n", function () ["span", { highlight: "NonText" }, diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 285bdd66..58d62e04 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -902,12 +902,21 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), * for *obj*. */ makeDTD: let (map = { "'": "'", '"': """, "%": "%", "&": "&", "<": "<", ">": ">" }) - function makeDTD(obj) iter(obj) - .map(function ([k, v]) ["]/g, - function (m) map[m]), - "'>"].join("")) - .join("\n"), + function makeDTD(obj) { + function escape(val) { + let isDOM = DOM.isJSONXML(val); + return String.replace(val == null ? "null" : + isDOM ? DOM.toXML(val) + : val, + isDOM ? /['%]/g + : /['"%&<>]/g, + function (m) map[m]); + } + + return iter(obj).map(function ([k, v]) + [""].join("")) + .join("\n"); + }, /** * Converts a URI string into a URI object.