зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1147122 - Restore reader view error message if about:reader fails when user clicks reader button. r=Gijs
--HG-- extra : rebase_source : 1a4233cc2046285f7303d36c0bde21e19a19636d
This commit is contained in:
Родитель
49c5893d01
Коммит
2004dde9a1
|
@ -572,7 +572,12 @@ AboutReader.prototype = {
|
|||
|
||||
if (article && article.url == url) {
|
||||
this._showContent(article);
|
||||
} else if (this._articlePromise) {
|
||||
// If we were promised an article, show an error message if there's a failure.
|
||||
this._showError();
|
||||
} else {
|
||||
// Otherwise, just load the original URL. We can encounter this case when
|
||||
// loading an about:reader URL directly (e.g. opening a reading list item).
|
||||
this._win.location.href = url;
|
||||
}
|
||||
}),
|
||||
|
@ -664,14 +669,17 @@ AboutReader.prototype = {
|
|||
this._headerElement.setAttribute("dir", article.dir);
|
||||
},
|
||||
|
||||
_showError: function Reader_showError(error) {
|
||||
_showError: function() {
|
||||
this._headerElement.style.display = "none";
|
||||
this._contentElement.style.display = "none";
|
||||
|
||||
this._messageElement.innerHTML = error;
|
||||
let errorMessage = gStrings.GetStringFromName("aboutReader.loadError");
|
||||
this._messageElement.textContent = errorMessage;
|
||||
this._messageElement.style.display = "block";
|
||||
|
||||
this._doc.title = error;
|
||||
this._doc.title = errorMessage;
|
||||
|
||||
this._error = true;
|
||||
},
|
||||
|
||||
// This function is the JS version of Java's StringUtils.stripCommonSubdomains.
|
||||
|
@ -730,15 +738,16 @@ AboutReader.prototype = {
|
|||
_showProgressDelayed: function Reader_showProgressDelayed() {
|
||||
this._win.setTimeout(function() {
|
||||
// No need to show progress if the article has been loaded,
|
||||
// or if the window has been unloaded.
|
||||
if (this._article || this._windowUnloaded) {
|
||||
// if the window has been unloaded, or if there was an error
|
||||
// trying to load the article.
|
||||
if (this._article || this._windowUnloaded || this._error) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._headerElement.style.display = "none";
|
||||
this._contentElement.style.display = "none";
|
||||
|
||||
this._messageElement.innerHTML = gStrings.GetStringFromName("aboutReader.loading");
|
||||
this._messageElement.textContent = gStrings.GetStringFromName("aboutReader.loading");
|
||||
this._messageElement.style.display = "block";
|
||||
}.bind(this), 300);
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче