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

Unified Diff: content/child/web_url_loader_impl.cc

Issue 958083002: PlzNavigate: Show error pages when the navigation failed before commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@support-data-urls
Patch Set: Fixed compilation error Created 5 years, 9 months 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: content/child/web_url_loader_impl.cc
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index e2cec70d33531e72ea4eb4d3a7a83f4120a9b233..6819784ea9db74ac41f0977cf4d888e9fa081c43 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -71,9 +71,6 @@ namespace content {
namespace {
-const char kThrottledErrorDescription[] =
- "Request throttled. Visit http://dev.chromium.org/throttling for more "
- "information.";
const size_t kBodyStreamPipeCapacity = 4 * 1024;
typedef ResourceDevToolsInfo::HeadersVector HeadersVector;
@@ -690,10 +687,8 @@ void WebURLLoaderImpl::Context::OnReceivedData(const char* data,
// TODO(yhirano): Support ftp listening and multipart.
MojoResult rv = WriteDataOnBodyStream(data, data_length);
if (rv != MOJO_RESULT_OK && client_) {
- client_->didFail(loader_,
- loader_->CreateError(request_.url(),
- false,
- net::ERR_FAILED));
+ client_->didFail(
+ loader_, CreateWebURLError(request_.url(), false, net::ERR_FAILED));
}
} else if (ftp_listing_delegate_) {
// The FTP listing delegate will make the appropriate calls to
@@ -743,9 +738,9 @@ void WebURLLoaderImpl::Context::OnCompletedRequest(
if (client_) {
if (error_code != net::OK) {
- client_->didFail(loader_, CreateError(request_.url(),
- stale_copy_in_cache,
- error_code));
+ client_->didFail(
+ loader_,
+ CreateWebURLError(request_.url(), stale_copy_in_cache, error_code));
} else {
if (request_.useStreamOnResponse()) {
got_all_stream_body_data_ = true;
@@ -901,10 +896,8 @@ MojoResult WebURLLoaderImpl::Context::WriteDataOnBodyStream(const char* data,
void WebURLLoaderImpl::Context::OnHandleGotWritable(MojoResult result) {
if (result != MOJO_RESULT_OK) {
if (client_) {
- client_->didFail(loader_,
- loader_->CreateError(request_.url(),
- false,
- net::ERR_FAILED));
+ client_->didFail(
+ loader_, CreateWebURLError(request_.url(), false, net::ERR_FAILED));
// |this| can be deleted here.
}
return;
@@ -926,9 +919,8 @@ void WebURLLoaderImpl::Context::OnHandleGotWritable(MojoResult result) {
}
} else {
if (client_) {
- client_->didFail(loader_, loader_->CreateError(request_.url(),
- false,
- net::ERR_FAILED));
+ client_->didFail(
+ loader_, CreateWebURLError(request_.url(), false, net::ERR_FAILED));
// |this| can be deleted here.
}
}
@@ -946,26 +938,6 @@ WebURLLoaderImpl::~WebURLLoaderImpl() {
cancel();
}
-WebURLError WebURLLoaderImpl::CreateError(const WebURL& unreachable_url,
- bool stale_copy_in_cache,
- int reason) {
- WebURLError error;
- error.domain = WebString::fromUTF8(net::kErrorDomain);
- error.reason = reason;
- error.unreachableURL = unreachable_url;
- error.staleCopyInCache = stale_copy_in_cache;
- if (reason == net::ERR_ABORTED) {
- error.isCancellation = true;
- } else if (reason == net::ERR_TEMPORARILY_THROTTLED) {
- error.localizedDescription = WebString::fromUTF8(
- kThrottledErrorDescription);
- } else {
- error.localizedDescription = WebString::fromUTF8(
- net::ErrorToString(reason));
- }
- return error;
-}
-
void WebURLLoaderImpl::PopulateURLResponse(const GURL& url,
const ResourceResponseInfo& info,
WebURLResponse* response) {

Powered by Google App Engine
This is Rietveld 408576698