Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: chrome/browser/safe_browsing/client_side_detection_host.cc

Issue 1509073002: Fixes for Safe Browsing with unrelated pending navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/client_side_detection_host.cc
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc
index ef73fb4f7265b6025066d1d1a4cf19a19d84220b..ef03f96da019e52a9545503bb0728e3027cc10fb 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host.cc
@@ -405,7 +405,7 @@ void ClientSideDetectionHost::DidNavigateMainFrame(
void ClientSideDetectionHost::OnSafeBrowsingHit(
const SafeBrowsingUIManager::UnsafeResource& resource) {
- if (!web_contents() || !web_contents()->GetController().GetActiveEntry())
+ if (!web_contents())
Charlie Reis 2015/12/11 05:39:24 Unfortunately, you might still need a null check o
Nathan Parker 2015/12/11 19:48:06 How is web_contents_ different from what resource.
Charlie Reis 2015/12/11 21:10:04 resource.GetNavigationEntryForResource() handles t
mattm 2015/12/15 01:42:25 The UnsafeResource doesn't really have any enforce
mattm 2015/12/15 01:42:25 Thanks, done.
return;
// Check that the hit is either malware or phishing.
@@ -422,7 +422,7 @@ void ClientSideDetectionHost::OnSafeBrowsingHit(
// Store the unique page ID for later.
unsafe_unique_page_id_ =
- web_contents()->GetController().GetActiveEntry()->GetUniqueID();
+ resource.GetNavigationEntryForResource()->GetUniqueID();
// We also keep the resource around in order to be able to send the
// malicious URL to the server.
@@ -674,7 +674,7 @@ bool ClientSideDetectionHost::DidShowSBInterstitial() const {
return false;
}
const NavigationEntry* nav_entry =
- web_contents()->GetController().GetActiveEntry();
+ web_contents()->GetController().GetLastCommittedEntry();
Charlie Reis 2015/12/11 05:39:24 Is this meant to be called while the interstitial
mattm 2015/12/15 01:42:25 If the interstitial was a blocking main page load,
return (nav_entry && nav_entry->GetUniqueID() == unsafe_unique_page_id_);
}

Powered by Google App Engine
This is Rietveld 408576698