Commit f6588405 authored by Carlos IL's avatar Carlos IL Committed by Commit Bot

Finished cleanup of |should_ssl_errors_be_fatal| flag

Removed separate |should_ssl_errors_be_fatal| flag from places that
were still passing it, since it is no longer required as |ssl_info| now
contains that information.

Bug: 783262
Change-Id: I0994458c32dc2cf078108032b6d6c3f9d2c6cfc3
Reviewed-on: https://chromium-review.googlesource.com/811452Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Reviewed-by: default avatarEmily Stark <estark@chromium.org>
Commit-Queue: Carlos IL <carlosil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522477}
parent ec4490c0
...@@ -133,8 +133,7 @@ TEST_P(SSLErrorNavigationThrottleTest, NoSSLInfo) { ...@@ -133,8 +133,7 @@ TEST_P(SSLErrorNavigationThrottleTest, NoSSLInfo) {
<< "Asynchronous MockHandleSSLError: " << async_); << "Asynchronous MockHandleSSLError: " << async_);
content::NavigationThrottle::ThrottleCheckResult result = content::NavigationThrottle::ThrottleCheckResult result =
handle_->CallWillFailRequestForTesting( handle_->CallWillFailRequestForTesting(base::nullopt);
base::nullopt, false /* should_ssl_errors_be_fatal */);
EXPECT_FALSE(handle_->GetSSLInfo().is_valid()); EXPECT_FALSE(handle_->GetSSLInfo().is_valid());
EXPECT_EQ(content::NavigationThrottle::PROCEED, result); EXPECT_EQ(content::NavigationThrottle::PROCEED, result);
...@@ -151,8 +150,7 @@ TEST_P(SSLErrorNavigationThrottleTest, SSLInfoWithoutCertError) { ...@@ -151,8 +150,7 @@ TEST_P(SSLErrorNavigationThrottleTest, SSLInfoWithoutCertError) {
net::SSLInfo ssl_info; net::SSLInfo ssl_info;
ssl_info.cert_status = net::CERT_STATUS_IS_EV; ssl_info.cert_status = net::CERT_STATUS_IS_EV;
content::NavigationThrottle::ThrottleCheckResult result = content::NavigationThrottle::ThrottleCheckResult result =
handle_->CallWillFailRequestForTesting( handle_->CallWillFailRequestForTesting(ssl_info);
ssl_info, false /* should_ssl_errors_be_fatal */);
EXPECT_EQ(net::CERT_STATUS_IS_EV, handle_->GetSSLInfo().cert_status); EXPECT_EQ(net::CERT_STATUS_IS_EV, handle_->GetSSLInfo().cert_status);
EXPECT_EQ(content::NavigationThrottle::PROCEED, result); EXPECT_EQ(content::NavigationThrottle::PROCEED, result);
...@@ -171,8 +169,7 @@ TEST_P(SSLErrorNavigationThrottleTest, SSLInfoWithCertError) { ...@@ -171,8 +169,7 @@ TEST_P(SSLErrorNavigationThrottleTest, SSLInfoWithCertError) {
net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem"); net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem");
ssl_info.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; ssl_info.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID;
content::NavigationThrottle::ThrottleCheckResult synchronous_result = content::NavigationThrottle::ThrottleCheckResult synchronous_result =
handle_->CallWillFailRequestForTesting( handle_->CallWillFailRequestForTesting(ssl_info);
ssl_info, false /* should_ssl_errors_be_fatal */);
EXPECT_EQ(content::NavigationThrottle::DEFER, synchronous_result.action()); EXPECT_EQ(content::NavigationThrottle::DEFER, synchronous_result.action());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
......
...@@ -449,8 +449,7 @@ NavigationHandleImpl::CallWillRedirectRequestForTesting( ...@@ -449,8 +449,7 @@ NavigationHandleImpl::CallWillRedirectRequestForTesting(
NavigationThrottle::ThrottleCheckResult NavigationThrottle::ThrottleCheckResult
NavigationHandleImpl::CallWillFailRequestForTesting( NavigationHandleImpl::CallWillFailRequestForTesting(
base::Optional<net::SSLInfo> ssl_info, base::Optional<net::SSLInfo> ssl_info) {
bool should_ssl_errors_be_fatal) {
NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER;
WillFailRequest(ssl_info, base::Bind(&UpdateThrottleCheckResult, &result)); WillFailRequest(ssl_info, base::Bind(&UpdateThrottleCheckResult, &result));
......
...@@ -158,8 +158,7 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { ...@@ -158,8 +158,7 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
const GURL& new_referrer_url, const GURL& new_referrer_url,
bool new_is_external_protocol) override; bool new_is_external_protocol) override;
NavigationThrottle::ThrottleCheckResult CallWillFailRequestForTesting( NavigationThrottle::ThrottleCheckResult CallWillFailRequestForTesting(
base::Optional<net::SSLInfo> ssl_info, base::Optional<net::SSLInfo> ssl_info) override;
bool should_ssl_errors_be_fatal) override;
NavigationThrottle::ThrottleCheckResult CallWillProcessResponseForTesting( NavigationThrottle::ThrottleCheckResult CallWillProcessResponseForTesting(
RenderFrameHost* render_frame_host, RenderFrameHost* render_frame_host,
const std::string& raw_response_header) override; const std::string& raw_response_header) override;
......
...@@ -27,18 +27,6 @@ ...@@ -27,18 +27,6 @@
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace {
// TODO(crbug.com/757633): Attach this information to net::SSLInfo instead of
// calculating it here.
bool ShouldSSLErrorsBeFatal(net::URLRequest* request) {
net::TransportSecurityState* state =
request->context()->transport_security_state();
return state->ShouldSSLErrorsBeFatal(request->url().host());
}
} // namespace
namespace content { namespace content {
NavigationResourceHandler::NavigationResourceHandler( NavigationResourceHandler::NavigationResourceHandler(
...@@ -56,7 +44,7 @@ NavigationResourceHandler::NavigationResourceHandler( ...@@ -56,7 +44,7 @@ NavigationResourceHandler::NavigationResourceHandler(
NavigationResourceHandler::~NavigationResourceHandler() { NavigationResourceHandler::~NavigationResourceHandler() {
if (core_) { if (core_) {
core_->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt, false); core_->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt);
DetachFromCore(); DetachFromCore();
} }
} }
...@@ -159,7 +147,7 @@ void NavigationResourceHandler::OnResponseCompleted( ...@@ -159,7 +147,7 @@ void NavigationResourceHandler::OnResponseCompleted(
} }
core_->NotifyRequestFailed(request()->response_info().was_cached, net_error, core_->NotifyRequestFailed(request()->response_info().was_cached, net_error,
ssl_info, ShouldSSLErrorsBeFatal(request())); ssl_info);
DetachFromCore(); DetachFromCore();
} }
next_handler_->OnResponseCompleted(status, std::move(controller)); next_handler_->OnResponseCompleted(status, std::move(controller));
......
...@@ -113,8 +113,7 @@ void NavigationURLLoaderImpl::NotifyResponseStarted( ...@@ -113,8 +113,7 @@ void NavigationURLLoaderImpl::NotifyResponseStarted(
void NavigationURLLoaderImpl::NotifyRequestFailed( void NavigationURLLoaderImpl::NotifyRequestFailed(
bool in_cache, bool in_cache,
int net_error, int net_error,
base::Optional<net::SSLInfo> ssl_info, base::Optional<net::SSLInfo> ssl_info) {
bool should_ssl_errors_be_fatal) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
delegate_->OnRequestFailed(in_cache, net_error, ssl_info); delegate_->OnRequestFailed(in_cache, net_error, ssl_info);
......
...@@ -64,11 +64,10 @@ class NavigationURLLoaderImpl : public NavigationURLLoader { ...@@ -64,11 +64,10 @@ class NavigationURLLoaderImpl : public NavigationURLLoader {
// Notifies the delegate the the request has failed. If |net_error| is a // Notifies the delegate the the request has failed. If |net_error| is a
// certificate error, the caller must pass valid values for |ssl_info| and // certificate error, the caller must pass valid values for |ssl_info| and
// |fatal_cert_error|. If |net_error| is not a certificate error, |ssl_info| // |fatal_cert_error|. If |net_error| is not a certificate error, |ssl_info|
// and |fatal_cert_error| are ignored. // is ignored.
void NotifyRequestFailed(bool in_cache, void NotifyRequestFailed(bool in_cache,
int net_error, int net_error,
base::Optional<net::SSLInfo> ssl_info, base::Optional<net::SSLInfo> ssl_info);
bool should_ssl_errors_be_fatal);
// Notifies the delegate the begin navigation request was handled and a // Notifies the delegate the begin navigation request was handled and a
// potential first network request is about to be made. // potential first network request is about to be made.
......
...@@ -146,8 +146,7 @@ void NavigationURLLoaderImplCore::NotifyResponseStarted( ...@@ -146,8 +146,7 @@ void NavigationURLLoaderImplCore::NotifyResponseStarted(
void NavigationURLLoaderImplCore::NotifyRequestFailed( void NavigationURLLoaderImplCore::NotifyRequestFailed(
bool in_cache, bool in_cache,
int net_error, int net_error,
const base::Optional<net::SSLInfo>& ssl_info, const base::Optional<net::SSLInfo>& ssl_info) {
bool should_ssl_errors_be_fatal) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this); TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this, TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
...@@ -157,8 +156,7 @@ void NavigationURLLoaderImplCore::NotifyRequestFailed( ...@@ -157,8 +156,7 @@ void NavigationURLLoaderImplCore::NotifyRequestFailed(
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::BindOnce(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_, base::BindOnce(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_,
in_cache, net_error, ssl_info, in_cache, net_error, ssl_info));
should_ssl_errors_be_fatal));
} }
} // namespace content } // namespace content
...@@ -84,8 +84,7 @@ class NavigationURLLoaderImplCore ...@@ -84,8 +84,7 @@ class NavigationURLLoaderImplCore
// Notifies |loader_| on the UI thread that the request failed. // Notifies |loader_| on the UI thread that the request failed.
void NotifyRequestFailed(bool in_cache, void NotifyRequestFailed(bool in_cache,
int net_error, int net_error,
const base::Optional<net::SSLInfo>& ssl_info, const base::Optional<net::SSLInfo>& ssl_info);
bool should_ssl_errors_be_fatal);
private: private:
friend class base::RefCountedThreadSafe<NavigationURLLoaderImplCore>; friend class base::RefCountedThreadSafe<NavigationURLLoaderImplCore>;
......
...@@ -2014,7 +2014,7 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest( ...@@ -2014,7 +2014,7 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
info.common_params.url, info.common_params.url,
resource_type, resource_type,
resource_context))) { resource_context))) {
loader->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt, false); loader->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt);
return; return;
} }
...@@ -2060,8 +2060,7 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest( ...@@ -2060,8 +2060,7 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
if (body) { if (body) {
if (!GetBodyBlobDataHandles(body, resource_context, &blob_handles)) { if (!GetBodyBlobDataHandles(body, resource_context, &blob_handles)) {
new_request->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES); new_request->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES);
loader->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt, loader->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt);
false);
return; return;
} }
new_request->set_upload(UploadDataStreamBuilder::Build( new_request->set_upload(UploadDataStreamBuilder::Build(
......
...@@ -295,8 +295,7 @@ class CONTENT_EXPORT NavigationHandle { ...@@ -295,8 +295,7 @@ class CONTENT_EXPORT NavigationHandle {
// Simulates the network request failing. // Simulates the network request failing.
virtual NavigationThrottle::ThrottleCheckResult CallWillFailRequestForTesting( virtual NavigationThrottle::ThrottleCheckResult CallWillFailRequestForTesting(
base::Optional<net::SSLInfo> ssl_info, base::Optional<net::SSLInfo> ssl_info) = 0;
bool should_ssl_errors_be_fatal) = 0;
// Simulates the reception of the network response. // Simulates the reception of the network response.
virtual NavigationThrottle::ThrottleCheckResult virtual NavigationThrottle::ThrottleCheckResult
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment