Bug 801097 - Reader mode title shows HTML character encodings, r=bnicholson
authorMark Capella <markcapella@twcny.rr.com>
Wed, 30 Jan 2013 22:44:31 -0500
changeset 130306 09334ec10eba0682091df627d2da59af4def8451
parent 130305 0b427bfd720d4e07b83edaaaf17ed3cf7a6c8855
child 130307 91db03dc9c5a32968dd5c14a5328a27479f8cc8c
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs801097
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 801097 - Reader mode title shows HTML character encodings, r=bnicholson
mobile/android/chrome/content/aboutReader.js
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/aboutReader.js
+++ b/mobile/android/chrome/content/aboutReader.js
@@ -453,17 +453,17 @@ AboutReader.prototype = {
 
     let articleUri = Services.io.newURI(article.url, null, null);
     let domain = articleUri.host;
 
     this._domainElement.innerHTML = domain;
 
     this._creditsElement.innerHTML = article.byline;
 
-    this._titleElement.innerHTML = article.title;
+    this._titleElement.textContent = article.title;
     this._doc.title = article.title;
 
     this._headerElement.style.display = "block";
 
     let parserUtils = Cc["@mozilla.org/parserutils;1"].getService(Ci.nsIParserUtils);
     let contentFragment = parserUtils.parseFragment(article.content, Ci.nsIParserUtils.SanitizerDropForms,
                                                     false, articleUri, this._contentElement);
     this._contentElement.innerHTML = "";
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -7833,18 +7833,22 @@ let Reader = {
     }
 
     let worker = new ChromeWorker("readerWorker.js");
     worker.onmessage = function (evt) {
       let article = evt.data;
 
       // Append URL to the article data. specIgnoringRef will ignore any hash
       // in the URL.
-      if (article)
+      if (article) {
         article.url = uri.specIgnoringRef;
+        let flags = Ci.nsIDocumentEncoder.OutputSelectionOnly | Ci.nsIDocumentEncoder.OutputAbsoluteLinks;
+        article.title = Cc["@mozilla.org/parserutils;1"].getService(Ci.nsIParserUtils)
+                                                        .convertToPlainText(article.title, flags, 0);
+      }
 
       callback(article);
     };
 
     try {
       worker.postMessage({
         uri: {
           spec: uri.spec,