Skip to content

Commit

Permalink
Reset tracker info on page change
Browse files Browse the repository at this point in the history
  • Loading branch information
alistairjcbrown committed Nov 22, 2021
1 parent bec4dc4 commit 50bd0c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
16 changes: 3 additions & 13 deletions DuckDuckGo/BrowserTab/Model/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -294,7 +291,6 @@ final class Tab: NSObject {
webView.load(url)
} else {
webView.reload()
updateDashboardInfo(url: content.url)
}
}

Expand Down Expand Up @@ -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
}
}
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/BrowserTab/View/BrowserTabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 50bd0c0

Please sign in to comment.