Enable Signed Exchange behind Experimental Web Platform Features flag
This patch enables Signed HTTP Exchange when the Experimental Web
Platform Features flag is on, in addition to the
--enable-features=SignedHTTPExchange flag.
Now sxg-origin-trial(-with-network-service) virtual tests run with
--stable-release-mode, so that the feature is disabled unless an OT
token is provided.
This patch also removes unused blink-side SignedHTTPExchange feature flag.
Bug: 920906
Change-Id: Ic4a6bbef7086cead765fc4c11e767fd50772c1a7
Reviewed-on: https://chromium-review.googlesource.com/c/1405159
Reviewed-by: Kouhei Ueno <[email protected]>
Reviewed-by: Tsuyoshi Horo <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Commit-Queue: Kunihiko Sakamoto <[email protected]>
Cr-Commit-Position: refs/heads/master@{#621924}
diff --git a/content/browser/web_package/signed_exchange_utils.cc b/content/browser/web_package/signed_exchange_utils.cc
index c35f106..019dc3b 100644
--- a/content/browser/web_package/signed_exchange_utils.cc
+++ b/content/browser/web_package/signed_exchange_utils.cc
@@ -4,6 +4,7 @@
#include "content/browser/web_package/signed_exchange_utils.h"
+#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/no_destructor.h"
@@ -17,6 +18,7 @@
#include "content/browser/web_package/signed_exchange_error.h"
#include "content/browser/web_package/signed_exchange_request_handler.h"
#include "content/public/common/content_features.h"
+#include "content/public/common/content_switches.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/resource_response.h"
#include "third_party/blink/public/common/origin_trials/trial_token_validator.h"
@@ -47,12 +49,18 @@
return OriginsList(param);
}
+bool IsSignedHTTPExchangeEnabledByFlags() {
+ return base::FeatureList::IsEnabled(features::kSignedHTTPExchange) ||
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableExperimentalWebPlatformFeatures);
+}
+
} // namespace
bool NeedToCheckRedirectedURLForAcceptHeader() {
// When SignedHTTPExchange is enabled, the SignedExchange accept header must
// be sent to all origins. So we don't need to check the redirected URL.
- return !base::FeatureList::IsEnabled(features::kSignedHTTPExchange) &&
+ return !IsSignedHTTPExchangeEnabledByFlags() &&
base::FeatureList::IsEnabled(
features::kSignedHTTPExchangeOriginTrial) &&
base::FeatureList::IsEnabled(
@@ -62,7 +70,7 @@
bool ShouldAdvertiseAcceptHeader(const url::Origin& origin) {
// When SignedHTTPExchange is enabled, we must send the SignedExchange accept
// header to all origins.
- if (base::FeatureList::IsEnabled(features::kSignedHTTPExchange))
+ if (IsSignedHTTPExchangeEnabledByFlags())
return true;
// When SignedHTTPExchangeOriginTrial is not enabled or
// SignedHTTPExchangeAcceptHeader is not enabled, we must not send the
@@ -81,7 +89,7 @@
}
bool IsSignedExchangeHandlingEnabled() {
- return base::FeatureList::IsEnabled(features::kSignedHTTPExchange) ||
+ return IsSignedHTTPExchangeEnabledByFlags() ||
base::FeatureList::IsEnabled(features::kSignedHTTPExchangeOriginTrial);
}
@@ -99,7 +107,7 @@
head.mime_type)) {
return false;
}
- if (base::FeatureList::IsEnabled(features::kSignedHTTPExchange))
+ if (IsSignedHTTPExchangeEnabledByFlags())
return true;
if (!base::FeatureList::IsEnabled(features::kSignedHTTPExchangeOriginTrial))
return false;