diff --git a/DuckDuckGo/BrowserTab/Model/Tab.swift b/DuckDuckGo/BrowserTab/Model/Tab.swift index e4df256383..6ab6c46323 100644 --- a/DuckDuckGo/BrowserTab/Model/Tab.swift +++ b/DuckDuckGo/BrowserTab/Model/Tab.swift @@ -127,8 +127,6 @@ final class Tab: NSObject { let host = content.url?.host { faviconService.cacheIfNeeded(favicon: favicon, for: host, isFromUserScript: false) } - - updateDashboardInfo(url: content.url) } deinit { @@ -151,7 +149,6 @@ final class Tab: NSObject { didSet { handleFavicon(oldContent: oldValue) invalidateSessionStateData() - updateDashboardInfo(oldUrl: oldValue.url, url: content.url) reloadIfNeeded() if let title = content.title { @@ -294,7 +291,6 @@ final class Tab: NSObject { webView.load(url) } else { webView.reload() - updateDashboardInfo(url: content.url) } } @@ -501,15 +497,9 @@ final class Tab: NSObject { @Published var serverTrust: ServerTrust? @Published var connectionUpgradedTo: URL? - private func updateDashboardInfo(oldUrl: URL? = nil, url: URL?) { - guard let url = url, let host = url.host else { - trackerInfo = nil - serverTrust = nil - return - } - - if oldUrl?.host != host || oldUrl?.scheme != url.scheme { - trackerInfo = TrackerInfo() + public func resetDashboardInfo(_ url: URL?) { + trackerInfo = TrackerInfo() + if self.serverTrust?.host != url?.host { serverTrust = nil } } diff --git a/DuckDuckGo/BrowserTab/View/BrowserTabViewController.swift b/DuckDuckGo/BrowserTab/View/BrowserTabViewController.swift index d62c557103..fd8abb35ff 100644 --- a/DuckDuckGo/BrowserTab/View/BrowserTabViewController.swift +++ b/DuckDuckGo/BrowserTab/View/BrowserTabViewController.swift @@ -329,6 +329,7 @@ extension BrowserTabViewController: TabDelegate { guard let tabViewModel = tabViewModel else { return } tabViewModel.closeFindInPage() + tabViewModel.tab.resetDashboardInfo(tabViewModel.tab.webView.url) tab.permissions.tabDidStartNavigation() if !tabViewModel.isLoading, tabViewModel.tab.webView.isLoading {