Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] - Fix private-mode/normal-mode flip when opening tabs #26621

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,12 @@ public class BrowserViewController: UIViewController {
let request: URLRequest?
if let url = url {
// If only empty tab present, the url will open in existing tab
if tabManager.isBrowserEmptyForCurrentMode {
// We also need to respect private browsing mode when opening URLs directly.
// If the only tab open is NTP, AND the private mode matches that of the tab request,
// only then we can open the tab directly.
if tabManager.isBrowserEmptyForCurrentMode
&& tabManager.privateBrowsingManager.isPrivateBrowsing == isPrivate
{
finishEditingAndSubmit(url)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,9 @@ class TabManager: NSObject {
if previous === tab {
return
}
// Convert the global mode to private if opening private tab from normal tab/ history/bookmark.
if selectedTab?.isPrivate != true && tab?.isPrivate == true {
privateBrowsingManager.isPrivateBrowsing = true
}
// Convert the global mode to normal/private
privateBrowsingManager.isPrivateBrowsing = tab?.isPrivate == true

// Make sure to wipe the private tabs if the user has the pref turned on
if !TabType.of(tab).isPrivate
&& (Preferences.Privacy.privateBrowsingOnly.value
Expand Down
Loading