Commit 0bb02b44 authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Remove WebURLError::is_cancellation

Now it is equivalent to domain == "net" && reason == ERROR_ABORTED.

Bug: None
Change-Id: Ia39d123a8a15d79a3efbcc86fd1c70f225c51439
Reviewed-on: https://chromium-review.googlesource.com/575112Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarTakeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488132}
parent c7b43379
...@@ -1258,10 +1258,12 @@ void WebURLLoaderImpl::LoadSynchronously(const WebURLRequest& request, ...@@ -1258,10 +1258,12 @@ void WebURLLoaderImpl::LoadSynchronously(const WebURLRequest& request,
// status code or status text. // status code or status text.
int error_code = sync_load_response.error_code; int error_code = sync_load_response.error_code;
if (error_code != net::OK) { if (error_code != net::OK) {
response.SetURL(final_url); error = WebURLError(final_url, false, error_code);
error.domain = WebString::FromASCII(net::kErrorDomain); if (error_code == net::ERR_ABORTED) {
error.reason = error_code; // SyncResourceHandler returns ERR_ABORTED for CORS redirect errors,
error.unreachable_url = final_url; // so we treat the error as a web security violation.
error.is_web_security_violation = true;
}
return; return;
} }
......
...@@ -474,7 +474,6 @@ void ResourceMultiBufferDataProvider::DidFinishLoading(double finishTime) { ...@@ -474,7 +474,6 @@ void ResourceMultiBufferDataProvider::DidFinishLoading(double finishTime) {
void ResourceMultiBufferDataProvider::DidFail(const WebURLError& error) { void ResourceMultiBufferDataProvider::DidFail(const WebURLError& error) {
DVLOG(1) << "didFail: reason=" << error.reason DVLOG(1) << "didFail: reason=" << error.reason
<< ", isCancellation=" << error.is_cancellation
<< ", domain=" << error.domain.Utf8().data() << ", domain=" << error.domain.Utf8().data()
<< ", localizedDescription=" << ", localizedDescription="
<< error.localized_description.Utf8().data(); << error.localized_description.Utf8().data();
......
...@@ -9,14 +9,14 @@ allowRequest ID 1 ...@@ -9,14 +9,14 @@ allowRequest ID 1
Network.responseReceived resource-iframe.html 200 text/html Network.responseReceived resource-iframe.html 200 text/html
Network.requestIntercepted ID 2 GET i-dont-exist.css type: Stylesheet Network.requestIntercepted ID 2 GET i-dont-exist.css type: Stylesheet
Network.responseReceived i-dont-exist.css 404 text/html Network.responseReceived i-dont-exist.css 404 text/html
Network.loadingFailed i-dont-exist.css Network.loadingFailed i-dont-exist.css net::ERR_ABORTED
Network.requestIntercepted ID 3 GET script.js type: Script Network.requestIntercepted ID 3 GET script.js type: Script
Network.responseReceived script.js 404 text/html Network.responseReceived script.js 404 text/html
Network.loadingFailed script.js Network.loadingFailed script.js net::ERR_ABORTED
Network.requestIntercepted ID 4 GET script2.js type: Script Network.requestIntercepted ID 4 GET script2.js type: Script
----- disableRequestInterception ----- ----- disableRequestInterception -----
Network.responseReceived script2.js 404 text/html Network.responseReceived script2.js 404 text/html
Network.loadingFailed script2.js Network.loadingFailed script2.js net::ERR_ABORTED
Page.frameStoppedLoading Page.frameStoppedLoading
Network.responseReceived post-echo.pl 200 text/plain Network.responseReceived post-echo.pl 200 text/plain
Post - ECHO SUCCESS! Post - ECHO SUCCESS!
......
...@@ -12,6 +12,6 @@ allowRequest ID 2 ...@@ -12,6 +12,6 @@ allowRequest ID 2
Auth required for ID 2 Auth required for ID 2
----- Cancel Auth ----- ----- Cancel Auth -----
Network.responseReceived unauthorised.pl 401 text/plain Network.responseReceived unauthorised.pl 401 text/plain
Network.loadingFailed unauthorised.pl Network.loadingFailed unauthorised.pl net::ERR_ABORTED
Page.frameStoppedLoading Page.frameStoppedLoading
...@@ -10,6 +10,6 @@ Network.responseReceived redirect-iframe.html 200 text/html ...@@ -10,6 +10,6 @@ Network.responseReceived redirect-iframe.html 200 text/html
Network.requestIntercepted ID 2 GET redirect1.pl type: Script Network.requestIntercepted ID 2 GET redirect1.pl type: Script
mockResponse ID 2 mockResponse ID 2
Network.responseReceived redirect1.pl 404 text/plain Network.responseReceived redirect1.pl 404 text/plain
Network.loadingFailed redirect1.pl Network.loadingFailed redirect1.pl net::ERR_ABORTED
Page.frameStoppedLoading Page.frameStoppedLoading
...@@ -517,13 +517,7 @@ void DocumentThreadableLoader::Cancel() { ...@@ -517,13 +517,7 @@ void DocumentThreadableLoader::Cancel() {
return; return;
} }
// FIXME: This error is sent to the client in didFail(), so it should not be DispatchDidFail(ResourceError::CancelledError(GetResource()->Url()));
// an internal one. Use LocalFrameClient::cancelledError() instead.
ResourceError error(kErrorDomainBlinkInternal, 0, GetResource()->Url(),
"Load cancelled");
error.SetIsCancellation(true);
DispatchDidFail(error);
} }
void DocumentThreadableLoader::SetDefersLoading(bool value) { void DocumentThreadableLoader::SetDefersLoading(bool value) {
......
...@@ -302,9 +302,7 @@ void WorkerThreadableLoader::Cancel() { ...@@ -302,9 +302,7 @@ void WorkerThreadableLoader::Cancel() {
// by sending a cancellation error. // by sending a cancellation error.
// Note: no more client callbacks will be done after this method -- the // Note: no more client callbacks will be done after this method -- the
// clearClient() call ensures that. // clearClient() call ensures that.
ResourceError error(String(), 0, String(), String()); DidFail(ResourceError::CancelledError(KURL()));
error.SetIsCancellation(true);
DidFail(error);
DCHECK(!client_); DCHECK(!client_);
} }
......
...@@ -54,7 +54,6 @@ WebURLError& WebURLError::operator=(const ResourceError& error) { ...@@ -54,7 +54,6 @@ WebURLError& WebURLError::operator=(const ResourceError& error) {
domain = error.Domain(); domain = error.Domain();
reason = error.ErrorCode(); reason = error.ErrorCode();
unreachable_url = KURL(kParsedURLString, error.FailingURL()); unreachable_url = KURL(kParsedURLString, error.FailingURL());
is_cancellation = error.IsCancellation();
stale_copy_in_cache = error.StaleCopyInCache(); stale_copy_in_cache = error.StaleCopyInCache();
localized_description = error.LocalizedDescription(); localized_description = error.LocalizedDescription();
was_ignored_by_handler = error.WasIgnoredByHandler(); was_ignored_by_handler = error.WasIgnoredByHandler();
...@@ -68,7 +67,6 @@ WebURLError::operator ResourceError() const { ...@@ -68,7 +67,6 @@ WebURLError::operator ResourceError() const {
return ResourceError(); return ResourceError();
ResourceError resource_error = ResourceError( ResourceError resource_error = ResourceError(
domain, reason, unreachable_url.GetString(), localized_description); domain, reason, unreachable_url.GetString(), localized_description);
resource_error.SetIsCancellation(is_cancellation);
resource_error.SetStaleCopyInCache(stale_copy_in_cache); resource_error.SetStaleCopyInCache(stale_copy_in_cache);
resource_error.SetWasIgnoredByHandler(was_ignored_by_handler); resource_error.SetWasIgnoredByHandler(was_ignored_by_handler);
resource_error.SetIsAccessCheck(is_web_security_violation); resource_error.SetIsAccessCheck(is_web_security_violation);
......
...@@ -81,7 +81,6 @@ ResourceError ResourceError::Copy() const { ...@@ -81,7 +81,6 @@ ResourceError ResourceError::Copy() const {
error_copy.failing_url_ = failing_url_.IsolatedCopy(); error_copy.failing_url_ = failing_url_.IsolatedCopy();
error_copy.localized_description_ = localized_description_.IsolatedCopy(); error_copy.localized_description_ = localized_description_.IsolatedCopy();
error_copy.is_null_ = is_null_; error_copy.is_null_ = is_null_;
error_copy.is_cancellation_ = is_cancellation_;
error_copy.is_access_check_ = is_access_check_; error_copy.is_access_check_ = is_access_check_;
error_copy.is_timeout_ = is_timeout_; error_copy.is_timeout_ = is_timeout_;
error_copy.was_ignored_by_handler_ = was_ignored_by_handler_; error_copy.was_ignored_by_handler_ = was_ignored_by_handler_;
...@@ -107,9 +106,6 @@ bool ResourceError::Compare(const ResourceError& a, const ResourceError& b) { ...@@ -107,9 +106,6 @@ bool ResourceError::Compare(const ResourceError& a, const ResourceError& b) {
if (a.LocalizedDescription() != b.LocalizedDescription()) if (a.LocalizedDescription() != b.LocalizedDescription())
return false; return false;
if (a.IsCancellation() != b.IsCancellation())
return false;
if (a.IsAccessCheck() != b.IsAccessCheck()) if (a.IsAccessCheck() != b.IsAccessCheck())
return false; return false;
...@@ -133,9 +129,7 @@ void ResourceError::InitializeWebURLError(WebURLError* error, ...@@ -133,9 +129,7 @@ void ResourceError::InitializeWebURLError(WebURLError* error,
error->reason = reason; error->reason = reason;
error->stale_copy_in_cache = stale_copy_in_cache; error->stale_copy_in_cache = stale_copy_in_cache;
error->unreachable_url = url; error->unreachable_url = url;
if (reason == net::ERR_ABORTED) { if (reason == net::ERR_TEMPORARILY_THROTTLED) {
error->is_cancellation = true;
} else if (reason == net::ERR_TEMPORARILY_THROTTLED) {
error->localized_description = error->localized_description =
WebString::FromASCII(kThrottledErrorDescription); WebString::FromASCII(kThrottledErrorDescription);
} else { } else {
...@@ -144,6 +138,11 @@ void ResourceError::InitializeWebURLError(WebURLError* error, ...@@ -144,6 +138,11 @@ void ResourceError::InitializeWebURLError(WebURLError* error,
} }
} }
bool ResourceError::IsCancellation() const {
return domain_ == String(net::kErrorDomain) &&
error_code_ == net::ERR_ABORTED;
}
bool ResourceError::IsCacheMiss() const { bool ResourceError::IsCacheMiss() const {
return domain_ == String(net::kErrorDomain) && return domain_ == String(net::kErrorDomain) &&
error_code_ == net::ERR_CACHE_MISS; error_code_ == net::ERR_CACHE_MISS;
......
...@@ -66,7 +66,6 @@ class PLATFORM_EXPORT ResourceError final { ...@@ -66,7 +66,6 @@ class PLATFORM_EXPORT ResourceError final {
ResourceError() ResourceError()
: error_code_(0), : error_code_(0),
is_null_(true), is_null_(true),
is_cancellation_(false),
is_access_check_(false), is_access_check_(false),
is_timeout_(false), is_timeout_(false),
stale_copy_in_cache_(false), stale_copy_in_cache_(false),
...@@ -82,7 +81,6 @@ class PLATFORM_EXPORT ResourceError final { ...@@ -82,7 +81,6 @@ class PLATFORM_EXPORT ResourceError final {
failing_url_(failing_url), failing_url_(failing_url),
localized_description_(localized_description), localized_description_(localized_description),
is_null_(false), is_null_(false),
is_cancellation_(false),
is_access_check_(false), is_access_check_(false),
is_timeout_(false), is_timeout_(false),
stale_copy_in_cache_(false), stale_copy_in_cache_(false),
...@@ -100,10 +98,7 @@ class PLATFORM_EXPORT ResourceError final { ...@@ -100,10 +98,7 @@ class PLATFORM_EXPORT ResourceError final {
const String& FailingURL() const { return failing_url_; } const String& FailingURL() const { return failing_url_; }
const String& LocalizedDescription() const { return localized_description_; } const String& LocalizedDescription() const { return localized_description_; }
void SetIsCancellation(bool is_cancellation) { bool IsCancellation() const;
is_cancellation_ = is_cancellation;
}
bool IsCancellation() const { return is_cancellation_; }
void SetIsAccessCheck(bool is_access_check) { void SetIsAccessCheck(bool is_access_check) {
is_access_check_ = is_access_check; is_access_check_ = is_access_check;
...@@ -145,7 +140,6 @@ class PLATFORM_EXPORT ResourceError final { ...@@ -145,7 +140,6 @@ class PLATFORM_EXPORT ResourceError final {
String failing_url_; String failing_url_;
String localized_description_; String localized_description_;
bool is_null_; bool is_null_;
bool is_cancellation_;
bool is_access_check_; bool is_access_check_;
bool is_timeout_; bool is_timeout_;
bool stale_copy_in_cache_; bool stale_copy_in_cache_;
......
...@@ -54,10 +54,6 @@ struct WebURLError { ...@@ -54,10 +54,6 @@ struct WebURLError {
// cache that was too stale to return for this request. // cache that was too stale to return for this request.
bool stale_copy_in_cache = false; bool stale_copy_in_cache = false;
// A flag showing whether this error should be treated as a cancellation,
// e.g. we do not show console errors for cancellations.
bool is_cancellation = false;
// A flag showing whether this error is the result of a request being // A flag showing whether this error is the result of a request being
// ignored (e.g. through shouldOverrideUrlLoading). // ignored (e.g. through shouldOverrideUrlLoading).
bool was_ignored_by_handler = false; bool was_ignored_by_handler = false;
......
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