Bug 1152412 - Handle errors downloading and parsing documents for reader view. r=bnicholson

--HG--
extra : rebase_source : 3bb7f0207971e48445ad46ddc28d2855d8ba1c3f
This commit is contained in:
Margaret Leibovic 2015-04-10 14:41:14 -07:00
parent bff6d53b6d
commit ef66ed11a8
3 changed files with 12 additions and 2 deletions

View File

@ -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;
});
})
};

View File

@ -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) {

View File

@ -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]");