From 4dd754986986cc838d335f40981615506bb6846e Mon Sep 17 00:00:00 2001 From: Mark Capella Date: Mon, 14 Oct 2013 09:58:16 -0400 Subject: [PATCH] Bug 923086 - "Add to reading list" button does not save it's state, r=lucasr Part 1 - Ensure readinglist banner not visible until state is finalized --- mobile/android/chrome/content/aboutReader.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mobile/android/chrome/content/aboutReader.js b/mobile/android/chrome/content/aboutReader.js index bf3efffe771..b54504cc00d 100644 --- a/mobile/android/chrome/content/aboutReader.js +++ b/mobile/android/chrome/content/aboutReader.js @@ -123,7 +123,7 @@ let AboutReader = function(doc, win) { this._updateToggleButton(); // Track status of reader toolbar list button - this._readingListCount = 0; + this._readingListCount = -1; this._updateListButton(); this._requestReadingListCount(); @@ -214,8 +214,14 @@ AboutReader.prototype = { case "Reader:ListCountUpdated": { let count = parseInt(aData); if (this._readingListCount != count) { + let isInitialStateChange = (this._readingListCount == -1); this._readingListCount = count; this._updateListButton(); + + // Display the toolbar when all its initial component states are known + if (isInitialStateChange) { + this._setToolbarVisibility(true); + } } break; } @@ -324,7 +330,7 @@ AboutReader.prototype = { }, _onList: function Reader_onList() { - if (!this._article || this._readingListCount == 0) + if (!this._article || this._readingListCount < 1) return; gChromeWin.sendMessageToJava({ type: "Reader:GoToReadingList" }); @@ -455,6 +461,10 @@ AboutReader.prototype = { if (!this._toolbarEnabled) return; + // Don't allow visible toolbar until banner state is known + if (this._readingListCount == -1) + return; + if (this._getToolbarVisibility() === visible) return;