Commit 858333f6 authored by Takashi Toyoshima's avatar Takashi Toyoshima Committed by Commit Bot

OOR-CORS: Add an experimental Feature to enforce extraHeaders option

We are planning to provide a temporary policy escape hatch for
the OOR-CORS enterprise-friendly rollout. With this policy, Chrome
handles any webRequest API users as specifying "extraHeaders" option
so that such Extension can work without any fix for a while.

Before adding such enterprise policy, we want to run a field trial
if such approach does not introduce any other problems.

This patch adds this escape hatch as a base::Feature trial. We will
run a field trials in non-stable channels for a while, and convert this
to an enterprise policy for m79.

Bug: 1000982
Change-Id: I27b96d4fbc70fb52eb2c878058d0fd22078fd339
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1792506Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Commit-Queue: Takashi Toyoshima <toyoshim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695549}
parent e831f6ac
......@@ -37,6 +37,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/runtime_data.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extension_messages.h"
#include "net/cookies/cookie_util.h"
#include "net/cookies/parsed_cookie.h"
......@@ -334,7 +335,10 @@ IgnoredAction::IgnoredAction(IgnoredAction&& rhs) = default;
bool ExtraInfoSpec::InitFromValue(const base::ListValue& value,
int* extra_info_spec) {
*extra_info_spec = 0;
*extra_info_spec = base::FeatureList::IsEnabled(
extensions_features::kForceWebRequestExtraHeaders)
? EXTRA_HEADERS
: 0;
for (size_t i = 0; i < value.GetSize(); ++i) {
std::string str;
if (!value.GetString(i, &str))
......
......@@ -6,6 +6,12 @@
namespace extensions_features {
// Forces to handle event listeners as it specifies the "extraHeaders" option.
// TODO(crbug.com/1000982, 1000984): Run a field trial, and convert to a
// short-term enterprise policy.
const base::Feature kForceWebRequestExtraHeaders{
"ForceWebRequestExtraHeaders", base::FEATURE_DISABLED_BY_DEFAULT};
// Forces requests to go through WebRequestProxyingURLLoaderFactory.
const base::Feature kForceWebRequestProxyForTest{
"ForceWebRequestProxyForTest", base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -9,6 +9,7 @@
namespace extensions_features {
extern const base::Feature kForceWebRequestExtraHeaders;
extern const base::Feature kForceWebRequestProxyForTest;
} // namespace extensions_features
......
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