diff --git a/browser/components/feeds/src/FeedWriter.js b/browser/components/feeds/src/FeedWriter.js
index 5c7004acd941..ea15e9d3d539 100644
--- a/browser/components/feeds/src/FeedWriter.js
+++ b/browser/components/feeds/src/FeedWriter.js
@@ -44,7 +44,7 @@ function makeURI(aURLSpec, aCharset) {
return null;
}
-const XML_NS = "http://www.w3.org/XML/1998/namespace"
+const XML_NS = "http://www.w3.org/XML/1998/namespace";
const HTML_NS = "http://www.w3.org/1999/xhtml";
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
@@ -169,11 +169,15 @@ FeedWriter.prototype = {
_setContentText: function FW__setContentText(id, text) {
this._contentSandbox.element = this._document.getElementById(id);
- this._contentSandbox.textNode = this._document.createTextNode(text);
+ this._contentSandbox.textNode = text.createDocumentFragment(this._contentSandbox.element);
var codeStr =
"while (element.hasChildNodes()) " +
" element.removeChild(element.firstChild);" +
"element.appendChild(textNode);";
+ if (text.base) {
+ this._contentSandbox.spec = text.base.spec;
+ codeStr += "element.setAttributeNS('" + XML_NS + "', 'base', spec);";
+ }
Cu.evalInSandbox(codeStr, this._contentSandbox);
this._contentSandbox.element = null;
this._contentSandbox.textNode = null;
@@ -361,7 +365,7 @@ FeedWriter.prototype = {
_setTitleText: function FW__setTitleText(container) {
if (container.title) {
var title = container.title.plainText();
- this._setContentText(TITLE_ID, title);
+ this._setContentText(TITLE_ID, container.title);
this._contentSandbox.document = this._document;
this._contentSandbox.title = title;
var codeStr = "document.title = title;"
@@ -370,7 +374,7 @@ FeedWriter.prototype = {
var feed = container.QueryInterface(Ci.nsIFeed);
if (feed && feed.subtitle)
- this._setContentText(SUBTITLE_ID, container.subtitle.plainText());
+ this._setContentText(SUBTITLE_ID, container.subtitle);
},
/**
@@ -439,7 +443,11 @@ FeedWriter.prototype = {
// If the entry has a title, make it a link
if (entry.title) {
var a = this._document.createElementNS(HTML_NS, "a");
- a.appendChild(this._document.createTextNode(entry.title.plainText()));
+ var span = this._document.createElementNS(HTML_NS, "span");
+ a.appendChild(span);
+ if (entry.title.base)
+ span.setAttributeNS(XML_NS, "base", entry.title.base.spec);
+ span.appendChild(entry.title.createDocumentFragment(a));
// Entries are not required to have links, so entry.link can be null.
if (entry.link)
diff --git a/browser/components/feeds/test/Makefile.in b/browser/components/feeds/test/Makefile.in
index ce2adb7f0e5b..db9ac6c29c35 100644
--- a/browser/components/feeds/test/Makefile.in
+++ b/browser/components/feeds/test/Makefile.in
@@ -18,6 +18,8 @@ MOCHITEST_FILES = bug408328-data.xml \
bug494328-data.xml \
test_bug589543.html \
bug589543-data.xml \
+ test_bug436801.html \
+ bug436801-data.xml \
test_registerHandler.html \
valid-feed.xml \
valid-unsniffable-feed.xml \
diff --git a/browser/components/feeds/test/bug436801-data.xml b/browser/components/feeds/test/bug436801-data.xml
new file mode 100644
index 000000000000..0e45c7ed8ed8
--- /dev/null
+++ b/browser/components/feeds/test/bug436801-data.xml
@@ -0,0 +1,44 @@
+
+
+ ++ +