Commit d8309f2e authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Remove WebURLError::Domain::kBlinkInternal

Bug: 748491
Change-Id: I5e86bf7a56def07546b17362f1e0c71395512b58
Reviewed-on: https://chromium-review.googlesource.com/577470
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarTakeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarBill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490714}
parent 173bf304
...@@ -81,11 +81,11 @@ void FileDownloader::DidFail(const blink::WebURLError& error) { ...@@ -81,11 +81,11 @@ void FileDownloader::DidFail(const blink::WebURLError& error) {
status_ = ACCESS_DENIED; status_ = ACCESS_DENIED;
break; break;
} }
} else {
// It's a WebKit error.
status_ = ACCESS_DENIED;
} }
if (error.is_web_security_violation)
status_ = ACCESS_DENIED;
// Delete url_loader to prevent didFinishLoading from being called, which // Delete url_loader to prevent didFinishLoading from being called, which
// some implementations of blink::WebURLLoader will do after calling didFail. // some implementations of blink::WebURLLoader will do after calling didFail.
url_loader_.reset(); url_loader_.reset();
......
...@@ -186,10 +186,10 @@ void PepperURLLoaderHost::DidFail(const WebURLError& error) { ...@@ -186,10 +186,10 @@ void PepperURLLoaderHost::DidFail(const WebURLError& error) {
pp_error = PP_ERROR_NOACCESS; pp_error = PP_ERROR_NOACCESS;
break; break;
} }
} else {
// It's a WebKit error.
pp_error = PP_ERROR_NOACCESS;
} }
if (error.is_web_security_violation)
pp_error = PP_ERROR_NOACCESS;
SendUpdateToPlugin( SendUpdateToPlugin(
base::MakeUnique<PpapiPluginMsg_URLLoader_FinishedLoading>(pp_error)); base::MakeUnique<PpapiPluginMsg_URLLoader_FinishedLoading>(pp_error));
} }
......
Blocked access to external URL http://example.com/worker.js Blocked access to external URL http://example.com/worker.js
CONSOLE ERROR: line 18: Failed to start loading http://example.com/worker.js
Test worker fetch of blocked url. Should print a "PASS" statement. Test worker fetch of blocked url. Should print a "PASS" statement.
PASS PASS
......
...@@ -420,8 +420,8 @@ void WebAssociatedURLLoaderImpl::LoadAsynchronously( ...@@ -420,8 +420,8 @@ void WebAssociatedURLLoaderImpl::LoadAsynchronously(
} }
if (!loader_) { if (!loader_) {
// FIXME: return meaningful error codes. client_adapter_->DidFail(ResourceError::CancelledDueToAccessCheckError(
client_adapter_->DidFail(ResourceError()); request.Url(), ResourceRequestBlockedReason::kOther));
} }
client_adapter_->EnableErrorNotifications(); client_adapter_->EnableErrorNotifications();
} }
...@@ -467,7 +467,7 @@ void WebAssociatedURLLoaderImpl::DocumentDestroyed() { ...@@ -467,7 +467,7 @@ void WebAssociatedURLLoaderImpl::DocumentDestroyed() {
if (!client_) if (!client_)
return; return;
ReleaseClient()->DidFail(ResourceError()); ReleaseClient()->DidFail(ResourceError::CancelledError(KURL()));
// |this| may be dead here. // |this| may be dead here.
} }
......
...@@ -142,7 +142,7 @@ TEST_F(CSSPreloadScannerTest, DontReadFromClearedData) { ...@@ -142,7 +142,7 @@ TEST_F(CSSPreloadScannerTest, DontReadFromClearedData) {
const char* data = "@import url('http://127.0.0.1/preload.css');"; const char* data = "@import url('http://127.0.0.1/preload.css');";
resource->AppendData(data, strlen(data)); resource->AppendData(data, strlen(data));
ResourceError error(ResourceError::Domain::kBlinkInternal, 0, url, ""); ResourceError error(ResourceError::Domain::kTest, 0, url, "");
resource->FinishAsError(error); resource->FinishAsError(error);
// Should not crash. // Should not crash.
......
...@@ -237,9 +237,14 @@ void DocumentThreadableLoader::Start(const ResourceRequest& request) { ...@@ -237,9 +237,14 @@ void DocumentThreadableLoader::Start(const ResourceRequest& request) {
client_); client_);
ThreadableLoaderClient* client = client_; ThreadableLoaderClient* client = client_;
Clear(); Clear();
client->DidFail(ResourceError(ResourceError::Domain::kBlinkInternal, 0, ResourceError error = ResourceError::CancelledDueToAccessCheckError(
request.Url(), request.Url(), ResourceRequestBlockedReason::kOther,
"Cross origin requests are not supported.")); "Cross origin requests are not supported.");
const String message = "Failed to load " + error.FailingURL() + ": " +
error.LocalizedDescription();
loading_context_->GetExecutionContext()->AddConsoleMessage(
ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message));
client->DidFail(error);
return; return;
} }
...@@ -1106,8 +1111,11 @@ void DocumentThreadableLoader::LoadRequestAsync( ...@@ -1106,8 +1111,11 @@ void DocumentThreadableLoader::LoadRequestAsync(
// notified and |client| is null. // notified and |client| is null.
if (!client) if (!client)
return; return;
client->DidFail(ResourceError(ResourceError::Domain::kBlinkInternal, 0, String message =
request.Url(), "Failed to start loading.")); String("Failed to start loading ") + request.Url().GetString();
loading_context_->GetExecutionContext()->AddConsoleMessage(
ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message));
client->DidFail(ResourceError::CancelledError(request.Url()));
return; return;
} }
......
...@@ -648,10 +648,9 @@ TEST_P(ThreadableLoaderTest, DidFailInStart) { ...@@ -648,10 +648,9 @@ TEST_P(ThreadableLoaderTest, DidFailInStart) {
CreateLoader(); CreateLoader();
CallCheckpoint(1); CallCheckpoint(1);
EXPECT_CALL(*Client(), EXPECT_CALL(*Client(), DidFail(ResourceError::CancelledDueToAccessCheckError(
DidFail(ResourceError( ErrorURL(), ResourceRequestBlockedReason::kOther,
ResourceError::Domain::kBlinkInternal, 0, ErrorURL(), "Cross origin requests are not supported.")));
"Cross origin requests are not supported.")));
EXPECT_CALL(GetCheckpoint(), Call(2)); EXPECT_CALL(GetCheckpoint(), Call(2));
StartLoader(ErrorURL(), WebURLRequest::kFetchRequestModeSameOrigin); StartLoader(ErrorURL(), WebURLRequest::kFetchRequestModeSameOrigin);
......
...@@ -1569,12 +1569,6 @@ void XMLHttpRequest::DidFail(const ResourceError& error) { ...@@ -1569,12 +1569,6 @@ void XMLHttpRequest::DidFail(const ResourceError& error) {
return; return;
} }
// Network failures are already reported to Web Inspector by ResourceLoader.
if (error.GetDomain() == ResourceError::Domain::kBlinkInternal)
LogConsoleError(GetExecutionContext(), "XMLHttpRequest cannot load " +
error.FailingURL() + ". " +
error.LocalizedDescription());
HandleNetworkError(); HandleNetworkError();
} }
......
...@@ -518,12 +518,7 @@ void FetchManager::Loader::DidFinishLoading(unsigned long, double) { ...@@ -518,12 +518,7 @@ void FetchManager::Loader::DidFinishLoading(unsigned long, double) {
} }
void FetchManager::Loader::DidFail(const ResourceError& error) { void FetchManager::Loader::DidFail(const ResourceError& error) {
if (error.IsCancellation() || error.IsTimeout() || Failed(String());
error.GetDomain() != ResourceError::Domain::kBlinkInternal)
Failed(String());
else
Failed("Fetch API cannot load " + error.FailingURL() + ". " +
error.LocalizedDescription());
} }
void FetchManager::Loader::DidFailRedirectCheck() { void FetchManager::Loader::DidFailRedirectCheck() {
......
...@@ -81,9 +81,6 @@ std::ostream& operator<<(std::ostream& out, const WebURLError::Domain domain) { ...@@ -81,9 +81,6 @@ std::ostream& operator<<(std::ostream& out, const WebURLError::Domain domain) {
case WebURLError::Domain::kNet: case WebURLError::Domain::kNet:
out << "net"; out << "net";
break; break;
case WebURLError::Domain::kBlinkInternal:
out << "blink";
break;
case WebURLError::Domain::kHttp: case WebURLError::Domain::kHttp:
out << "http"; out << "http";
break; break;
......
...@@ -51,8 +51,6 @@ struct WebURLError { ...@@ -51,8 +51,6 @@ struct WebURLError {
// net/base/net_error_list.h. // net/base/net_error_list.h.
kNet, kNet,
kBlinkInternal,
// |reason| is an HTTP status code. // |reason| is an HTTP status code.
kHttp, kHttp,
......
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