Bug 1304914 - Don't show "offline version" notifications on error pages r=ahunt

MozReview-Commit-ID: BE6GPLCAU3h

--HG--
extra : rebase_source : 4fd79c95f202b6ed550968acdaf31dc9efae56e5
This commit is contained in:
Grigory Kruglov 2016-09-26 13:53:52 -07:00
Родитель 9b6d615f82
Коммит bd06fa760b
1 изменённых файлов: 12 добавлений и 2 удалений

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

@ -63,9 +63,19 @@ public class OfflineTabStatusDelegate extends TabsTrayVisibilityAwareDelegate im
return;
}
// We only want to show these notifications for tabs that were loaded successfully.
if (tab.getState() != Tab.STATE_SUCCESS) {
return;
}
switch (event) {
// Show offline notification if tab is visible, or queue it for display later.
case PAGE_SHOW:
// We listen specifically for the STOP event (as opposed to PAGE_SHOW), because we need
// to know if page load actually succeeded. When STOP is triggered, tab.getState()
// will return definitive STATE_SUCCESS or STATE_ERROR. When PAGE_SHOW is triggered,
// tab.getState() will return STATE_LOADING, which is ambiguous for our purposes.
// We don't want to show these notifications for 404 pages, for example. See Bug 1304914.
case STOP:
// Show offline notification if tab is visible, or queue it for display later.
if (!isTabsTrayVisible() && Tabs.getInstance().isSelectedTab(tab)) {
showLoadedOfflineSnackbar(activityReference.get());
} else {