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) {
<< "Asynchronous MockHandleSSLError: " << async_);
content::NavigationThrottle::ThrottleCheckResult result =
handle_->CallWillFailRequestForTesting(
base::nullopt, false /* should_ssl_errors_be_fatal */);
handle_->CallWillFailRequestForTesting(base::nullopt);
EXPECT_FALSE(handle_->GetSSLInfo().is_valid());
EXPECT_EQ(content::NavigationThrottle::PROCEED, result);
......@@ -151,8 +150,7 @@ TEST_P(SSLErrorNavigationThrottleTest, SSLInfoWithoutCertError) {
net::SSLInfo ssl_info;
ssl_info.cert_status = net::CERT_STATUS_IS_EV;
content::NavigationThrottle::ThrottleCheckResult result =
handle_->CallWillFailRequestForTesting(
ssl_info, false /* should_ssl_errors_be_fatal */);
handle_->CallWillFailRequestForTesting(ssl_info);
EXPECT_EQ(net::CERT_STATUS_IS_EV, handle_->GetSSLInfo().cert_status);
EXPECT_EQ(content::NavigationThrottle::PROCEED, result);
......@@ -171,8 +169,7 @@ TEST_P(SSLErrorNavigationThrottleTest, SSLInfoWithCertError) {
net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem");
ssl_info.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID;
content::NavigationThrottle::ThrottleCheckResult synchronous_result =
handle_->CallWillFailRequestForTesting(
ssl_info, false /* should_ssl_errors_be_fatal */);
handle_->CallWillFailRequestForTesting(ssl_info);
EXPECT_EQ(content::NavigationThrottle::DEFER, synchronous_result.action());
base::RunLoop().RunUntilIdle();
......
......@@ -449,8 +449,7 @@ NavigationHandleImpl::CallWillRedirectRequestForTesting(
NavigationThrottle::ThrottleCheckResult
NavigationHandleImpl::CallWillFailRequestForTesting(
base::Optional<net::SSLInfo> ssl_info,
bool should_ssl_errors_be_fatal) {
base::Optional<net::SSLInfo> ssl_info) {
NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER;
WillFailRequest(ssl_info, base::Bind(&UpdateThrottleCheckResult, &result));
......
......@@ -158,8 +158,7 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
const GURL& new_referrer_url,
bool new_is_external_protocol) override;
NavigationThrottle::ThrottleCheckResult CallWillFailRequestForTesting(
base::Optional<net::SSLInfo> ssl_info,
bool should_ssl_errors_be_fatal) override;
base::Optional<net::SSLInfo> ssl_info) override;
NavigationThrottle::ThrottleCheckResult CallWillProcessResponseForTesting(
RenderFrameHost* render_frame_host,
const std::string& raw_response_header) override;
......
......@@ -27,18 +27,6 @@
#include "net/url_request/url_request_context.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 {
NavigationResourceHandler::NavigationResourceHandler(
......@@ -56,7 +44,7 @@ NavigationResourceHandler::NavigationResourceHandler(
NavigationResourceHandler::~NavigationResourceHandler() {
if (core_) {
core_->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt, false);
core_->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt);
DetachFromCore();
}
}
......@@ -159,7 +147,7 @@ void NavigationResourceHandler::OnResponseCompleted(
}
core_->NotifyRequestFailed(request()->response_info().was_cached, net_error,
ssl_info, ShouldSSLErrorsBeFatal(request()));
ssl_info);
DetachFromCore();
}
next_handler_->OnResponseCompleted(status, std::move(controller));
......
......@@ -113,8 +113,7 @@ void NavigationURLLoaderImpl::NotifyResponseStarted(
void NavigationURLLoaderImpl::NotifyRequestFailed(
bool in_cache,
int net_error,
base::Optional<net::SSLInfo> ssl_info,
bool should_ssl_errors_be_fatal) {
base::Optional<net::SSLInfo> ssl_info) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
delegate_->OnRequestFailed(in_cache, net_error, ssl_info);
......
......@@ -64,11 +64,10 @@ class NavigationURLLoaderImpl : public NavigationURLLoader {
// 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
// |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,
int net_error,
base::Optional<net::SSLInfo> ssl_info,
bool should_ssl_errors_be_fatal);
base::Optional<net::SSLInfo> ssl_info);
// Notifies the delegate the begin navigation request was handled and a
// potential first network request is about to be made.
......
......@@ -146,8 +146,7 @@ void NavigationURLLoaderImplCore::NotifyResponseStarted(
void NavigationURLLoaderImplCore::NotifyRequestFailed(
bool in_cache,
int net_error,
const base::Optional<net::SSLInfo>& ssl_info,
bool should_ssl_errors_be_fatal) {
const base::Optional<net::SSLInfo>& ssl_info) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
......@@ -157,8 +156,7 @@ void NavigationURLLoaderImplCore::NotifyRequestFailed(
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::BindOnce(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_,
in_cache, net_error, ssl_info,
should_ssl_errors_be_fatal));
in_cache, net_error, ssl_info));
}
} // namespace content
......@@ -84,8 +84,7 @@ class NavigationURLLoaderImplCore
// Notifies |loader_| on the UI thread that the request failed.
void NotifyRequestFailed(bool in_cache,
int net_error,
const base::Optional<net::SSLInfo>& ssl_info,
bool should_ssl_errors_be_fatal);
const base::Optional<net::SSLInfo>& ssl_info);
private:
friend class base::RefCountedThreadSafe<NavigationURLLoaderImplCore>;
......
......@@ -2014,7 +2014,7 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
info.common_params.url,
resource_type,
resource_context))) {
loader->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt, false);
loader->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt);
return;
}
......@@ -2060,8 +2060,7 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
if (body) {
if (!GetBodyBlobDataHandles(body, resource_context, &blob_handles)) {
new_request->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES);
loader->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt,
false);
loader->NotifyRequestFailed(false, net::ERR_ABORTED, base::nullopt);
return;
}
new_request->set_upload(UploadDataStreamBuilder::Build(
......
......@@ -295,8 +295,7 @@ class CONTENT_EXPORT NavigationHandle {
// Simulates the network request failing.
virtual NavigationThrottle::ThrottleCheckResult CallWillFailRequestForTesting(
base::Optional<net::SSLInfo> ssl_info,
bool should_ssl_errors_be_fatal) = 0;
base::Optional<net::SSLInfo> ssl_info) = 0;
// Simulates the reception of the network response.
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