Bug 1152412 - Handle errors downloading and parsing documents for reader view. r=bnicholson a=lmandel
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Fri, 10 Apr 2015 14:41:14 -0700
changeset 260499 964442785c00
parent 260498 93b96d846d47
child 260500 5741ccc7bb74
push id801
push userkwierso@gmail.com
push date2015-05-14 20:31 +0000
treeherdermozilla-release@5741ccc7bb74 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, lmandel
bugs1152412
milestone38.0.1
Bug 1152412 - Handle errors downloading and parsing documents for reader view. r=bnicholson a=lmandel
browser/modules/ReaderParent.jsm
mobile/android/chrome/content/Reader.js
--- a/browser/modules/ReaderParent.jsm
+++ b/browser/modules/ReaderParent.jsm
@@ -253,11 +253,14 @@ let ReaderParent = {
    * Gets an article for a given URL. This method will download and parse a document.
    *
    * @param url The article URL.
    * @param browser The browser where the article is currently loaded.
    * @return {Promise}
    * @resolves JS object representing the article, or null if no article is found.
    */
   _getArticle: Task.async(function* (url, browser) {
-    return yield ReaderMode.downloadAndParseDocument(url);
+    return yield ReaderMode.downloadAndParseDocument(url).catch(e => {
+      Cu.reportError("Error downloading and parsing document: " + e);
+      return null;
+    });
   })
 };
--- a/mobile/android/chrome/content/Reader.js
+++ b/mobile/android/chrome/content/Reader.js
@@ -280,17 +280,20 @@ let Reader = {
     // Next, try to find a parsed article in the cache.
     article = yield ReaderMode.getArticleFromCache(url);
     if (article) {
       return article;
     }
 
     // Article hasn't been found in the cache, we need to
     // download the page and parse the article out of it.
-    return yield ReaderMode.downloadAndParseDocument(url);
+    return yield ReaderMode.downloadAndParseDocument(url).catch(e => {
+      Cu.reportError("Error downloading and parsing document: " + e);
+      return null;
+    });;
   }),
 
   _getSavedArticle: function(browser) {
     return new Promise((resolve, reject) => {
       let mm = browser.messageManager;
       let listener = (message) => {
         mm.removeMessageListener("Reader:SavedArticleData", listener);
         resolve(message.data.article);