Commit 50ed8305 authored by Kunihiko Sakamoto's avatar Kunihiko Sakamoto Committed by Commit Bot

Remove Origin Trial code for Signed HTTP Exchange

This removes SignedHTTPExchangeOriginTrial feature, and its accompanied
SignedHTTPExchangeAcceptHeader feature which is used for the Accept
header opt-in.

Bug: 827939,887201
Change-Id: I0794b886715a63cb6ac43c37a0adaddeb31f2af8
Reviewed-on: https://chromium-review.googlesource.com/c/1481181Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarTsuyoshi Horo <horo@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634519}
parent 5bcdd1ed
...@@ -1825,8 +1825,6 @@ jumbo_source_set("browser") { ...@@ -1825,8 +1825,6 @@ jumbo_source_set("browser") {
"web_contents/web_drag_utils_win.h", "web_contents/web_drag_utils_win.h",
"web_package/http_structured_header.cc", "web_package/http_structured_header.cc",
"web_package/http_structured_header.h", "web_package/http_structured_header.h",
"web_package/origins_list.cc",
"web_package/origins_list.h",
"web_package/signed_exchange_cert_fetcher.cc", "web_package/signed_exchange_cert_fetcher.cc",
"web_package/signed_exchange_cert_fetcher.h", "web_package/signed_exchange_cert_fetcher.h",
"web_package/signed_exchange_cert_fetcher_factory.cc", "web_package/signed_exchange_cert_fetcher_factory.cc",
......
...@@ -231,8 +231,7 @@ std::unique_ptr<network::ResourceRequest> CreateResourceRequest( ...@@ -231,8 +231,7 @@ std::unique_ptr<network::ResourceRequest> CreateResourceRequest(
request_info->begin_params->headers); request_info->begin_params->headers);
std::string accept_value = network::kFrameAcceptHeader; std::string accept_value = network::kFrameAcceptHeader;
if (signed_exchange_utils::ShouldAdvertiseAcceptHeader( if (signed_exchange_utils::IsSignedExchangeHandlingEnabled()) {
url::Origin::Create(request_info->common_params.url))) {
DCHECK(!accept_value.empty()); DCHECK(!accept_value.empty());
accept_value.append(kAcceptHeaderSignedExchangeSuffix); accept_value.append(kAcceptHeaderSignedExchangeSuffix);
} }
...@@ -1104,25 +1103,6 @@ class NavigationURLLoaderImpl::URLLoaderRequestController ...@@ -1104,25 +1103,6 @@ class NavigationURLLoaderImpl::URLLoaderRequestController
url_loader_removed_headers_ = removed_headers; url_loader_removed_headers_ = removed_headers;
url_loader_modified_headers_ = modified_headers; url_loader_modified_headers_ = modified_headers;
if (signed_exchange_utils::NeedToCheckRedirectedURLForAcceptHeader()) {
// Currently we send the SignedExchange accept header only for the limited
// origins when SignedHTTPExchangeOriginTrial feature is enabled without
// SignedHTTPExchange feature. We need to put the SignedExchange accept
// header on when redirecting to the origins in the OriginList of
// SignedHTTPExchangeAcceptHeader field trial, and need to remove it when
// redirecting to out of the OriginList.
std::string accept_value = network::kFrameAcceptHeader;
if (signed_exchange_utils::ShouldAdvertiseAcceptHeader(
url::Origin::Create(resource_request_->url))) {
DCHECK(!accept_value.empty());
accept_value.append(kAcceptHeaderSignedExchangeSuffix);
}
url_loader_modified_headers_.SetHeader(network::kAcceptHeader,
accept_value);
resource_request_->headers.SetHeader(network::kAcceptHeader,
accept_value);
}
Restart(); Restart();
} }
......
...@@ -50,9 +50,8 @@ PrefetchURLLoader::PrefetchURLLoader( ...@@ -50,9 +50,8 @@ PrefetchURLLoader::PrefetchURLLoader(
std::move(signed_exchange_prefetch_metric_recorder)) { std::move(signed_exchange_prefetch_metric_recorder)) {
DCHECK(network_loader_factory_); DCHECK(network_loader_factory_);
if (signed_exchange_utils::ShouldAdvertiseAcceptHeader( if (signed_exchange_utils::IsSignedExchangeHandlingEnabled()) {
url::Origin::Create(resource_request_.url))) { // Set the SignedExchange accept header.
// Set the SignedExchange accept header only for the limited origins.
// (https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#internet-media-type-applicationsigned-exchange). // (https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#internet-media-type-applicationsigned-exchange).
resource_request_.headers.SetHeader( resource_request_.headers.SetHeader(
network::kAcceptHeader, kSignedExchangeEnabledAcceptHeaderForPrefetch); network::kAcceptHeader, kSignedExchangeEnabledAcceptHeaderForPrefetch);
...@@ -85,25 +84,9 @@ void PrefetchURLLoader::FollowRedirect( ...@@ -85,25 +84,9 @@ void PrefetchURLLoader::FollowRedirect(
return; return;
} }
net::HttpRequestHeaders modified_request_headers_for_accept;
if (signed_exchange_utils::NeedToCheckRedirectedURLForAcceptHeader()) {
// Currently we send the SignedExchange accept header only for the limited
// origins when SignedHTTPExchangeOriginTrial feature is enabled without
// SignedHTTPExchange feature. So need to update the accept header by
// checking the new URL when redirected.
if (signed_exchange_utils::ShouldAdvertiseAcceptHeader(
url::Origin::Create(resource_request_.url))) {
modified_request_headers_for_accept.SetHeader(
network::kAcceptHeader,
kSignedExchangeEnabledAcceptHeaderForPrefetch);
} else {
modified_request_headers_for_accept.SetHeader(
network::kAcceptHeader, network::kDefaultAcceptHeader);
}
}
DCHECK(loader_); DCHECK(loader_);
loader_->FollowRedirect(removed_headers, modified_request_headers_for_accept, loader_->FollowRedirect(removed_headers,
net::HttpRequestHeaders() /* modified_headers */,
base::nullopt); base::nullopt);
} }
......
// Copyright 2018 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 "content/browser/web_package/origins_list.h"
#include "base/strings/string_split.h"
#include "url/gurl.h"
namespace content {
namespace signed_exchange_utils {
constexpr char kSubdomainMatchPrefix[] = "*.";
OriginsList::OriginsList() = default;
OriginsList::OriginsList(base::StringPiece str) {
std::vector<base::StringPiece> elements = base::SplitStringPiece(
str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (base::StringPiece element : elements) {
bool subdomain_match = false;
if (base::StartsWith(element, kSubdomainMatchPrefix,
base::CompareCase::SENSITIVE)) {
subdomain_match = true;
element.remove_prefix(sizeof(kSubdomainMatchPrefix) - 1);
}
if (base::StartsWith(element,
"https:", base::CompareCase::INSENSITIVE_ASCII)) {
LOG(ERROR) << "OriginsList entry should omit https scheme: \"" << element
<< "\"";
continue;
}
std::string url_str("https://");
element.AppendToString(&url_str);
GURL url(url_str);
if (!url.is_valid()) {
LOG(ERROR) << "Failed to parse an OriginsList entry to a valid Origin: \""
<< element << "\"";
continue;
}
DCHECK(url.SchemeIs("https"));
url::Origin origin = url::Origin::Create(url);
if (subdomain_match) {
subdomain_match_origins_.push_back(origin);
} else {
exact_match_origins_.insert(origin);
}
}
}
OriginsList::OriginsList(OriginsList&&) = default;
OriginsList::~OriginsList() = default;
bool OriginsList::IsEmpty() const {
return exact_match_origins_.empty() && subdomain_match_origins_.empty();
}
bool OriginsList::Match(const url::Origin& origin) const {
// OriginsList only contains HTTPS scheme origins.
if (origin.scheme() != url::kHttpsScheme) {
return false;
}
if (exact_match_origins_.find(origin) != exact_match_origins_.end()) {
return true;
}
for (const auto& subdomain_match_origin : subdomain_match_origins_) {
if (origin.DomainIs(subdomain_match_origin.host()) &&
origin.port() == subdomain_match_origin.port()) {
return true;
}
}
return false;
}
} // namespace signed_exchange_utils
} // namespace content
// Copyright 2018 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 CONTENT_BROWSER_WEB_PACKAGE_ORIGINS_LIST_H_
#define CONTENT_BROWSER_WEB_PACKAGE_ORIGINS_LIST_H_
#include <vector>
#include "base/containers/flat_set.h"
#include "base/strings/string_piece.h"
#include "content/common/content_export.h"
#include "url/origin.h"
namespace content {
namespace signed_exchange_utils {
// OriginsList can query if a particular origin |Match|.
// OriginsList can only match HTTPS origins.
class CONTENT_EXPORT OriginsList {
public:
OriginsList();
// Creates an OriginsList from comma-separated list of hosts.
//
// Entries starting with "*." will match with subdomains.
//
// For example, "example.com,*.google.com" will create an
// OriginsList that match exactly "example.com" but not its
// subdomains, and all subdomains of "google.com".
//
// Note: Entries should NOT start with "https://", but start from hostname.
explicit OriginsList(base::StringPiece str);
OriginsList(OriginsList&&);
~OriginsList();
// Returns true when |this| has an empty list to match
// (i.e. no origins would match).
bool IsEmpty() const;
bool Match(const url::Origin& origin) const;
private:
base::flat_set<url::Origin> exact_match_origins_;
std::vector<url::Origin> subdomain_match_origins_;
};
} // namespace signed_exchange_utils
} // namespace content
#endif // CONTENT_BROWSER_WEB_PACKAGE_ORIGINS_LIST_H_
// Copyright 2018 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 "content/browser/web_package/origins_list.h"
#include "base/callback.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace signed_exchange_utils {
TEST(OriginsList, IsEmpty) {
OriginsList origins_list;
EXPECT_TRUE(origins_list.IsEmpty());
}
TEST(OriginsList, ExactMatch) {
OriginsList origins_list(
"example.com,test.example.com,https://invalid.entry,example.net:1234");
EXPECT_FALSE(origins_list.IsEmpty());
static constexpr const char* kShouldMatchList[] = {
"https://example.com", "https://test.example.com",
"https://example.net:1234",
};
for (const char* should_match : kShouldMatchList) {
EXPECT_TRUE(origins_list.Match(url::Origin::Create(GURL(should_match))))
<< "OriginList should match url: " << should_match;
}
static constexpr const char* kShouldNotMatchList[] = {
"http://example.com", "https://subdomain.example.com",
"https://notexample.com", "https://invalid.entry",
"https://example.net", "https://example.net:5432",
};
for (const char* should_not_match : kShouldNotMatchList) {
EXPECT_FALSE(
origins_list.Match(url::Origin::Create(GURL(should_not_match))))
<< "OriginList should not match url: " << should_not_match;
}
}
TEST(OriginsList, SubdomainMatch) {
OriginsList origins_list("*.example.com,*.example.net:1234");
EXPECT_FALSE(origins_list.IsEmpty());
static constexpr const char* kShouldMatchList[] = {
"https://example.com", "https://test.example.com",
"https://test.test2.example.com", "https://test.example.net:1234",
};
for (const char* should_match : kShouldMatchList) {
EXPECT_TRUE(origins_list.Match(url::Origin::Create(GURL(should_match))))
<< "OriginList should match url: " << should_match;
}
static constexpr const char* kShouldNotMatchList[] = {
"http://example.com", "https://notexample.com",
"https://test.example.net", "https://test.example.net:5432",
};
for (const char* should_not_match : kShouldNotMatchList) {
EXPECT_FALSE(
origins_list.Match(url::Origin::Create(GURL(should_not_match))))
<< "OriginList should not match url: " << should_not_match;
}
}
} // namespace signed_exchange_utils
} // namespace content
...@@ -6,14 +6,11 @@ ...@@ -6,14 +6,11 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/no_destructor.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "content/browser/loader/download_utils_impl.h" #include "content/browser/loader/download_utils_impl.h"
#include "content/browser/web_package/origins_list.h"
#include "content/browser/web_package/signed_exchange_devtools_proxy.h" #include "content/browser/web_package/signed_exchange_devtools_proxy.h"
#include "content/browser/web_package/signed_exchange_error.h" #include "content/browser/web_package/signed_exchange_error.h"
#include "content/browser/web_package/signed_exchange_request_handler.h" #include "content/browser/web_package/signed_exchange_request_handler.h"
...@@ -21,7 +18,6 @@ ...@@ -21,7 +18,6 @@
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "services/network/public/cpp/resource_response.h" #include "services/network/public/cpp/resource_response.h"
#include "third_party/blink/public/common/origin_trials/trial_token_validator.h"
namespace content { namespace content {
namespace signed_exchange_utils { namespace signed_exchange_utils {
...@@ -37,62 +33,12 @@ void ReportErrorAndTraceEvent( ...@@ -37,62 +33,12 @@ void ReportErrorAndTraceEvent(
devtools_proxy->ReportError(error_message, std::move(error_field)); devtools_proxy->ReportError(error_message, std::move(error_field));
} }
namespace { bool IsSignedExchangeHandlingEnabled() {
OriginsList CreateAdvertiseAcceptHeaderOriginsList() {
std::string param = base::GetFieldTrialParamValueByFeature(
features::kSignedHTTPExchangeAcceptHeader,
features::kSignedHTTPExchangeAcceptHeaderFieldTrialParamName);
if (param.empty())
DLOG(ERROR) << "The Accept-SXG origins list param is empty.";
return OriginsList(param);
}
bool IsSignedHTTPExchangeEnabledByFlags() {
return base::FeatureList::IsEnabled(features::kSignedHTTPExchange) || return base::FeatureList::IsEnabled(features::kSignedHTTPExchange) ||
base::CommandLine::ForCurrentProcess()->HasSwitch( base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalWebPlatformFeatures); 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 !IsSignedHTTPExchangeEnabledByFlags() &&
base::FeatureList::IsEnabled(
features::kSignedHTTPExchangeOriginTrial) &&
base::FeatureList::IsEnabled(
features::kSignedHTTPExchangeAcceptHeader);
}
bool ShouldAdvertiseAcceptHeader(const url::Origin& origin) {
// When SignedHTTPExchange is enabled, we must send the SignedExchange accept
// header to all origins.
if (IsSignedHTTPExchangeEnabledByFlags())
return true;
// When SignedHTTPExchangeOriginTrial is not enabled or
// SignedHTTPExchangeAcceptHeader is not enabled, we must not send the
// SignedExchange accept header.
if (!base::FeatureList::IsEnabled(features::kSignedHTTPExchangeOriginTrial) ||
!base::FeatureList::IsEnabled(
features::kSignedHTTPExchangeAcceptHeader)) {
return false;
}
// |origins_list| is initialized in a thread-safe manner.
// Querying OriginsList::Match() should be safe since it's read-only access.
static base::NoDestructor<OriginsList> origins_list(
CreateAdvertiseAcceptHeaderOriginsList());
return origins_list->Match(origin);
}
bool IsSignedExchangeHandlingEnabled() {
return IsSignedHTTPExchangeEnabledByFlags() ||
base::FeatureList::IsEnabled(features::kSignedHTTPExchangeOriginTrial);
}
bool ShouldHandleAsSignedHTTPExchange( bool ShouldHandleAsSignedHTTPExchange(
const GURL& request_url, const GURL& request_url,
const network::ResourceResponseHead& head) { const network::ResourceResponseHead& head) {
...@@ -107,15 +53,7 @@ bool ShouldHandleAsSignedHTTPExchange( ...@@ -107,15 +53,7 @@ bool ShouldHandleAsSignedHTTPExchange(
head.mime_type)) { head.mime_type)) {
return false; return false;
} }
if (IsSignedHTTPExchangeEnabledByFlags()) return IsSignedExchangeHandlingEnabled();
return true;
if (!base::FeatureList::IsEnabled(features::kSignedHTTPExchangeOriginTrial))
return false;
std::unique_ptr<blink::TrialTokenValidator> validator =
std::make_unique<blink::TrialTokenValidator>();
return validator->RequestEnablesFeature(
request_url, head.headers.get(),
features::kSignedHTTPExchangeOriginTrial.name, base::Time::Now());
} }
base::Optional<SignedExchangeVersion> GetSignedExchangeVersion( base::Optional<SignedExchangeVersion> GetSignedExchangeVersion(
......
...@@ -8,17 +8,12 @@ ...@@ -8,17 +8,12 @@
#include <string> #include <string>
#include "base/optional.h" #include "base/optional.h"
#include "content/browser/web_package/origins_list.h"
#include "content/browser/web_package/signed_exchange_consts.h" #include "content/browser/web_package/signed_exchange_consts.h"
#include "content/browser/web_package/signed_exchange_error.h" #include "content/browser/web_package/signed_exchange_error.h"
#include "content/browser/web_package/signed_exchange_signature_verifier.h" #include "content/browser/web_package/signed_exchange_signature_verifier.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace url {
class Origin;
} // namespace url
namespace network { namespace network {
struct ResourceResponseHead; struct ResourceResponseHead;
} // namespace network } // namespace network
...@@ -47,23 +42,11 @@ void ReportErrorAndTraceEvent( ...@@ -47,23 +42,11 @@ void ReportErrorAndTraceEvent(
base::Optional<SignedExchangeError::FieldIndexPair> error_field = base::Optional<SignedExchangeError::FieldIndexPair> error_field =
base::nullopt); base::nullopt);
// Returns true when SignedHTTPExchange feature is NOT enabled and // Returns true when SignedHTTPExchange feature is enabled.
// SignedHTTPExchangeOriginTrial and SignedHTTPExchangeAcceptHeader features are CONTENT_EXPORT bool IsSignedExchangeHandlingEnabled();
// enabled.
bool NeedToCheckRedirectedURLForAcceptHeader();
// Returns true if Accept headers should be sent with
// "application/signed-exchange".
CONTENT_EXPORT bool ShouldAdvertiseAcceptHeader(const url::Origin& origin);
// Returns true when SignedHTTPExchange feature or SignedHTTPExchangeOriginTrial
// feature is enabled.
bool IsSignedExchangeHandlingEnabled();
// Returns true when the response should be handled as a signed exchange by // Returns true when the response should be handled as a signed exchange by
// checking the mime type and the feature flags. When SignedHTTPExchange feature // checking the mime type and the feature flags.
// is not enabled and SignedHTTPExchangeOriginTrial feature is enabled, this
// method also checks the Origin Trial header.
bool ShouldHandleAsSignedHTTPExchange( bool ShouldHandleAsSignedHTTPExchange(
const GURL& request_url, const GURL& request_url,
const network::ResourceResponseHead& head); const network::ResourceResponseHead& head);
......
...@@ -443,17 +443,6 @@ const base::Feature kSignedExchangeReportingForDistributors{ ...@@ -443,17 +443,6 @@ const base::Feature kSignedExchangeReportingForDistributors{
const base::Feature kSignedHTTPExchange{"SignedHTTPExchange", const base::Feature kSignedHTTPExchange{"SignedHTTPExchange",
base::FEATURE_ENABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
// Send "Accept: application/signed-exchange" header to origins who opt-in.
const base::Feature kSignedHTTPExchangeAcceptHeader{
"SignedHTTPExchangeAcceptHeader", base::FEATURE_DISABLED_BY_DEFAULT};
// Field trial parameter containing the list of origins that opted-in to receive
// "Accept: application/signed-exchange" header.
const char kSignedHTTPExchangeAcceptHeaderFieldTrialParamName[] = "OriginsList";
// Origin Trial of Origin-Signed HTTP Exchanges (for WebPackage Loading)
const base::Feature kSignedHTTPExchangeOriginTrial{
"SignedHTTPExchangeOriginTrial", base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether SpareRenderProcessHostManager tries to always have a warm // Controls whether SpareRenderProcessHostManager tries to always have a warm
// spare renderer process around for the most recently requested BrowserContext. // spare renderer process around for the most recently requested BrowserContext.
// This feature is only consulted in site-per-process mode. // This feature is only consulted in site-per-process mode.
......
...@@ -104,10 +104,6 @@ CONTENT_EXPORT extern const base::Feature kSharedArrayBuffer; ...@@ -104,10 +104,6 @@ CONTENT_EXPORT extern const base::Feature kSharedArrayBuffer;
CONTENT_EXPORT extern const base::Feature CONTENT_EXPORT extern const base::Feature
kSignedExchangeReportingForDistributors; kSignedExchangeReportingForDistributors;
CONTENT_EXPORT extern const base::Feature kSignedHTTPExchange; CONTENT_EXPORT extern const base::Feature kSignedHTTPExchange;
CONTENT_EXPORT extern const base::Feature kSignedHTTPExchangeAcceptHeader;
CONTENT_EXPORT extern const char
kSignedHTTPExchangeAcceptHeaderFieldTrialParamName[];
CONTENT_EXPORT extern const base::Feature kSignedHTTPExchangeOriginTrial;
CONTENT_EXPORT extern const base::Feature kSkipBrowserTouchFilter; CONTENT_EXPORT extern const base::Feature kSkipBrowserTouchFilter;
CONTENT_EXPORT extern const char kSkipBrowserTouchFilterTypeParamName[]; CONTENT_EXPORT extern const char kSkipBrowserTouchFilterTypeParamName[];
CONTENT_EXPORT extern const char CONTENT_EXPORT extern const char
......
...@@ -1681,7 +1681,6 @@ test("content_unittests") { ...@@ -1681,7 +1681,6 @@ test("content_unittests") {
"../browser/web_contents/web_drag_dest_mac_unittest.mm", "../browser/web_contents/web_drag_dest_mac_unittest.mm",
"../browser/web_contents/web_drag_source_mac_unittest.mm", "../browser/web_contents/web_drag_source_mac_unittest.mm",
"../browser/web_package/http_structured_header_unittest.cc", "../browser/web_package/http_structured_header_unittest.cc",
"../browser/web_package/origins_list_unittest.cc",
"../browser/web_package/signed_exchange_cert_fetcher_unittest.cc", "../browser/web_package/signed_exchange_cert_fetcher_unittest.cc",
"../browser/web_package/signed_exchange_certificate_chain_unittest.cc", "../browser/web_package/signed_exchange_certificate_chain_unittest.cc",
"../browser/web_package/signed_exchange_envelope_unittest.cc", "../browser/web_package/signed_exchange_envelope_unittest.cc",
......
...@@ -632,18 +632,6 @@ ...@@ -632,18 +632,6 @@
"base": "external/wpt/signed-exchange", "base": "external/wpt/signed-exchange",
"args": ["--enable-features=NetworkService"] "args": ["--enable-features=NetworkService"]
}, },
{
"prefix": "sxg-origin-trial",
"base": "http/tests/loading/sxg",
"args": ["--stable-release-mode",
"--enable-features=SignedHTTPExchangeOriginTrial"]
},
{
"prefix": "sxg-origin-trial-with-network-service",
"base": "http/tests/loading/sxg",
"args": ["--stable-release-mode",
"--enable-features=SignedHTTPExchangeOriginTrial,NetworkService"]
},
{ {
"prefix": "disabled-service-worker-servicification", "prefix": "disabled-service-worker-servicification",
"base": "http/tests/serviceworker", "base": "http/tests/serviceworker",
......
<?php
header('HTTP/1.0 200 OK');
// generate_token.py http://127.0.0.1:8000 SignedHTTPExchangeOriginTrial --expire-timestamp=2000000000
header("Origin-Trial: AqVs+066F+i9lgx2N0bCs5B31heTh9PJOfVM00yDS34V3FqBzWCuI3VKOpHPDeeujnaqJRVPHG8q+jBXjPNoLwkAAABleyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiU2lnbmVkSFRUUEV4Y2hhbmdlT3JpZ2luVHJpYWwiLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0=");
header("Content-Type: application/signed-exchange;v=b3");
$name = 'sxg-location.sxg';
$fp = fopen($name, 'rb');
header("Content-Length: " . filesize($name));
fpassthru($fp);
?>
<!DOCTYPE html>
<title>Location of SignedHTTPExchange with Origin-Trial header after redirect</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="./resources/sxg-util.js"></script>
<body>
<script>
promise_test(async (t) => {
await waitUntilDidFinishLoadForFrame;
const url =
'http://localhost:8000/resources/redirect.php?url=' +
encodeURIComponent(
'http://127.0.0.1:8000/loading/sxg/resources/sxg-location-origin-trial.php');
const message = await openSXGInIframeAndWaitForMessage(t, url);
assert_equals(message.location, 'https://127.0.0.1:8443/loading/sxg/resources/inner-url.html');
assert_false(message.is_fallback);
}, 'Location of SignedHTTPExchange with Origin-Trial header after redirect');
</script>
</body>
<!DOCTYPE html>
<title>Location of SignedHTTPExchange with Origin-Trial header</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="./resources/sxg-util.js"></script>
<body>
<script>
promise_test(async (t) => {
await waitUntilDidFinishLoadForFrame;
const message = await openSXGInIframeAndWaitForMessage(t, 'resources/sxg-location-origin-trial.php');
assert_equals(message.location, 'https://127.0.0.1:8443/loading/sxg/resources/inner-url.html');
assert_false(message.is_fallback);
}, 'Location of SignedHTTPExchange with Origin-Trial header');
</script>
</body>
This directory is for testing the SignedHTTPExchangeOriginTrial feature.
This suite runs the tests with --stable-release-mode, with which we
run tests with only stable feature (no experiments).
This directory is for testing the SignedHTTPExchangeOriginTrial feature.
This suite runs the tests with --stable-release-mode, with which we
run tests with only stable feature (no experiments).
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