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 @@ + + + + + <div xmlns="http://www.w3.org/1999/xhtml">Example of a <em>special</em> feed (<img height="20px" src="baz.png" alt="base test sprite"/>)</div> + + + + special subtitle (base test sprite) + ]]> + + + + + 2010-09-02T18:30:02Z + + + John Doe + + + urn:uuid:22906062-ecbd-46e2-b6a7-3039506a398f + + + + <div xmlns="http://www.w3.org/1999/xhtml">Some <abbr title="Extensible Hyper-text Mark-up Language">XHTML</abbr> examples (<img height="20px" src="baz.png" alt="base test sprite"/>)</div> + + urn:uuid:b48083a7-71a7-4c9c-8515-b7c0d22955e7 + 2010-09-02T18:30:02Z + Some text. + + + + + <![CDATA[ + Some <abbr title="Hyper-text Mark-up Language">HTML</abbr> examples (<img height="20px" src="baz.png" alt="base test sprite"/>) + ]]> + + urn:uuid:1424967a-280a-414d-b0ab-8b11c4ac1bb7 + 2010-09-02T18:30:02Z + Some text. + + + diff --git a/browser/components/feeds/test/test_bug436801.html b/browser/components/feeds/test/test_bug436801.html new file mode 100644 index 000000000000..d26ff4892de6 --- /dev/null +++ b/browser/components/feeds/test/test_bug436801.html @@ -0,0 +1,119 @@ + + + + + Test feed preview subscribe UI + + + + + +Mozilla Bug 436801 +

+ +
+
+
+ +