Commit 0761944b authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Use net::ERR_CACHE_MISS for Resource::CacheMissError

kErrorDomainBlinkInternal is now not needed because we can use the net
error directly.

Bug: None
Change-Id: I2a1cce8c2802a03bc56a39c899d9a4cf066fd96c
Reviewed-on: https://chromium-review.googlesource.com/575732
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487403}
parent 94086bc3
...@@ -58,7 +58,6 @@ WebURLError& WebURLError::operator=(const ResourceError& error) { ...@@ -58,7 +58,6 @@ WebURLError& WebURLError::operator=(const ResourceError& error) {
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();
is_cache_miss = error.IsCacheMiss();
is_web_security_violation = error.IsAccessCheck(); is_web_security_violation = error.IsAccessCheck();
} }
return *this; return *this;
...@@ -72,7 +71,6 @@ WebURLError::operator ResourceError() const { ...@@ -72,7 +71,6 @@ WebURLError::operator ResourceError() const {
resource_error.SetIsCancellation(is_cancellation); 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.SetIsCacheMiss(is_cache_miss);
resource_error.SetIsAccessCheck(is_web_security_violation); resource_error.SetIsAccessCheck(is_web_security_violation);
return resource_error; return resource_error;
} }
......
...@@ -70,9 +70,8 @@ ResourceError ResourceError::CancelledDueToAccessCheckError( ...@@ -70,9 +70,8 @@ ResourceError ResourceError::CancelledDueToAccessCheckError(
} }
ResourceError ResourceError::CacheMissError(const String& failing_url) { ResourceError ResourceError::CacheMissError(const String& failing_url) {
ResourceError error(kErrorDomainBlinkInternal, 0, failing_url, String()); return WebURLError(KURL(kParsedURLString, failing_url), false,
error.SetIsCacheMiss(true); net::ERR_CACHE_MISS);
return error;
} }
ResourceError ResourceError::Copy() const { ResourceError ResourceError::Copy() const {
...@@ -85,9 +84,7 @@ ResourceError ResourceError::Copy() const { ...@@ -85,9 +84,7 @@ ResourceError ResourceError::Copy() const {
error_copy.is_cancellation_ = is_cancellation_; 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.stale_copy_in_cache_ = stale_copy_in_cache_;
error_copy.was_ignored_by_handler_ = was_ignored_by_handler_; error_copy.was_ignored_by_handler_ = was_ignored_by_handler_;
error_copy.is_cache_miss_ = is_cache_miss_;
return error_copy; return error_copy;
} }
...@@ -125,9 +122,6 @@ bool ResourceError::Compare(const ResourceError& a, const ResourceError& b) { ...@@ -125,9 +122,6 @@ bool ResourceError::Compare(const ResourceError& a, const ResourceError& b) {
if (a.WasIgnoredByHandler() != b.WasIgnoredByHandler()) if (a.WasIgnoredByHandler() != b.WasIgnoredByHandler())
return false; return false;
if (a.IsCacheMiss() != b.IsCacheMiss())
return false;
return true; return true;
} }
...@@ -141,8 +135,6 @@ void ResourceError::InitializeWebURLError(WebURLError* error, ...@@ -141,8 +135,6 @@ void ResourceError::InitializeWebURLError(WebURLError* error,
error->unreachable_url = url; error->unreachable_url = url;
if (reason == net::ERR_ABORTED) { if (reason == net::ERR_ABORTED) {
error->is_cancellation = true; error->is_cancellation = true;
} else if (reason == net::ERR_CACHE_MISS) {
error->is_cache_miss = true;
} else if (reason == net::ERR_TEMPORARILY_THROTTLED) { } else if (reason == net::ERR_TEMPORARILY_THROTTLED) {
error->localized_description = error->localized_description =
WebString::FromASCII(kThrottledErrorDescription); WebString::FromASCII(kThrottledErrorDescription);
...@@ -152,4 +144,9 @@ void ResourceError::InitializeWebURLError(WebURLError* error, ...@@ -152,4 +144,9 @@ void ResourceError::InitializeWebURLError(WebURLError* error,
} }
} }
bool ResourceError::IsCacheMiss() const {
return domain_ == String(net::kErrorDomain) &&
error_code_ == net::ERR_CACHE_MISS;
}
} // namespace blink } // namespace blink
...@@ -61,7 +61,6 @@ class PLATFORM_EXPORT ResourceError final { ...@@ -61,7 +61,6 @@ class PLATFORM_EXPORT ResourceError final {
ResourceRequestBlockedReason, ResourceRequestBlockedReason,
const String& localized_description); const String& localized_description);
// Only for Blink internal usage.
static ResourceError CacheMissError(const String& failing_url); static ResourceError CacheMissError(const String& failing_url);
ResourceError() ResourceError()
...@@ -72,7 +71,6 @@ class PLATFORM_EXPORT ResourceError final { ...@@ -72,7 +71,6 @@ class PLATFORM_EXPORT ResourceError final {
is_timeout_(false), is_timeout_(false),
stale_copy_in_cache_(false), stale_copy_in_cache_(false),
was_ignored_by_handler_(false), was_ignored_by_handler_(false),
is_cache_miss_(false),
should_collapse_initiator_(false) {} should_collapse_initiator_(false) {}
ResourceError(const String& domain, ResourceError(const String& domain,
...@@ -89,7 +87,6 @@ class PLATFORM_EXPORT ResourceError final { ...@@ -89,7 +87,6 @@ class PLATFORM_EXPORT ResourceError final {
is_timeout_(false), is_timeout_(false),
stale_copy_in_cache_(false), stale_copy_in_cache_(false),
was_ignored_by_handler_(false), was_ignored_by_handler_(false),
is_cache_miss_(false),
should_collapse_initiator_(false) {} should_collapse_initiator_(false) {}
// Makes a deep copy. Useful for when you need to use a ResourceError on // Makes a deep copy. Useful for when you need to use a ResourceError on
...@@ -125,8 +122,7 @@ class PLATFORM_EXPORT ResourceError final { ...@@ -125,8 +122,7 @@ class PLATFORM_EXPORT ResourceError final {
} }
bool WasIgnoredByHandler() const { return was_ignored_by_handler_; } bool WasIgnoredByHandler() const { return was_ignored_by_handler_; }
void SetIsCacheMiss(bool is_cache_miss) { is_cache_miss_ = is_cache_miss; } bool IsCacheMiss() const;
bool IsCacheMiss() const { return is_cache_miss_; }
bool WasBlockedByResponse() const { bool WasBlockedByResponse() const {
return error_code_ == net::ERR_BLOCKED_BY_RESPONSE; return error_code_ == net::ERR_BLOCKED_BY_RESPONSE;
} }
...@@ -154,7 +150,6 @@ class PLATFORM_EXPORT ResourceError final { ...@@ -154,7 +150,6 @@ class PLATFORM_EXPORT ResourceError final {
bool is_timeout_; bool is_timeout_;
bool stale_copy_in_cache_; bool stale_copy_in_cache_;
bool was_ignored_by_handler_; bool was_ignored_by_handler_;
bool is_cache_miss_;
bool should_collapse_initiator_; bool should_collapse_initiator_;
}; };
......
...@@ -62,10 +62,6 @@ struct WebURLError { ...@@ -62,10 +62,6 @@ struct WebURLError {
// ignored (e.g. through shouldOverrideUrlLoading). // ignored (e.g. through shouldOverrideUrlLoading).
bool was_ignored_by_handler = false; bool was_ignored_by_handler = false;
// A flag showing whether this error is a disk cache miss by requesting to
// load only from disk cache.
bool is_cache_miss = false;
// True if this error is created for a web security violation. // True if this error is created for a web security violation.
bool is_web_security_violation = false; bool is_web_security_violation = 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