From 0d179d78bcb041f0c35fb2e81298712e18b2209b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 17 Dec 2012 18:38:03 -0800 Subject: [PATCH] Death to E4X and stuff. --- common/bootstrap.js | 1 + common/content/abbreviations.js | 2 +- common/content/autocommands.js | 2 +- common/content/bookmarks.js | 2 +- common/content/browser.js | 2 +- common/content/commandline.js | 11 +++-- common/content/dactyl.js | 4 +- common/content/eval.js | 2 +- common/content/events.js | 2 +- common/content/help.js | 2 +- common/content/hints.js | 2 +- common/content/history.js | 2 +- common/content/key-processors.js | 2 +- common/content/mappings.js | 2 +- common/content/marks.js | 2 +- common/content/modes.js | 2 +- common/content/mow.js | 2 +- common/content/quickmarks.js | 2 +- common/content/statusline.js | 2 +- common/content/tabs.js | 2 +- common/modules/addons.jsm | 2 +- common/modules/base.jsm | 2 +- common/modules/bootstrap.jsm | 2 +- common/modules/buffer.jsm | 2 +- common/modules/cache.jsm | 2 +- common/modules/commands.jsm | 2 +- common/modules/completion.jsm | 2 +- common/modules/config.jsm | 2 +- common/modules/contexts.jsm | 2 +- common/modules/dom.jsm | 70 +++++++++++++++----------------- common/modules/downloads.jsm | 2 +- common/modules/finder.jsm | 2 +- common/modules/help.jsm | 2 +- common/modules/highlight.jsm | 2 +- common/modules/io.jsm | 2 +- common/modules/javascript.jsm | 2 +- common/modules/main.jsm | 2 +- common/modules/messages.jsm | 2 +- common/modules/overlay.jsm | 6 +-- common/modules/prefs.jsm | 2 +- common/modules/protocol.jsm | 2 +- common/modules/sanitizer.jsm | 2 +- common/modules/services.jsm | 2 +- common/modules/storage.jsm | 2 +- common/modules/styles.jsm | 35 ++++++++-------- common/modules/template.jsm | 2 +- common/modules/util.jsm | 6 +-- 47 files changed, 105 insertions(+), 108 deletions(-) diff --git a/common/bootstrap.js b/common/bootstrap.js index b47153bc..5d9ee949 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -135,6 +135,7 @@ let JSMLoader = { } catch (e) { debug("Loading " + name + ": " + e); + delete this.globals[uri]; if (typeof e != "string") throw e; diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index 0f0b3666..4b646446 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2009 by Martin Stubenschrott // Copyright (c) 2010 by anekos -// Copyright (c) 2010-2011 by Kris Maglione +// Copyright (c) 2010-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/autocommands.js b/common/content/autocommands.js index 948a5e28..b1419028 100644 --- a/common/content/autocommands.js +++ b/common/content/autocommands.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index d1ffacfb..3fb19dbf 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/browser.js b/common/content/browser.js index 836a6c75..459bf45a 100644 --- a/common/content/browser.js +++ b/common/content/browser.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/commandline.js b/common/content/commandline.js index db8f6455..b59e6009 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. @@ -1898,7 +1898,8 @@ var ItemList = Class("ItemList", { ["div", { highlight: "CompItem NonText" }, "~"])]], - get itemCount() this.context.contextList.reduce(function (acc, ctxt) acc + ctxt.items.length, 0), + get itemCount() this.context.contextList + .reduce(function (acc, ctxt) acc + ctxt.items.length, 0), get visible() !this.container.collapsed, set visible(val) this.container.collapsed = !val, @@ -2168,9 +2169,11 @@ var ItemList = Class("ItemList", { let off = group.getOffset(idx); start = Math.constrain(start, - off + Math.min(this.CONTEXT_LINES, group.itemCount - idx + group.offsets.end) + off + Math.min(this.CONTEXT_LINES, + group.itemCount - idx + group.offsets.end) - this.maxItems + 1, - off - Math.min(this.CONTEXT_LINES, idx + group.offsets.start)); + off - Math.min(this.CONTEXT_LINES, + idx + group.offsets.start)); } let count = this.maxItems; diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 3f0f0435..7558e7e6 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. @@ -1231,7 +1231,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { body.push(info); } else if (DOM.isJSONXML(info)) { - let langs = info.slice(2).filter(function (e) isArray(e) && isObject(e[1]) && e[1].leng); + let langs = info.slice(2).filter(function (e) isArray(e) && isObject(e[1]) && e[1].lang); if (langs) { let lang = config.bestLocale(l[1].lang for each (l in langs)); diff --git a/common/content/eval.js b/common/content/eval.js index 49298d92..9e10d9f5 100644 --- a/common/content/eval.js +++ b/common/content/eval.js @@ -4,7 +4,7 @@ catch (e) { __dactyl_eval_error = e; } // IMPORTANT: The eval statement *must* remain on the first line // in order for line numbering in any errors to remain correct. -// Copyright (c) 2008-2010 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/events.js b/common/content/events.js index 5408391d..8ca6206d 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/help.js b/common/content/help.js index 9faf7a2a..70c37533 100644 --- a/common/content/help.js +++ b/common/content/help.js @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2011 by Kris Maglione +// Copyright (c) 2009-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/hints.js b/common/content/hints.js index b35b0996..a2934f5a 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/history.js b/common/content/history.js index 7ffd0973..ec335bae 100644 --- a/common/content/history.js +++ b/common/content/history.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/key-processors.js b/common/content/key-processors.js index 63b27938..a0607488 100644 --- a/common/content/key-processors.js +++ b/common/content/key-processors.js @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/mappings.js b/common/content/mappings.js index 50db06cc..6325fa90 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/marks.js b/common/content/marks.js index e616608a..1d2f2c2e 100644 --- a/common/content/marks.js +++ b/common/content/marks.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/modes.js b/common/content/modes.js index 47ad2562..291f83e9 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/mow.js b/common/content/mow.js index 1d880f10..689d9a79 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/quickmarks.js b/common/content/quickmarks.js index f91a6b4a..df3d2de8 100644 --- a/common/content/quickmarks.js +++ b/common/content/quickmarks.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/statusline.js b/common/content/statusline.js index dcc09d3f..05a817b6 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/content/tabs.js b/common/content/tabs.js index 819afdb2..9e95e4f5 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index 2d5d3728..c868b2fa 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2011 by Kris Maglione +// Copyright (c) 2009-2012 Kris Maglione // Copyright (c) 2009-2010 by Doug Kearns // // This work is licensed for reuse under an MIT license. Details are diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 9f3f19ba..89f9d29e 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2011 by Kris Maglione +// Copyright (c) 2009-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm index 4dc07382..6c9426d2 100644 --- a/common/modules/bootstrap.jsm +++ b/common/modules/bootstrap.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2011 by Kris Maglione +// Copyright (c) 2011-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index ff0711a4..2ca23db7 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/cache.jsm b/common/modules/cache.jsm index 4a075170..4fe8d8bb 100644 --- a/common/modules/cache.jsm +++ b/common/modules/cache.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2011 by Kris Maglione +// Copyright (c) 2011-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 32a81609..b459d92b 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm index 15a91e6c..16782c76 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/config.jsm b/common/modules/config.jsm index ba255bda..99a8aff1 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm index 72137b89..77219de2 100644 --- a/common/modules/contexts.jsm +++ b/common/modules/contexts.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2010-2011 by Kris Maglione +// Copyright (c) 2010-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/dom.jsm b/common/modules/dom.jsm index 1c16d10d..a7ba0621 100644 --- a/common/modules/dom.jsm +++ b/common/modules/dom.jsm @@ -1,5 +1,5 @@ // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. @@ -11,7 +11,7 @@ defineModule("dom", { lazyRequire("highlight", ["highlight"]); lazyRequire("messages", ["_"]); -lazyRequire("template", ["template"]); +lazyRequire("template", ["template", "template_"]); var XBL = Namespace("xbl", "http://www.mozilla.org/xbl"); var XHTML = Namespace("html", "http://www.w3.org/1999/xhtml"); @@ -561,14 +561,13 @@ var DOM = Class("DOM", { * representation of this node. */ repr: function repr(color) { - XML.ignoreWhitespace = XML.prettyPrinting = false; - function namespaced(node) { - var ns = DOM.namespaceNames[node.namespaceURI] || /^(?:(.*?):)?/.exec(node.name)[0]; + var ns = DOM.namespaceNames[node.namespaceURI] || /^(?:(.*?):)?/.exec(node.name)[1]; if (!ns) return node.localName; if (color) - return <>{ns}{node.localName} + return [["span", { highlight: "HelpXMLNamespace" }, ns], + node.localName]; return ns + ":" + node.localName; } @@ -577,20 +576,24 @@ var DOM = Class("DOM", { try { let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling) if (color) - res.push(<{ - namespaced(elem)} { - template.map(array.iterValues(elem.attributes), - function (attr) - {namespaced(attr)} + - {attr.value}, - <> ) - }{ !hasChildren ? "/>" : ">" - }{ !hasChildren ? "" : <>... + - <{namespaced(elem)}> - }); + res.push(["span", { highlight: "HelpXML" }, + ["span", { highlight: "HelpXMLTagStart" }, + "<", namespaced(elem), " ", + template_.map(array.iterValues(elem.attributes), + function (attr) [ + ["span", { highlight: "HelpXMLAttribute" }, namespaced(attr)], + ["span", { highlight: "HelpXMLString" }, attr.value] + ], + " "), + !hasChildren ? "/>" : ">", + ], + !hasChildren ? "" : + ["", "...", + ["span", { highlight: "HtmlTagEnd" },"<", namespaced(elem), ">"]] + ]); else { let tag = "<" + [namespaced(elem)].concat( - [namespaced(a) + "=" + template.highlight(a.value, true) + [namespaced(a) + '="' + String.replace(a.value, /["<]/, DOM.escapeHTML) + '"' for ([i, a] in array.iterItems(elem.attributes))]).join(" "); res.push(tag + (!hasChildren ? "/>" : ">...")); @@ -600,7 +603,8 @@ var DOM = Class("DOM", { res.push({}.toString.call(elem)); } }, this); - return template.map(res, util.identity, <>,); + res = template_.map(res, util.identity, ","); + return color ? res : res.join(""); }, attr: function attr(key, val) { @@ -1589,13 +1593,7 @@ var DOM = Class("DOM", { attr = attr || {}; - function parseNamespace(name) { - if (name == "xmlns") - return ["xmlns", ""]; - - var m = /^(?:(.*):)?(.*)$/.exec(name); - return [namespaces[m[1]], m[2]]; - } + function parseNamespace(name) DOM.parseNamespace(name, namespaces); // FIXME: Surely we can do better. for (var key in attr) { @@ -1608,13 +1606,8 @@ var DOM = Class("DOM", { var args = Array.slice(args, 2); var vals = parseNamespace(name); - try { - var elem = doc.createElementNS(vals[0] || namespaces[""], - name); - } - catch (e) { - util.dump("FOO", vals[0] || namespaces[""], name); - } + var elem = doc.createElementNS(vals[0] || namespaces[""], + name); for (var key in attr) if (!/^xmlns(?:$|:)/.test(key)) { @@ -1623,7 +1616,7 @@ var DOM = Class("DOM", { nodes[val] = elem; vals = parseNamespace(key); - if (vals[0] == "xmlns" || key == "highlight") + if (key == "highlight") ; else if (typeof val == "function") elem.addEventListener(key.replace(/^on/, ""), val, false); @@ -1650,7 +1643,7 @@ var DOM = Class("DOM", { "": "http://www.w3.org/1999/xhtml", dactyl: String(NS), html: "http://www.w3.org/1999/xhtml", - xmlns: "xmlns", + xmlns: "http://www.w3.org/2000/xmlns/", xul: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" } }), @@ -1823,12 +1816,13 @@ var DOM = Class("DOM", { return tag(xml, namespaces, "") }, - parseNamespace: function parseNamespace(name) { + parseNamespace: function parseNamespace(name, namespaces) { if (name == "xmlns") - return ["xmlns", ""]; + return [DOM.fromJSON.namespaces.xmlns, "xmlns"]; var m = /^(?:(.*):)?(.*)$/.exec(name); - return [DOM.fromJSON.namespaces[m[1]], m[2]]; + return [(namespaces || DOM.fromJSON.namespaces)[m[1]], + m[2]]; }, /** diff --git a/common/modules/downloads.jsm b/common/modules/downloads.jsm index 84b593f1..8b0e36fc 100644 --- a/common/modules/downloads.jsm +++ b/common/modules/downloads.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2011 by Kris Maglione +// Copyright (c) 2011-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm index 5743666c..ee85905b 100644 --- a/common/modules/finder.jsm +++ b/common/modules/finder.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/help.jsm b/common/modules/help.jsm index 647ef6f0..96cd5d0f 100644 --- a/common/modules/help.jsm +++ b/common/modules/help.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm index 097f8c51..1773808e 100644 --- a/common/modules/highlight.jsm +++ b/common/modules/highlight.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/io.jsm b/common/modules/io.jsm index 962c2557..df030edb 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2012 by Doug Kearns -// Copyright (c) 2008-2012 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // Some code based on Venkman // // This work is licensed for reuse under an MIT license. Details are diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index 02fa1bc1..4fa51902 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/main.jsm b/common/modules/main.jsm index 26f1524a..edd8c2e4 100644 --- a/common/modules/main.jsm +++ b/common/modules/main.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2011 by Kris Maglione +// Copyright (c) 2009-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/messages.jsm b/common/modules/messages.jsm index d581cc63..12ab0f35 100644 --- a/common/modules/messages.jsm +++ b/common/modules/messages.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2011 by Kris Maglione +// Copyright (c) 2011-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm index b889c5bc..357bfeae 100644 --- a/common/modules/overlay.jsm +++ b/common/modules/overlay.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2011 by Kris Maglione +// Copyright (c) 2009-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. @@ -279,9 +279,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen name = attr, val = attrs[attr]; savedAttrs.push([elem, ns, name, getAttr(elem, ns, name), val]); - if (ns == "xmlns") - ; - else if (name === "highlight") + if (name === "highlight") highlight.highlightNode(elem, val); else elem.setAttributeNS(ns || "", name, val); diff --git a/common/modules/prefs.jsm b/common/modules/prefs.jsm index 5f99ed62..8275d770 100644 --- a/common/modules/prefs.jsm +++ b/common/modules/prefs.jsm @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/protocol.jsm b/common/modules/protocol.jsm index 861bcaf8..82b59a39 100644 --- a/common/modules/protocol.jsm +++ b/common/modules/protocol.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index 4fa62fc0..07dca513 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -1,5 +1,5 @@ // Copyright (c) 2009 by Doug Kearns -// Copyright (c) 2009-2011 by Kris Maglione +// Copyright (c) 2009-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/services.jsm b/common/modules/services.jsm index 734f6694..e0bba764 100644 --- a/common/modules/services.jsm +++ b/common/modules/services.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm index abac085a..10c1551b 100644 --- a/common/modules/storage.jsm +++ b/common/modules/storage.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/styles.jsm b/common/modules/styles.jsm index 01e4e468..0324c405 100644 --- a/common/modules/styles.jsm +++ b/common/modules/styles.jsm @@ -1,8 +1,8 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // 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("styles", { exports: ["Style", "Styles", "styles"], @@ -741,28 +741,29 @@ var Styles = Module("Styles", { let patterns = Styles.patterns; template.highlightCSS = function highlightCSS(css) { - XML.prettyPrinting = XML.ignoreWhitespace = false; - return this.highlightRegexp(css, patterns.property, function (match) { if (!match.length) - return <>; - return <>{match.preSpace}{template.filter(match.name)}: { + return []; + return ["", match.preSpace, template_.filter(match.name), ": ", - template.highlightRegexp(match.value, patterns.token, function (match) { + template_.highlightRegexp(match.value, patterns.token, function (match) { if (match.function) - return <>{template.filter(match.word)}{ - template.highlightRegexp(match.function, patterns.string, - function (match) {match.string}) - }; + return ["", template_.filter(match.word), + template_.highlightRegexp(match.function, patterns.string, + function (match) ["span", { highlight: "String" }, match.string]) + ]; if (match.important == "!important") - return {match.important}; + return ["span", { highlight: "String" }, match.important]; if (match.string) - return {match.string}; + return ["span", { highlight: "String" }, match.string]; return template.highlightRegexp(match.wholeMatch, /^(\d+)(em|ex|px|in|cm|mm|pt|pc)?/g, - function (m, n, u) <>{n}{u || ""}); - }) - - }{ match.postSpace } + function (m, n, u) [ + ["span", { highlight: "Number" }, n], + ["span", { highlight: "Object" }, u || ""] + ]); + }), + match.postSpace + ] }) } } diff --git a/common/modules/template.jsm b/common/modules/template.jsm index 256ce7e8..3c381923 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 5cf3a147..ccab29be 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. @@ -1078,7 +1078,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (~["boolean", "number"].indexOf(typeof data) || data === null) res.push(String(data)); else if (isinstance(data, ["String", _])) - res.push(String.quote(data)); + res.push(JSON.stringify(String(data))); else if (isArray(data)) { if (data.length == 0) res.push("[]"); @@ -1100,7 +1100,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), for (let [key, val] in Iterator(data)) { if (i++) res.push(",\n"); - res.push(prefix, String.quote(key), ": ") + res.push(prefix, JSON.stringify(key), ": ") rec(val, prefix, seen); } if (i > 0)