Skip to content

Commit

Permalink
Fixed #8960: Browser incorrect session when closing single tab in pri…
Browse files Browse the repository at this point in the history
…vate mode (#8966)
  • Loading branch information
nbhasin2 authored and boek committed Aug 4, 2021
1 parent bc51d27 commit 14c0df9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Client/Frontend/Browser/TabDisplayManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TabDisplayManager: NSObject, FeatureFlagsProtocol {
}

private var tabsToDisplay: [Tab] {
if shouldEnableInactiveTabs { return getTabsToDisplay() }
if shouldEnableInactiveTabs { return getTabsAndUpdateInactiveState() }
let allTabs = self.isPrivate ? tabManager.privateTabs : tabManager.normalTabs
return allTabs
}
Expand Down Expand Up @@ -158,7 +158,10 @@ class TabDisplayManager: NSObject, FeatureFlagsProtocol {
}
}

func getTabsToDisplay() -> [Tab] {
/// This is a helper method to update inactive tab state and should not be called directly
/// Even when we have inactive tabs enabled try to call `tabsToDisplay`
/// `tabsToDisplay` will make sure to get the correct set ot tabs and also check if feature is enabled
private func getTabsAndUpdateInactiveState() -> [Tab] {
let allTabs = self.isPrivate ? tabManager.privateTabs : tabManager.normalTabs
guard allTabs.count > 0, let inactiveViewModel = inactiveViewModel else { return [Tab]() }
guard allTabs.count > 1 else { return allTabs }
Expand Down Expand Up @@ -244,12 +247,12 @@ class TabDisplayManager: NSObject, FeatureFlagsProtocol {
return
}

if getTabsToDisplay().count == 1 {
if self.isPrivate == false, tabsToDisplay.count == 1 {
tabManager.removeTabs([tab])
tabManager.selectTab(tabManager.addTab())
return
}

tabManager.removeTabAndUpdateSelectedIndex(tab)
}

Expand Down

1 comment on commit 14c0df9

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

InterpreterError at template.tasks[0][1].extra[0].treeherder[1].symbol: unknown context value cron

Please sign in to comment.