From bd95c96dc8dfa3f439e91881b0b040596369a5ed Mon Sep 17 00:00:00 2001 From: mawen7 Date: Wed, 8 Jan 2020 11:28:42 +0100 Subject: [PATCH] [fenix] Only close tab on back press if it has a parent tab --- .../java/org/mozilla/fenix/browser/BaseBrowserFragment.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index 483516b96b..983c4f12d9 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -568,7 +568,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session /** * Removes the session if it was opened by an ACTION_VIEW intent - * or if it has no more history + * or if it has a parent session and no more history */ protected open fun removeSessionIfNeeded(): Boolean { getSessionById()?.let { session -> @@ -578,7 +578,9 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session } else { val isLastSession = sessionManager.sessionsOfType(private = session.private).count() == 1 - sessionManager.remove(session, session.hasParentSession) + if (session.hasParentSession) { + sessionManager.remove(session, true) + } val goToOverview = isLastSession || !session.hasParentSession return !goToOverview }