Skip to content

Commit

Permalink
Fix brave/brave-ios#8606: Fix background tab navigation (brave/brave-…
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Jan 4, 2024
1 parent 595c568 commit d7aa593
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,15 @@ extension BrowserViewController: WKNavigationDelegate {
if navigationResponse.isForMainFrame, let url = responseURL, url.isWebPage(includeDataURIs: false),
let mimeType = response.mimeType.flatMap({ UTType(mimeType: $0) }),
mimeTypesThatRequireSFSafariViewControllerHandling.contains(mimeType) {
handleLinkWithSafariViewController(url, tab: tab)

let isAboutHome = InternalURL(url)?.isAboutHomeURL == true
let isNonActiveTab = isAboutHome ? false : url.host != tabManager.selectedTab?.url?.host

// Check website is trying to open Safari Controller in non-active tab
if !isNonActiveTab {
handleLinkWithSafariViewController(url, tab: tab)
}

return .cancel
}

Expand Down

0 comments on commit d7aa593

Please sign in to comment.