Commit ca15bd41 authored by Guido Urdaneta's avatar Guido Urdaneta Committed by Commit Bot

Revert "Plumb extra errors from ResourceRequestCompletionStatus to Blink"

This reverts commit 0326c088.

Reason for revert: Suspect of causing virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-fallback.https.html to fail on several Mac and Linux bots.

See for example
https://uberchromegw.corp.google.com/i/chromium.webkit/builders/WebKit%20Mac10.12/builds/7923

Original change's description:
> Plumb extra errors from ResourceRequestCompletionStatus to Blink
> 
> This patch plumbs CORSError and HTTP response headers
> from ResourceRequestCompletinoStatus to Blink's ResourceError.
> 
> Test: ./Tools/Scripts/run-webkit-tests virtual/outofblink-cors
> Bug: 736308
> Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
> Change-Id: I20e4ec9a2e7ca93ce692a5a8312dadf59eb0f345
> Reviewed-on: https://chromium-review.googlesource.com/749024
> Commit-Queue: Takashi Toyoshima <toyoshim@chromium.org>
> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
> Reviewed-by: Mike West <mkwst@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#517388}

TBR=kinuko@chromium.org,toyoshim@chromium.org,tyoshino@chromium.org,yhirano@chromium.org,mkwst@chromium.org

Change-Id: Ib973ef76eaab93e4c4dbf9b08712bbd560eac368
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 736308
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Reviewed-on: https://chromium-review.googlesource.com/776913Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517426}
parent 6c949ae1
......@@ -29,7 +29,6 @@
#include "net/ssl/ssl_info.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/redirect_info.h"
#include "services/network/public/cpp/cors_error_status.h"
#include "services/network/public/cpp/url_loader_status.h"
#include "services/network/public/interfaces/fetch_api.mojom.h"
#include "third_party/WebKit/public/platform/WebMixedContentContextType.h"
......@@ -295,11 +294,6 @@ IPC_STRUCT_TRAITS_END()
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::CORSError,
network::mojom::CORSError::kLast)
IPC_STRUCT_TRAITS_BEGIN(network::CORSErrorStatus)
IPC_STRUCT_TRAITS_MEMBER(cors_error)
IPC_STRUCT_TRAITS_MEMBER(related_response_headers)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(network::URLLoaderStatus)
IPC_STRUCT_TRAITS_MEMBER(error_code)
IPC_STRUCT_TRAITS_MEMBER(exists_in_cache)
......@@ -307,7 +301,7 @@ IPC_STRUCT_TRAITS_BEGIN(network::URLLoaderStatus)
IPC_STRUCT_TRAITS_MEMBER(encoded_data_length)
IPC_STRUCT_TRAITS_MEMBER(encoded_body_length)
IPC_STRUCT_TRAITS_MEMBER(decoded_body_length)
IPC_STRUCT_TRAITS_MEMBER(cors_error_status)
IPC_STRUCT_TRAITS_MEMBER(cors_error)
IPC_STRUCT_TRAITS_END()
// Resource messages sent from the browser to the renderer.
......
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
mojom = "//content/public/common/url_loader.mojom"
public_headers = [ "//services/network/public/cpp/cors_error_status.h" ]
traits_headers = [ "//content/common/resource_messages.h" ]
deps = [
"//content:export",
"//net:net",
"//third_party/WebKit/public:blink_headers",
]
type_mappings = [ "content.mojom.CORSErrorStatus=network::CORSErrorStatus" ]
......@@ -3,7 +3,6 @@
# found in the LICENSE file.
typemaps = [
"//content/public/common/cors_error_status.typemap",
"//content/public/common/manifest.typemap",
"//content/public/common/mutable_network_traffic_annotation_tag.typemap",
"//content/public/common/referrer.typemap",
......
......@@ -16,9 +16,6 @@ struct SSLInfo;
[Native]
struct URLRequestRedirectInfo;
[Native]
struct CORSErrorStatus;
[Native]
struct URLLoaderStatus;
......
......@@ -59,8 +59,8 @@ CORSURLLoader::CORSURLLoader(
if (fetch_cors_flag_ &&
fetch_request_mode_ == FetchRequestMode::kSameOrigin) {
forwarding_client_->OnComplete(network::URLLoaderStatus(
network::CORSErrorStatus(CORSError::kDisallowedByMode)));
forwarding_client_->OnComplete(
network::URLLoaderStatus(CORSError::kDisallowedByMode));
return;
}
......@@ -122,9 +122,7 @@ void CORSURLLoader::OnReceiveResponse(
blink::WebHTTPHeaderMap(response_head.headers.get()),
fetch_credentials_mode_, security_origin_);
if (cors_error) {
// TODO(toyoshim): Generate related_response_headers here.
network::CORSErrorStatus cors_error_status(*cors_error);
HandleComplete(network::URLLoaderStatus(cors_error_status));
HandleComplete(network::URLLoaderStatus(*cors_error));
return;
}
}
......
......@@ -183,9 +183,9 @@ TEST_F(CORSURLLoaderTest, CrossOriginRequestFetchRequestModeSameOrigin) {
EXPECT_FALSE(client().has_received_redirect());
EXPECT_FALSE(client().has_received_response());
EXPECT_EQ(net::ERR_FAILED, client().status().error_code);
ASSERT_TRUE(client().status().cors_error_status);
ASSERT_TRUE(client().status().cors_error);
EXPECT_EQ(network::mojom::CORSError::kDisallowedByMode,
client().status().cors_error_status->cors_error);
*client().status().cors_error);
}
TEST_F(CORSURLLoaderTest, CrossOriginRequestWithCORSModeButMissingCORSHeader) {
......@@ -202,9 +202,9 @@ TEST_F(CORSURLLoaderTest, CrossOriginRequestWithCORSModeButMissingCORSHeader) {
EXPECT_FALSE(client().has_received_redirect());
EXPECT_FALSE(client().has_received_response());
EXPECT_EQ(net::ERR_FAILED, client().status().error_code);
ASSERT_TRUE(client().status().cors_error_status);
ASSERT_TRUE(client().status().cors_error);
EXPECT_EQ(network::mojom::CORSError::kMissingAllowOriginHeader,
client().status().cors_error_status->cors_error);
*client().status().cors_error);
}
TEST_F(CORSURLLoaderTest, CrossOriginRequestWithCORSMode) {
......@@ -241,9 +241,9 @@ TEST_F(CORSURLLoaderTest,
EXPECT_FALSE(client().has_received_redirect());
EXPECT_FALSE(client().has_received_response());
EXPECT_EQ(net::ERR_FAILED, client().status().error_code);
ASSERT_TRUE(client().status().cors_error_status);
ASSERT_TRUE(client().status().cors_error);
EXPECT_EQ(network::mojom::CORSError::kAllowOriginMismatch,
client().status().cors_error_status->cors_error);
*client().status().cors_error);
}
} // namespace
......
......@@ -101,8 +101,6 @@ void SyncLoadContext::OnTransferSizeUpdated(int transfer_size_diff) {}
void SyncLoadContext::OnCompletedRequest(
const network::URLLoaderStatus& status) {
response_->error_code = status.error_code;
if (status.cors_error_status)
response_->cors_error = status.cors_error_status->cors_error;
response_->encoded_data_length = status.encoded_data_length;
response_->encoded_body_length = status.encoded_body_length;
event_->Signal();
......
......@@ -7,10 +7,7 @@
#include <string>
#include "base/optional.h"
#include "content/common/content_export.h"
#include "content/public/common/resource_response_info.h"
#include "services/network/public/interfaces/cors.mojom.h"
#include "url/gurl.h"
namespace content {
......@@ -22,10 +19,7 @@ struct CONTENT_EXPORT SyncLoadResponse : ResourceResponseInfo {
~SyncLoadResponse();
// The response error code.
int error_code = 0;
// Optional CORS error details.
base::Optional<network::mojom::CORSError> cors_error;
int error_code;
// The final URL of the response. This may differ from the request URL in
// the case of a server redirect.
......
......@@ -906,15 +906,13 @@ void WebURLLoaderImpl::Context::OnCompletedRequest(
this, TRACE_EVENT_FLAG_FLOW_IN);
if (status.error_code != net::OK) {
const WebURLError::HasCopyInCache has_copy_in_cache =
status.exists_in_cache ? WebURLError::HasCopyInCache::kTrue
: WebURLError::HasCopyInCache::kFalse;
client_->DidFail(
status.cors_error_status
? WebURLError(*status.cors_error_status, has_copy_in_cache, url_)
: WebURLError(status.error_code, has_copy_in_cache,
WebURLError::IsWebSecurityViolation::kFalse, url_),
total_transfer_size, encoded_body_size, status.decoded_body_length);
WebURLError error(status.error_code,
status.exists_in_cache
? WebURLError::HasCopyInCache::kTrue
: WebURLError::HasCopyInCache::kFalse,
WebURLError::IsWebSecurityViolation::kFalse, url_);
client_->DidFail(error, total_transfer_size, encoded_body_size,
status.decoded_body_length);
} else {
client_->DidFinishLoading(
(status.completion_time - TimeTicks()).InSecondsF(),
......@@ -1242,23 +1240,16 @@ void WebURLLoaderImpl::LoadSynchronously(const WebURLRequest& request,
// TODO(tc): For file loads, we may want to include a more descriptive
// status code or status text.
const int error_code = sync_load_response.error_code;
int error_code = sync_load_response.error_code;
if (error_code != net::OK) {
if (sync_load_response.cors_error) {
// TODO(toyoshim): Pass CORS error related headers here.
error =
WebURLError(network::CORSErrorStatus(*sync_load_response.cors_error),
WebURLError::HasCopyInCache::kFalse, final_url);
} else {
// SyncResourceHandler returns ERR_ABORTED for CORS redirect errors,
// so we treat the error as a web security violation.
const WebURLError::IsWebSecurityViolation is_web_security_violation =
error_code == net::ERR_ABORTED
? WebURLError::IsWebSecurityViolation::kTrue
: WebURLError::IsWebSecurityViolation::kFalse;
error = WebURLError(error_code, WebURLError::HasCopyInCache::kFalse,
is_web_security_violation, final_url);
}
// SyncResourceHandler returns ERR_ABORTED for CORS redirect errors,
// so we treat the error as a web security violation.
const bool is_web_security_violation = error_code == net::ERR_ABORTED;
error = WebURLError(error_code, WebURLError::HasCopyInCache::kFalse,
is_web_security_violation
? WebURLError::IsWebSecurityViolation::kTrue
: WebURLError::IsWebSecurityViolation::kFalse,
final_url);
return;
}
......
......@@ -2629,7 +2629,7 @@ bool RenderFrameImpl::ScheduleFileChooser(
}
void RenderFrameImpl::DidFailProvisionalLoadInternal(
const WebURLError& error,
const blink::WebURLError& error,
blink::WebHistoryCommitType commit_type,
const base::Optional<std::string>& error_page_content) {
TRACE_EVENT1("navigation,benchmark,rail",
......@@ -2873,7 +2873,7 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
}
void RenderFrameImpl::LoadErrorPage(int reason) {
WebURLError error(reason, frame_->GetDocument().Url());
blink::WebURLError error(reason, frame_->GetDocument().Url());
std::string error_html;
GetContentClient()->renderer()->GetNavigationErrorStrings(
......@@ -3892,7 +3892,7 @@ void RenderFrameImpl::DidReceiveServerRedirectForProvisionalLoad() {
}
void RenderFrameImpl::DidFailProvisionalLoad(
const WebURLError& error,
const blink::WebURLError& error,
blink::WebHistoryCommitType commit_type) {
DidFailProvisionalLoadInternal(error, commit_type, base::nullopt);
}
......@@ -4241,7 +4241,7 @@ void RenderFrameImpl::DidHandleOnloadEvents() {
}
}
void RenderFrameImpl::DidFailLoad(const WebURLError& error,
void RenderFrameImpl::DidFailLoad(const blink::WebURLError& error,
blink::WebHistoryCommitType commit_type) {
TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didFailLoad",
"id", routing_id_);
......@@ -6829,7 +6829,7 @@ void RenderFrameImpl::SendUpdateState() {
void RenderFrameImpl::SendFailedProvisionalLoad(
const blink::WebURLRequest& request,
const WebURLError& error,
const blink::WebURLError& error,
blink::WebLocalFrame* frame) {
bool show_repost_interstitial =
(error.reason() == net::ERR_CACHE_MISS &&
......
......@@ -6,8 +6,6 @@ import("//mojo/public/tools/bindings/mojom.gni")
static_library("cpp") {
sources = [
"cors_error_status.cc",
"cors_error_status.h",
"net_adapters.cc",
"net_adapters.h",
"url_loader_status.cc",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/network/public/cpp/cors_error_status.h"
#include "net/base/net_errors.h"
namespace network {
// Note: |cors_error| is initialized to kLast to keep the value inside the
// valid enum value range. The value is meaningless and should be overriden
// immediately by IPC desrtialization code.
CORSErrorStatus::CORSErrorStatus()
: CORSErrorStatus(network::mojom::CORSError::kLast) {}
CORSErrorStatus::CORSErrorStatus(const CORSErrorStatus& status) = default;
CORSErrorStatus::CORSErrorStatus(network::mojom::CORSError error)
: cors_error(error) {}
CORSErrorStatus::CORSErrorStatus(
network::mojom::CORSError error,
scoped_refptr<net::HttpResponseHeaders> headers)
: CORSErrorStatus(error) {
related_response_headers = headers;
}
CORSErrorStatus::~CORSErrorStatus() = default;
bool CORSErrorStatus::operator==(const CORSErrorStatus& rhs) const {
return cors_error == rhs.cors_error &&
related_response_headers == rhs.related_response_headers;
}
} // namespace network
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_NETWORK_PUBLIC_CPP_CORS_ERROR_STATUS_H_
#define SERVICES_NETWORK_PUBLIC_CPP_CORS_ERROR_STATUS_H_
#include "base/memory/scoped_refptr.h"
#include "net/http/http_response_headers.h"
#include "services/network/public/interfaces/cors.mojom.h"
namespace network {
struct CORSErrorStatus {
// This constructor is used by generated IPC serialization code.
// Should not use this explicitly.
// TODO(toyoshim, yhirano): Exploring a way to make this private, and allows
// only serialization code for mojo can access.
CORSErrorStatus();
CORSErrorStatus(const CORSErrorStatus& status);
explicit CORSErrorStatus(network::mojom::CORSError error);
CORSErrorStatus(
network::mojom::CORSError error,
scoped_refptr<net::HttpResponseHeaders> related_response_headers);
~CORSErrorStatus();
bool operator==(const CORSErrorStatus& rhs) const;
network::mojom::CORSError cors_error;
// Partial HTTP response headers including status line that will be useful to
// generate a human readable error message.
scoped_refptr<net::HttpResponseHeaders> related_response_headers;
};
} // namespace network
#endif // SERVICES_NETWORK_PUBLIC_CPP_CORS_ERROR_STATUS_H_
......@@ -14,9 +14,9 @@ URLLoaderStatus::URLLoaderStatus(const URLLoaderStatus& status) = default;
URLLoaderStatus::URLLoaderStatus(int error_code)
: error_code(error_code), completion_time(base::TimeTicks::Now()) {}
URLLoaderStatus::URLLoaderStatus(const CORSErrorStatus& error)
URLLoaderStatus::URLLoaderStatus(network::mojom::CORSError error)
: URLLoaderStatus(net::ERR_FAILED) {
cors_error_status = error;
cors_error = error;
}
URLLoaderStatus::~URLLoaderStatus() = default;
......@@ -28,7 +28,7 @@ bool URLLoaderStatus::operator==(const URLLoaderStatus& rhs) const {
encoded_data_length == rhs.encoded_data_length &&
encoded_body_length == rhs.encoded_body_length &&
decoded_body_length == rhs.decoded_body_length &&
cors_error_status == rhs.cors_error_status;
cors_error == rhs.cors_error;
}
} // namespace network
......@@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/optional.h"
#include "base/time/time.h"
#include "services/network/public/cpp/cors_error_status.h"
#include "services/network/public/interfaces/cors.mojom.h"
namespace network {
......@@ -23,9 +22,9 @@ struct URLLoaderStatus {
// |completion_time|.
explicit URLLoaderStatus(int error_code);
// Sets ERR_FAILED to |error_code|, |error| to |cors_error_status|, and
// Sets ERR_FAILED to |error_code|, |error| to |cors_error|, and
// base::TimeTicks::Now() to |completion_time|.
explicit URLLoaderStatus(const CORSErrorStatus& error);
explicit URLLoaderStatus(network::mojom::CORSError error);
~URLLoaderStatus();
......@@ -50,7 +49,7 @@ struct URLLoaderStatus {
int64_t decoded_body_length = 0;
// Optional CORS error details.
base::Optional<CORSErrorStatus> cors_error_status;
base::Optional<network::mojom::CORSError> cors_error;
};
} // namespace network
......
......@@ -822,40 +822,25 @@ crbug.com/538697 [ Win ] printing/webgl-oversized-printing.html [ Failure Crash
# ====== Out of Blink CORS related tests BEGIN ======
# TODO(toyoshim, tyoshino, kinuko): Make following tests pass. See crbug.com/736308.
# ./Tools/Scripts/run-webkit-tests virtual/outofblink-cors
# Found 2061 tests; running 2060, skipping 1.
# 2060 tests ran as expected (1968 passed, 92 didn't).
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/workers/upload-onprogress-event.html [ Pass Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-cors-xhr.https.html [ Failure Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event-network-error.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-fallback.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-redirect.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/performance-timeline.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/redirected-response.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/referer.https.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/referrer-policy-header.https.html [ Crash ]
# 1980 tests ran as expected (1884 passed, 96 didn't), 74 didn't
# including 8 crashes and 1 timeout.
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/workers/upload-onprogress-event.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/upload-onload-event.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/upload-onloadend-event-after-abort.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/upload-onloadend-event-after-load.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/upload-onloadstart-event.html [ Pass Crash ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/upload-onloadstart-event.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/upload-onprogress-event.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/upload-progress-events.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/xmlhttprequest-data-url.html [ Crash ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/fetch/api/cors/cors-preflight-status.any.html [ Pass Timeout ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/fetch/api/cors/cors-redirect-preflight.any.html [ Pass Timeout ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/fetch/api/redirect/redirect-location.html [ Pass Timeout ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/fetch/api/redirect/redirect-origin.html [ Pass Timeout ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/fetch/api/redirect/redirect-referrer.html [ Pass Timeout ]
crbug.com/626703 virtual/outofblink-cors/external/wpt/fetch/api/request/request-cache-default-conditional.html [ Pass Timeout ]
crbug.com/626703 virtual/outofblink-cors/external/wpt/fetch/api/response/response-cancel-stream.html [ Pass Timeout ]
crbug.com/626703 virtual/outofblink-cors/external/wpt/fetch/http-cache/status.html [ Pass Timeout ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/foreign-fetch-basics.https.html [ Timeout ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html [ Timeout ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-canvas-tainting-cache.https.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-canvas-tainting.https.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-cors-xhr.https.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-fallback.https.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-html-imports.https.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-request-xhr.https.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-worker/fetch-response-taint.https.html [ Failure ]
......@@ -864,13 +849,18 @@ crbug.com/736308 virtual/outofblink-cors/external/wpt/service-workers/service-wo
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/chromium/access-control-origin-header-in-isolated-world.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/cross-origin-no-credential-prompt.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/cross-site-denied-response.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/cross-site-denied-response-sync-2.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/cross-site-denied-response-sync.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/onerror-event.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/ontimeout-event-override-after-failure.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/open-in-body-onload-sync-to-invalid-cross-origin-response-handling.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-whitelisting-all.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-whitelisting-exact-match.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-whitelisting-ip-addresses-with-subdomains.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-whitelisting-removal.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-whitelisting-subdomains.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/post-blob-content-type-async.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-exact-matching/07.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-exact-matching/08.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-exact-matching/09.html [ Failure ]
......@@ -916,12 +906,17 @@ crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-whitel
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-whitelisting-ip-addresses.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/post-blob-content-type-sync.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/redirect-cors-origin-null.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/redirect-cross-origin.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/redirect-cross-origin-2.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/simple-cross-origin-denied-events.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-sync.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/simple-cross-origin-denied-events-sync.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/simple-cross-origin-progress-events.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/workers/xmlhttprequest-allowed-with-disabled-web-security.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/xhr-to-blob-in-isolated-world.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/xmlhttprequest-allowed-with-disabled-web-security.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/xmlhttprequest-sync-no-progress-events.html [ Failure ]
crbug.com/736308 virtual/outofblink-cors/http/tests/xmlhttprequest/xmlhttprequest-unsafe-redirect.html [ Failure ]
# ====== Out of Blink CORS related tests END ======
# ====== Fullscreen tests failing with feature policy ======
......@@ -3372,6 +3367,9 @@ crbug.com/749738 [ Win7 Debug ] virtual/mojo-loading/http/tests/devtools/console
# Sheriff failure 2017-08-07
crbug.com/708499 [ Linux ] virtual/wheelscrolllatching/fast/compositor-wheel-scroll-latching/touchpad-scroll-impl-to-main.html [ Failure Pass ]
# Sheriff failure 2017-08-11
crbug.com/626703 virtual/outofblink-cors/external/wpt/fetch/api/response/response-cancel-stream.html [ Pass Timeout ]
# Sheriff failure 2017-08-29
crbug.com/727252 [ Win7 ] external/wpt/media-source/mediasource-endofstream.html [ Pass Timeout ]
......
......@@ -106,7 +106,6 @@ source_set("generated") {
source_set("prerequisites") {
public_deps = [
"//gpu/command_buffer/client:gles2_c_lib",
"//services/network/public/cpp:cpp",
"//services/service_manager/public/cpp",
"//skia",
"//third_party/WebKit/Source/core/inspector:generated",
......
......@@ -180,7 +180,7 @@ void DocumentThreadableLoader::StartOutOfBlinkCORS(
const ResourceRequest& request) {
DCHECK(out_of_blink_cors_);
// TODO(toyoshim) replace this delegation with an implementation that does not
// TODO(hintzed) replace this delegation with an implementation that does not
// perform CORS checks but relies on CORSURLLoader for CORS
// (https://crbug.com/736308).
StartBlinkCORS(request);
......@@ -190,7 +190,7 @@ void DocumentThreadableLoader::DispatchInitialRequestOutOfBlinkCORS(
ResourceRequest& request) {
DCHECK(out_of_blink_cors_);
// TODO(toyoshim) replace this delegation with an implementation that does not
// TODO(hintzed) replace this delegation with an implementation that does not
// perform CORS checks but relies on CORSURLLoader for CORS
// (https://crbug.com/736308).
DispatchInitialRequestBlinkCORS(request);
......@@ -202,25 +202,11 @@ void DocumentThreadableLoader::HandleResponseOutOfBlinkCORS(
network::mojom::FetchCredentialsMode credentials_mode,
const ResourceResponse& response,
std::unique_ptr<WebDataConsumerHandle> handle) {
DCHECK(client_);
// Out of Blink CORS access check is implemented. But we still need some
// additional code to work with unfinished preflight support in Blink.
// TODO(toyoshim): Remove following workaround code to support preflight.
// TODO(hintzed) replace this delegation with an implementation that does not
// perform CORS checks but relies on CORSURLLoader for CORS
// (https://crbug.com/736308).
if (!actual_request_.IsNull()) {
ReportResponseReceived(identifier, response);
HandlePreflightResponse(response);
return;
}
// TODO(toyoshim): Support Service Worker. (https://crbug.com/736308).
if (response.WasFetchedViaServiceWorker()) {
HandleResponseBlinkCORS(identifier, request_mode, credentials_mode,
response, std::move(handle));
return;
}
client_->DidReceiveResponse(identifier, response, std::move(handle));
HandleResponseBlinkCORS(identifier, request_mode, credentials_mode, response,
std::move(handle));
}
bool DocumentThreadableLoader::RedirectReceivedOutOfBlinkCORS(
......@@ -229,7 +215,7 @@ bool DocumentThreadableLoader::RedirectReceivedOutOfBlinkCORS(
const ResourceResponse& redirect_response) {
DCHECK(out_of_blink_cors_);
// TODO(toyoshim) replace this delegation with an implementation that does not
// TODO(hintzed) replace this delegation with an implementation that does not
// perform CORS checks but relies on CORSURLLoader for CORS
// (https://crbug.com/736308).
return RedirectReceivedBlinkCORS(resource, new_request, redirect_response);
......@@ -239,7 +225,7 @@ void DocumentThreadableLoader::MakeCrossOriginAccessRequestOutOfBlinkCORS(
const ResourceRequest& request) {
DCHECK(out_of_blink_cors_);
// TODO(toyoshim) replace this delegation with an implementation that does not
// TODO(hintzed) replace this delegation with an implementation that does not
// perform CORS checks but relies on CORSURLLoader for CORS
// (https://crbug.com/736308).
MakeCrossOriginAccessRequestBlinkCORS(request);
......@@ -407,8 +393,8 @@ void DocumentThreadableLoader::LoadPreflightRequest(
ResourceRequest& preflight_request =
web_url_request.ToMutableResourceRequest();
// TODO(tyoshino): Call PrepareCrossOriginRequest(preflight_request) to also
// set the referrer header.
// TODO(tyoshino): Call prepareCrossOriginRequest(preflightRequest) to
// also set the referrer header.
if (GetSecurityOrigin())
preflight_request.SetHTTPOrigin(GetSecurityOrigin());
......@@ -1156,25 +1142,6 @@ void DocumentThreadableLoader::DispatchDidFailAccessControlCheck(
}
void DocumentThreadableLoader::DispatchDidFail(const ResourceError& error) {
if (error.CORSErrorStatus()) {
DCHECK(out_of_blink_cors_);
// TODO(toyoshim): Should consider to pass correct arguments instead of
// WebURL() and WebHTTPHeaderMap() to GetErrorString().
// We still need plumbing required information.
const int response_code =
error.CORSErrorStatus()->related_response_headers
? error.CORSErrorStatus()->related_response_headers->response_code()
: 0;
GetExecutionContext()->AddConsoleMessage(ConsoleMessage::Create(
kJSMessageSource, kErrorMessageLevel,
"Failed to load " + error.FailingURL() + ": " +
WebCORS::GetErrorString(
error.CORSErrorStatus()->cors_error, KURL(error.FailingURL()),
WebURL(), response_code, WebHTTPHeaderMap(HTTPHeaderMap()),
WebSecurityOrigin(GetSecurityOrigin()), request_context_)
.Utf8()
.data()));
}
ThreadableLoaderClient* client = client_;
Clear();
client->DidFail(error);
......
......@@ -156,8 +156,8 @@ class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader,
network::mojom::FetchCredentialsMode,
const ResourceResponse&,
std::unique_ptr<WebDataConsumerHandle>);
// TODO(toyoshim): CORS handled in Blink. Methods below named *BlinkCORS are
// to be removed after https://crbug.com/736308 is fixed (i.e. when CORS is
// TODO(hintzed): CORS handled in Blink. Methods below named *BlinkCORS are to
// be removed after https://crbug.com/736308 is fixed (i.e. when CORS is
// handled out of Blink).
void DispatchInitialRequestBlinkCORS(ResourceRequest&);
void MakeCrossOriginAccessRequestBlinkCORS(const ResourceRequest&);
......
......@@ -640,7 +640,6 @@ jumbo_component("platform") {
"exported/WebTextRun.cpp",
"exported/WebThreadSafeData.cpp",
"exported/WebURL.cpp",
"exported/WebURLError.cpp",
"exported/WebURLLoadTiming.cpp",
"exported/WebURLLoaderClient.cpp",
"exported/WebURLLoaderTestDelegate.cpp",
......@@ -1992,7 +1991,6 @@ test("blink_platform_perftests") {
":test_support",
"//base",
"//base/test:test_support",
"//services/network/public/cpp:cpp",
"//testing/gtest",
"//testing/perf",
"//third_party:freetype_harfbuzz",
......
......@@ -61,9 +61,3 @@ include_rules = [
"-core",
"-modules",
]
specific_include_rules = {
"WebURLError\.cpp": [
"+net/base/net_errors.h"
]
}
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "public/platform/WebURLError.h"
#include "net/base/net_errors.h"
namespace blink {
WebURLError::WebURLError(int reason, const WebURL& url)
: reason_(reason), url_(url) {
DCHECK_NE(reason_, 0);
}
WebURLError::WebURLError(int reason,
HasCopyInCache has_copy_in_cache,
IsWebSecurityViolation is_web_security_violation,
const WebURL& url)
: reason_(reason),
has_copy_in_cache_(has_copy_in_cache == HasCopyInCache::kTrue),
is_web_security_violation_(is_web_security_violation ==
IsWebSecurityViolation::kTrue),
url_(url) {
DCHECK_NE(reason_, 0);
}
WebURLError::WebURLError(const network::CORSErrorStatus& cors_error_status,
HasCopyInCache has_copy_in_cache,
const WebURL& url)
: reason_(net::ERR_FAILED),
has_copy_in_cache_(has_copy_in_cache == HasCopyInCache::kTrue),
is_web_security_violation_(true),
url_(url),
cors_error_status_(cors_error_status) {}
} // namespace blink
......@@ -93,7 +93,6 @@ jumbo_source_set("loader") {
deps = [
":make_platform_loader_generated_fetch_initiator_type_names",
"//components/link_header_util:link_header_util",
"//services/network/public/cpp:cpp",
]
public_deps = [
......
......@@ -2,7 +2,7 @@ include_rules = [
"+base/metrics/field_trial_params.h", # for fetch/ResourceLoadScheduler.cpp
"+base/strings/string_number_conversions.h", # for fetch/ResourceLoadScheduler.cpp
"+components/link_header_util", # for LinkHeader.cpp
"+services/network/public", # for Fetch API and CORS
"+services/network/public/interfaces", # for Fetch API and CORS
"+third_party/boringssl/src/include/openssl/curve25519.h" # for SubresourceIntegrity.cpp
]
......
......@@ -46,7 +46,7 @@ int ResourceError::BlockedByXSSAuditorErrorCode() {
}
ResourceError ResourceError::CancelledError(const KURL& url) {
return ResourceError(net::ERR_ABORTED, url, WTF::nullopt);
return ResourceError(net::ERR_ABORTED, url);
}
ResourceError ResourceError::CancelledDueToAccessCheckError(
......@@ -69,24 +69,19 @@ ResourceError ResourceError::CancelledDueToAccessCheckError(
}
ResourceError ResourceError::CacheMissError(const KURL& url) {
return ResourceError(net::ERR_CACHE_MISS, url, WTF::nullopt);
return ResourceError(net::ERR_CACHE_MISS, url);
}
ResourceError ResourceError::TimeoutError(const KURL& url) {
return ResourceError(net::ERR_TIMED_OUT, url, WTF::nullopt);
return ResourceError(net::ERR_TIMED_OUT, url);
}
ResourceError ResourceError::Failure(const KURL& url) {
return ResourceError(net::ERR_FAILED, url, WTF::nullopt);
return ResourceError(net::ERR_FAILED, url);
}
ResourceError::ResourceError(
int error_code,
const KURL& url,
WTF::Optional<network::CORSErrorStatus> cors_error_status)
: error_code_(error_code),
failing_url_(url),
cors_error_status_(cors_error_status) {
ResourceError::ResourceError(int error_code, const KURL& url)
: error_code_(error_code), failing_url_(url) {
DCHECK_NE(error_code_, 0);
InitializeDescription();
}
......@@ -95,15 +90,13 @@ ResourceError::ResourceError(const WebURLError& error)
: error_code_(error.reason()),
failing_url_(error.url()),
is_access_check_(error.is_web_security_violation()),
has_copy_in_cache_(error.has_copy_in_cache()),
cors_error_status_(error.cors_error_status()) {
has_copy_in_cache_(error.has_copy_in_cache()) {
DCHECK_NE(error_code_, 0);
InitializeDescription();
}
ResourceError ResourceError::Copy() const {
ResourceError error_copy(error_code_, failing_url_.Copy(),
cors_error_status_);
ResourceError error_copy(error_code_, failing_url_.Copy());
error_copy.has_copy_in_cache_ = has_copy_in_cache_;
error_copy.localized_description_ = localized_description_.IsolatedCopy();
error_copy.is_access_check_ = is_access_check_;
......@@ -111,16 +104,9 @@ ResourceError ResourceError::Copy() const {
}
ResourceError::operator WebURLError() const {
WebURLError::HasCopyInCache has_copy_in_cache =
has_copy_in_cache_ ? WebURLError::HasCopyInCache::kTrue
: WebURLError::HasCopyInCache::kFalse;
if (cors_error_status_) {
DCHECK_EQ(net::ERR_FAILED, error_code_);
return WebURLError(*cors_error_status_, has_copy_in_cache, failing_url_);
}
return WebURLError(error_code_, has_copy_in_cache,
return WebURLError(error_code_,
has_copy_in_cache_ ? WebURLError::HasCopyInCache::kTrue
: WebURLError::HasCopyInCache::kFalse,
is_access_check_
? WebURLError::IsWebSecurityViolation::kTrue
: WebURLError::IsWebSecurityViolation::kFalse,
......@@ -143,9 +129,6 @@ bool ResourceError::Compare(const ResourceError& a, const ResourceError& b) {
if (a.HasCopyInCache() != b.HasCopyInCache())
return false;
if (a.CORSErrorStatus() != b.CORSErrorStatus())
return false;
return true;
}
......
......@@ -34,7 +34,6 @@
#include "platform/wtf/Optional.h"
#include "platform/wtf/text/WTFString.h"
#include "public/platform/WebURLError.h"
#include "services/network/public/cpp/cors_error_status.h"
namespace blink {
......@@ -61,9 +60,7 @@ class PLATFORM_EXPORT ResourceError final {
ResourceError() = delete;
// |error_code| must not be 0.
ResourceError(int error_code,
const KURL& failing_url,
WTF::Optional<network::CORSErrorStatus>);
ResourceError(int error_code, const KURL& failing_url);
ResourceError(const WebURLError&);
// Makes a deep copy. Useful for when you need to use a ResourceError on
......@@ -82,10 +79,6 @@ class PLATFORM_EXPORT ResourceError final {
bool WasBlockedByResponse() const;
bool ShouldCollapseInitiator() const { return should_collapse_initiator_; }
WTF::Optional<network::CORSErrorStatus> CORSErrorStatus() const {
return cors_error_status_;
}
operator WebURLError() const;
static bool Compare(const ResourceError&, const ResourceError&);
......@@ -102,7 +95,6 @@ class PLATFORM_EXPORT ResourceError final {
bool is_access_check_ = false;
bool has_copy_in_cache_ = false;
bool should_collapse_initiator_ = false;
WTF::Optional<network::CORSErrorStatus> cors_error_status_;
};
inline bool operator==(const ResourceError& a, const ResourceError& b) {
......
......@@ -22,7 +22,6 @@ include_rules = [
"-public/web",
# Enforce to use mojom-shared.h in WebKit/public so that it can compile
# inside and outside Blink.
"+services/network/public/cpp/cors_error_status.h",
"+services/network/public/interfaces/cors.mojom-shared.h",
"+services/network/public/interfaces/fetch_api.mojom-shared.h",
"+services/service_manager/public/interfaces",
......
......@@ -33,8 +33,6 @@
#include "WebURL.h"
#include "base/logging.h"
#include "base/optional.h"
#include "services/network/public/cpp/cors_error_status.h"
namespace blink {
......@@ -52,23 +50,26 @@ struct WebURLError {
WebURLError() = delete;
// |reason| must not be 0.
BLINK_PLATFORM_EXPORT WebURLError(int reason, const WebURL&);
WebURLError(int reason, const WebURL& url) : reason_(reason), url_(url) {
DCHECK_NE(reason_, 0);
}
// |reason| must not be 0.
BLINK_PLATFORM_EXPORT WebURLError(int reason,
HasCopyInCache,
IsWebSecurityViolation,
const WebURL&);
BLINK_PLATFORM_EXPORT WebURLError(const network::CORSErrorStatus&,
HasCopyInCache,
const WebURL&);
WebURLError(int reason,
HasCopyInCache has_copy_in_cache,
IsWebSecurityViolation is_web_security_violation,
const WebURL& url)
: reason_(reason),
has_copy_in_cache_(has_copy_in_cache == HasCopyInCache::kTrue),
is_web_security_violation_(is_web_security_violation ==
IsWebSecurityViolation::kTrue),
url_(url) {
DCHECK_NE(reason_, 0);
}
int reason() const { return reason_; }
bool has_copy_in_cache() const { return has_copy_in_cache_; }
bool is_web_security_violation() const { return is_web_security_violation_; }
const WebURL& url() const { return url_; }
const base::Optional<network::CORSErrorStatus> cors_error_status() const {
return cors_error_status_;
}
private:
// A numeric error code detailing the reason for this error. The value must
......@@ -84,9 +85,6 @@ struct WebURLError {
// The url that failed to load.
WebURL url_;
// Optional CORS error details.
base::Optional<network::CORSErrorStatus> cors_error_status_;
};
} // namespace blink
......
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