Bug 1147487 - don't bother sending reader mode updates when isArticle is false, r=margaret

--HG--
extra : rebase_source : ccc17edf45f1cc70d9582ecd1a30db737deb3c14
This commit is contained in:
Gijs Kruitbosch 2015-04-07 17:07:29 +01:00
Родитель a3918649d6
Коммит b3d2ee3aa4
1 изменённых файлов: 8 добавлений и 3 удалений

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

@ -568,11 +568,16 @@ let AboutReaderListener = {
}
},
updateReaderButton: function() {
if (!ReaderMode.isEnabledForParseOnLoad || this.isAboutReader) {
if (!ReaderMode.isEnabledForParseOnLoad || this.isAboutReader ||
!(content.document instanceof content.HTMLDocument) ||
content.document.mozSyntheticDocument) {
return;
}
let isArticle = ReaderMode.isProbablyReaderable(content.document);
sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: isArticle });
// Only send updates when there are articles; there's no point updating with
// |false| all the time.
if (ReaderMode.isProbablyReaderable(content.document)) {
sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: true });
}
},
};
AboutReaderListener.init();