Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Clear visited link state when history is cleared
Browse files Browse the repository at this point in the history
Fix brave/browser-laptop#9351

Test plan:
1. go to https://www.google.com/#q=test
2. click on the first result
3. go to https://www.google.com/#q=test again. the first result should appear as a visited link.
4. go to History > Clear Browsing Data and clear history.
5. the visited link should appear as unvisited
  • Loading branch information
diracdeltas committed Jun 14, 2017
1 parent 5466f74 commit 121748c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions atom/browser/api/atom_api_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ void Session::ClearHistory(mate::Arguments* args) {
base::Time::Max(),
callback,
&task_tracker);
// Clear visited link state
history_service->DeleteVisitedURLs();
}

void Session::FlushStorageData() {
Expand Down
36 changes: 36 additions & 0 deletions patches/master_patch.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,42 @@ index 1c68e13912c2dfa7cc842bab169029c58677811a..3731fe3df76b0ac1dbf155c221fc64e2
}

content::WebContents* GuestViewManager::GetGuestByInstanceIDSafely(
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc
index b9ebe00521add936bbbd9d22696e8edf2421a08b..1ff326737ef1047fd639f33742696cdbc9f784be 100644
--- a/components/history/core/browser/history_service.cc
+++ b/components/history/core/browser/history_service.cc
@@ -1023,6 +1023,17 @@ void HistoryService::DeleteURLsForTest(const std::vector<GURL>& urls) {
history_backend_, urls));
}

+void HistoryService::DeleteVisitedURLs() {
+ DCHECK(backend_task_runner_) << "History service being called after cleanup";
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (visit_delegate_) {
+ visit_delegate_->DeleteAllURLs();
+ } else {
+ LOG(WARNING) << "History service missing visit delegate";
+ }
+};
+
void HistoryService::ExpireHistoryBetween(
const std::set<GURL>& restrict_urls,
Time begin_time,
diff --git a/components/history/core/browser/history_service.h b/components/history/core/browser/history_service.h
index c89868c9b4f974503c737d8b635469b089cd8f10..efbf919cbe4b219b869c451e101209efab48c0a1 100644
--- a/components/history/core/browser/history_service.h
+++ b/components/history/core/browser/history_service.h
@@ -352,6 +352,9 @@ class HistoryService : public syncer::SyncableService, public KeyedService {
// URLs one by one is slow as it has to flush to disk each time.)
void DeleteURLsForTest(const std::vector<GURL>& urls);

+ // Purges database of visited links in the visit delegate
+ void DeleteVisitedURLs();
+
// Removes all visits in the selected time range (including the
// start time), updating the URLs accordingly. This deletes any
// associated data. This function also deletes the associated
diff --git a/components/printing/common/print_messages.h b/components/printing/common/print_messages.h
index d11d28dee8d067d142cf9b16f4130c1aeba63a03..1cc8f14d464bf4f20e69c7009fdfacb895eab605 100644
--- a/components/printing/common/print_messages.h
Expand Down

0 comments on commit 121748c

Please sign in to comment.