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

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: Updated test Created 5 years, 8 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
« no previous file with comments | « content/child/web_url_loader_impl.h ('k') | content/child/web_url_request_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 585d7f979e2b814146ad9626547c4726e9e2a5dd..c3431b5649d5b4c78ccd81b817636e861b7b3d6d 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;
@@ -692,10 +689,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
@@ -745,9 +740,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;
@@ -903,10 +898,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;
@@ -928,9 +921,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.
}
}
@@ -948,26 +940,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) {
« no previous file with comments | « content/child/web_url_loader_impl.h ('k') | content/child/web_url_request_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698