1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 13:34:13 +01:00
This commit is contained in:
Kris Maglione
2012-01-26 19:22:22 -05:00
parent ff07625766
commit 97ff27f575
2 changed files with 26 additions and 23 deletions

View File

@@ -182,31 +182,34 @@ function XMLChannel(uri, contentType, noErrorChannel, unprivileged) {
this.channel.contentType = contentType || channel.contentType;
this.channel.contentCharset = "UTF-8";
if (!unprivileged)
this.channel.owner = systemPrincipal;
this.channel.owner = systemPrincipal;
let stream = services.InputStream(channelStream);
let [, pre, doctype, url, extra, open, post] = util.regexp(<![CDATA[
^ ([^]*?)
(?:
(<!DOCTYPE \s+ \S+ \s+) (?:SYSTEM \s+ "([^"]*)" | ((?:[^[>\s]|\s[^[])*))
(\s+ \[)?
([^]*)
)?
$
]]>, "x").exec(stream.read(4096));
this.writes.push(pre);
if (doctype) {
this.writes.push(doctype + (extra || "") + " [\n");
if (url)
this.addChannel(url);
if (!open)
this.writes.push("\n]");
for (let [, pre, url] in util.regexp.iterate(/([^]*?)(?:%include\s+"([^"]*)";|$)/gy, post)) {
this.writes.push(pre);
let type = this.channel.contentType;
if (type.indexOf("text/") == 0 || type.indexOf("+xml") == type.length - 4) {
let stream = services.InputStream(channelStream);
let [, pre, doctype, url, extra, open, post] = util.regexp(<![CDATA[
^ ([^]*?)
(?:
(<!DOCTYPE \s+ \S+ \s+) (?:SYSTEM \s+ "([^"]*)" | ((?:[^[>\s]|\s[^[])*))
(\s+ \[)?
([^]*)
)?
$
]]>, "x").exec(stream.read(4096));
this.writes.push(pre);
if (doctype) {
this.writes.push(doctype + (extra || "") + " [\n");
if (url)
this.addChannel(url);
if (!open)
this.writes.push("\n]");
for (let [, pre, url] in util.regexp.iterate(/([^]*?)(?:%include\s+"([^"]*)";|$)/gy, post)) {
this.writes.push(pre);
if (url)
this.addChannel(url);
}
}
}
this.writes.push(channelStream);