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

Reset tracker info on page change #335

Merged
merged 1 commit into from
Nov 25, 2021
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
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 {
jonathanKingston marked this conversation as resolved.
Show resolved Hide resolved
trackerInfo = TrackerInfo()
public func resetDashboardInfo(_ url: URL?) {
trackerInfo = TrackerInfo()
if self.serverTrust?.host != url?.host {
alistairjcbrown marked this conversation as resolved.
Show resolved Hide resolved
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