diff --git a/common/components/protocols.js b/common/components/protocols.js index 7a7a0090..c906d031 100644 --- a/common/components/protocols.js +++ b/common/components/protocols.js @@ -29,8 +29,12 @@ const systemPrincipal = channel.owner; channel.cancel(NS_BINDING_ABORTED); delete channel; +function dataURL(type, data) + "data:" + (type || "application/xml;encoding=UTF-8") + "," + escape(data); function makeChannel(url, orig) { + if (typeof url == "function") + url = dataURL.apply(null, url()); let uri = ioService.newURI(url, null, null); let channel = ioService.newChannelFromURI(uri); channel.owner = systemPrincipal; @@ -42,7 +46,7 @@ function fakeChannel(orig) function redirect(to, orig) { let html =
.toXMLString(); - return makeChannel('data:text/html,' + escape(html), orig); + return makeChannel(dataURL('text/html', html), orig); } function ChromeData() {} diff --git a/common/content/liberator.js b/common/content/liberator.js index c07cef75..6d67de29 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1167,6 +1167,8 @@ const liberator = (function () //{{{ */ loadScript: function (uri, context) { + XML.ignoreWhiteSpace = false; + XML.prettyPrinting = false; services.get("subscriptLoader").loadSubScript(uri, context); }, @@ -1383,9 +1385,6 @@ const liberator = (function () //{{{ */ initHelp: function () { - if (services.get("liberator:").NAMESPACES.length) - return; - let namespaces = [config.name.toLowerCase(), "liberator"]; let tagMap = {}; let fileMap = {}; @@ -1415,6 +1414,13 @@ const liberator = (function () //{{{ } return result; } + function addTags(file, doc) + { + doc = XSLT.transformToDocument(doc); + for (let elem in util.evaluateXPath("//liberator:tag/text()", doc)) + tagMap[elem.textContent] = file; + } + const XSLT = XSLTProcessor("chrome://liberator/content/help.xsl"); tagMap.all = "all"; @@ -1423,14 +1429,30 @@ const liberator = (function () //{{{ "//liberator:include/@href", doc))]); util.Array.flatten(files).map(function (file) { - liberator.dump("file:", file); findHelpFile(file).forEach(function (doc) { - doc = XSLT.transformToDocument(doc); - for (let elem in util.evaluateXPath("//liberator:tag/text()", doc)) - tagMap[elem.textContent] = file; + addTags(file, doc); }); }); + XML.ignoreWhiteSpace = false; + XML.prettyPrinting = false; + let body = XML(); + for (let [, context] in Iterator(plugins.contexts)) + if (context.INFO instanceof XML) + body += context.INFO; + let help = '\n' + + '\n' + + '' + +