function LocaleChannel(pkg, locale, path, orig) {
for each (let locale in [locale, "en-US"])
for each (let sep in "-/") {
- var channel = Channel(["resource:/", pkg + sep + locale, path].join("/"), orig, true);
+ var channel = Channel(["resource:/", pkg + sep + locale, path].join("/"), orig, true, true);
if (channel)
return channel;
}
this.channel.contentType = contentType || channel.contentType;
this.channel.contentCharset = "UTF-8";
if (!unprivileged)
- 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);
+ this.channel.owner = systemPrincipal;
+
+ let type = this.channel.contentType;
+ if (/^text\/|[\/+]xml$/.test(type)) {
+ 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);