Bug 1363049 - getNextTab() should only use parent tabs of the same type. r=walkingice
authorJan Henning <jh+bugzilla@buttercookie.de>
Thu, 18 May 2017 20:45:22 +0200
changeset 581457 f45828fef3742b97a82139100cbdd4c092a16045
parent 581456 6c78590231f492d7e78519d3caba5b5fa7752b53
child 581458 68c474271ba5786863f2e89bfcf8e6069383c38a
push id59891
push usermaglione.k@gmail.com
push dateFri, 19 May 2017 22:42:17 +0000
reviewerswalkingice
bugs1363049
milestone55.0a1
Bug 1363049 - getNextTab() should only use parent tabs of the same type. r=walkingice That is if the currently selected tab has a web app or custom tab as its "parent tab", we'll ignore that fact when the tab is closed from the tabs tray, so we don't trigger an activity switch that way. MozReview-Commit-ID: 7bOi90RQUhA
mobile/android/base/java/org/mozilla/gecko/Tabs.java
--- a/mobile/android/base/java/org/mozilla/gecko/Tabs.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Tabs.java
@@ -594,17 +594,17 @@ public class Tabs implements BundleEvent
         }
         if (nextTab == null && type != TabType.BROWSING) {
             // If there are no non-private tabs of the same type remaining,
             // fall back to TabType.BROWSING.
             nextTab = getFallbackNextTab(TabType.BROWSING);
         }
 
         Tab parent = getTab(tab.getParentId());
-        if (parent != null) {
+        if (parent != null && parent.getType() == type) {
             // If the next tab is a sibling, switch to it. Otherwise go back to the parent.
             if (nextTab != null && nextTab.getParentId() == tab.getParentId())
                 return nextTab;
             else
                 return parent;
         }
         return nextTab;
     }