Chromium Code Reviews| Index: components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc |
| diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc |
| index 27c14506f56212c2ecb68add9a27b1a498cd77c5..058a7c3359b1c64faf2a6fc3a81eeeaa401d677c 100644 |
| --- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc |
| +++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc |
| @@ -82,11 +82,8 @@ SubresourceFilterSafeBrowsingActivationThrottle::WillRedirectRequest() { |
| content::NavigationThrottle::ThrottleCheckResult |
| SubresourceFilterSafeBrowsingActivationThrottle::WillProcessResponse() { |
| - if (!database_client_) |
| - return content::NavigationThrottle::PROCEED; |
| - |
| // No need to defer the navigation if the check already happened. |
| - if (check_results_.back().finished) { |
| + if (!database_client_ || check_results_.back().finished) { |
| NotifyResult(); |
| return content::NavigationThrottle::ThrottleCheckResult::PROCEED; |
| } |
| @@ -132,14 +129,22 @@ void SubresourceFilterSafeBrowsingActivationThrottle::NotifyResult() { |
| using subresource_filter::ContentSubresourceFilterDriverFactory; |
| - const SubresourceFilterSafeBrowsingClient::CheckResult& result = |
| - check_results_.back(); |
| ContentSubresourceFilterDriverFactory* driver_factory = |
| ContentSubresourceFilterDriverFactory::FromWebContents(web_contents); |
| DCHECK(driver_factory); |
| - driver_factory->OnMainResourceMatchedSafeBrowsingBlacklist( |
| - navigation_handle()->GetURL(), result.threat_type, result.pattern_type); |
| + const SubresourceFilterSafeBrowsingClient::CheckResult& result = |
| + check_results_.back(); |
|
Charlie Harrison
2017/05/19 11:15:41
Here's the issue, we call back() on an empty vecto
|
| + auto threat_type = safe_browsing::SBThreatType::SB_THREAT_TYPE_SAFE; |
| + auto pattern_type = safe_browsing::ThreatPatternType::NONE; |
| + if (database_client_) { |
| + DCHECK(!check_results_.empty()); |
| + DCHECK(check_results_.back().finished); |
| + threat_type = result.threat_type; |
| + pattern_type = result.pattern_type; |
| + } |
| + driver_factory->OnSafeBrowsingMatchComputed(navigation_handle(), threat_type, |
| + pattern_type); |
| base::TimeDelta delay = defer_time_.is_null() |
| ? base::TimeDelta::FromMilliseconds(0) |