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

Disable CORS check in FileURLLoader

It was introduced for out-of-blink CORS, but the check doesn't work with
extensions. Until it's fixes let's rely on the renderer side check and
disable the check.

Bug: 895999
Change-Id: I59aaafcb9185e1937372cf8967ef45d3728dff64
Reviewed-on: https://chromium-review.googlesource.com/c/1335078
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarTakashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609213}
parent d2277a1c
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <vector> #include <vector>
#include "base/bind.h" #include "base/bind.h"
#include "base/feature_list.h"
#include "base/files/file.h" #include "base/files/file.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
...@@ -40,6 +41,7 @@ ...@@ -40,6 +41,7 @@
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "net/url_request/redirect_info.h" #include "net/url_request/redirect_info.h"
#include "services/network/public/cpp/cors/cors_error_status.h" #include "services/network/public/cpp/cors/cors_error_status.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/cors.mojom-shared.h" #include "services/network/public/mojom/cors.mojom-shared.h"
#include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader.mojom.h"
...@@ -102,6 +104,12 @@ bool ShouldFailRequestDueToCors(const network::ResourceRequest& request) { ...@@ -102,6 +104,12 @@ bool ShouldFailRequestDueToCors(const network::ResourceRequest& request) {
return false; return false;
} }
// Currently the following logic does not work with extensions. Until it's
// fixed let's rely on the renderer-side check. See https://crbug.com/895999.
if (!base::FeatureList::IsEnabled(network::features::kOutOfBlinkCors)) {
return false;
}
const auto mode = request.fetch_request_mode; const auto mode = request.fetch_request_mode;
if (mode == network::mojom::FetchRequestMode::kNavigate || if (mode == network::mojom::FetchRequestMode::kNavigate ||
mode == network::mojom::FetchRequestMode::kNoCors) { mode == network::mojom::FetchRequestMode::kNoCors) {
......
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