diff --git a/browser/modules/ReaderParent.jsm b/browser/modules/ReaderParent.jsm index 4fd40f1bc0f1..dd18eb1a904d 100644 --- a/browser/modules/ReaderParent.jsm +++ b/browser/modules/ReaderParent.jsm @@ -214,6 +214,9 @@ let ReaderParent = { * @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; + }); }) }; diff --git a/mobile/android/chrome/content/Reader.js b/mobile/android/chrome/content/Reader.js index 1f54ee0a9f29..afc96e5893dc 100644 --- a/mobile/android/chrome/content/Reader.js +++ b/mobile/android/chrome/content/Reader.js @@ -287,7 +287,10 @@ let Reader = { // 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) { diff --git a/toolkit/components/reader/ReaderMode.jsm b/toolkit/components/reader/ReaderMode.jsm index f46a447c0702..b4cab82eea05 100644 --- a/toolkit/components/reader/ReaderMode.jsm +++ b/toolkit/components/reader/ReaderMode.jsm @@ -131,6 +131,10 @@ this.ReaderMode = { } let doc = xhr.responseXML; + if (!doc) { + reject("Reader mode XHR didn't return a document"); + return; + } // Manually follow a meta refresh tag if one exists. let meta = doc.querySelector("meta[http-equiv=refresh]");