Bug 1271511 - keep reader mode icon visible when exiting from reader mode to source page. r=ahunt

MozReview-Commit-ID: JxNRdXCSFGx

--HG--
extra : transplant_source : %5E%F2%BC%F7y%AE%B1%85%DA%7C%40%8B.%98%FB%B1Y%1A%BD%E0
extra : histedit_source : 431d9e9ef7a208203d4623d5eeaa9071fef3226e
This commit is contained in:
danhuang1202 2016-05-10 11:28:07 +08:00
Родитель be9ba0fd90
Коммит d513a62608
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -22,6 +22,8 @@ var AboutReaderListener = {
_articlePromise: null,
_isLeavingReaderMode: false,
init: function() {
addEventListener("AboutReaderContentLoaded", this, false, true);
addEventListener("DOMContentLoaded", this, false);
@ -39,6 +41,7 @@ var AboutReaderListener = {
this._articlePromise = ReaderMode.parseDocument(content.document).catch(Cu.reportError);
ReaderMode.enterReaderMode(docShell, content);
} else {
this._isLeavingReaderMode = true;
ReaderMode.leaveReaderMode(docShell, content);
}
break;
@ -75,7 +78,13 @@ var AboutReaderListener = {
break;
case "pagehide":
sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: false });
// this._isLeavingReaderMode is used here to keep the Reader Mode icon
// visible in the location bar when transitioning from reader-mode page
// back to the source page.
sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: this._isLeavingReaderMode });
if (this._isLeavingReaderMode) {
this._isLeavingReaderMode = false;
}
break;
case "pageshow":