Commit 76e1afb7 authored by Yoav Weiss's avatar Yoav Weiss Committed by Commit Bot

[ua-ch] Turn on feature flags

This CL turns on the feature flags for User-Agent Client Hints, as well
as the Client Hints Feature Policy infrastructure.

I2S: [1]
One test [2] was impacted by a combination of this change and an issue
related to the Client Hints infrastructure (but not to this change
in particular).

It is being tracked in [3] and fixed by [4], which we'll rebase and
land once this CL lands (and both change the test).


Bug: 928669
Change-Id: I0056827b739b0f6773a49fc8cffe456e5de21803

[1] https://groups.google.com/a/chromium.org/d/msg/blink-dev/A4wxFpvqUfA/g7iccl9ICgAJ
[2] https://chromium-review.googlesource.com/c/chromium/src/+/2199266/8/chrome/browser/client_hints/client_hints_browsertest.cc#1879
[3] https://bugs.chromium.org/p/chromium/issues/detail?id=1082674
[4] https://chromium-review.googlesource.com/c/chromium/src/+/2201976

Change-Id: I0056827b739b0f6773a49fc8cffe456e5de21803
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199266Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768910}
parent 920d0e24
......@@ -148,28 +148,6 @@ class BetterSessionRestoreTest : public InProcessBrowserTest {
return true;
}
if (path == path_prefix + "accept_ch.html") {
std::string header =
"HTTP/1.1 200 OK\nContent-type: text/html\nAccept-CH: "
"device-memory\n\n";
if (params->url_request.url.query().find("lifetime") !=
std::string::npos)
header += "Accept-CH-Lifetime: 10000\n";
header += "\n";
// Make title consistent with other tests
std::string title = "<html><head><title>";
if (params->url_request.headers.HasHeader("device-memory"))
title += "PASS";
else
title += "STORING";
title += "</title></head><body>Data posted</body></html>";
content::URLLoaderInterceptor::WriteResponse(
header, title, params->client.get());
return true;
}
return false;
}));
}
......@@ -878,50 +856,4 @@ IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, SessionCookiesBrowserClose) {
StoreDataWithPage(new_browser, "session_cookies.html");
}
// These tests ensure that the Better Session Restore features are not triggered
// when they shouldn't be.
class NoClientHintRestoreTest : public NoSessionRestoreTest {
public:
NoClientHintRestoreTest() {
scoped_feature_list_.InitWithFeatureList(EnabledFeatures());
}
std::unique_ptr<base::FeatureList> EnabledFeatures() {
std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
feature_list->InitializeFromCommandLine("FeaturePolicyForClientHints", "");
return feature_list;
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(NoClientHintRestoreTest);
};
IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest,
PersistClientHintsCloseAllBrowsers) {
SetSecureFakeServerAddress();
// Without the feature, the lifetime is needed to persist opt-in preferences.
StoreDataWithPage("accept_ch.html?lifetime");
NavigateAndCheckStoredData("accept_ch.html?lifetime");
EnableBackgroundMode();
Browser* new_browser = QuitBrowserAndRestore(browser(), true);
NavigateAndCheckStoredData(new_browser, "accept_ch.html?lifetime");
DisableBackgroundMode();
new_browser = QuitBrowserAndRestore(new_browser, true);
NavigateAndCheckStoredData(new_browser, "accept_ch.html?lifetime");
}
IN_PROC_BROWSER_TEST_F(NoClientHintRestoreTest,
ClearClientHintsCloseAllBrowsers) {
SetSecureFakeServerAddress();
StoreDataWithPage("accept_ch.html");
NavigateAndCheckStoredData("accept_ch.html");
EnableBackgroundMode();
Browser* new_browser = QuitBrowserAndRestore(browser(), true);
StoreDataWithPage(new_browser, "accept_ch.html");
DisableBackgroundMode();
new_browser = QuitBrowserAndRestore(new_browser, true);
StoreDataWithPage(new_browser, "accept_ch.html");
}
#endif // BUILDFLAG(ENABLE_BACKGROUND_MODE)
......@@ -199,7 +199,7 @@ const base::Feature kExtraSafelistedRequestHeadersForOutOfBlinkCors{
// Controls whether Client Hints are guarded by FeaturePolicy.
const base::Feature kFeaturePolicyForClientHints{
"FeaturePolicyForClientHints", base::FEATURE_DISABLED_BY_DEFAULT};
"FeaturePolicyForClientHints", base::FEATURE_ENABLED_BY_DEFAULT};
// When enabled Feature Policy propagation is similar to sandbox flags and,
// sandbox flags are implemented on top of Feature Policy.
......@@ -681,7 +681,7 @@ const base::Feature kUserActivationSameOriginVisibility{
// An experimental replacement for the `User-Agent` header, defined in
// https://tools.ietf.org/html/draft-west-ua-client-hints.
const base::Feature kUserAgentClientHint{"UserAgentClientHint",
base::FEATURE_DISABLED_BY_DEFAULT};
base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether the <video>.getVideoPlaybackQuality() API is enabled.
const base::Feature kVideoPlaybackQuality{"VideoPlaybackQuality",
......
......@@ -1934,6 +1934,8 @@ void DocumentLoader::ParseAndPersistClientHints(
return;
// Do not persist client hint preferences if the JavaScript is disabled.
// TODO(yoav): this seems buggy, and settings doesn't seem notified in
// ClientHintBrowserTest.ClientHintsNoLifetimeScriptNotAllowed.
bool allow_script = frame_->GetSettings()->GetScriptEnabled();
if (!settings_client->AllowScriptFromSource(allow_script, url))
return;
......
......@@ -744,7 +744,7 @@
},
{
name: "FeaturePolicyForClientHints",
status: "experimental",
status: "stable",
},
{
name: "FeaturePolicyForSandbox",
......@@ -1818,7 +1818,7 @@
},
{
name: "UserAgentClientHint",
status: "experimental"
status: "stable"
},
{
name: "UseWindowsSystemColors",
......
......@@ -56,6 +56,9 @@ PASS window.cached_navigator_usb.onconnect is null
PASS window.cached_navigator_usb.ondisconnect is null
PASS window.cached_navigator_userActivation.hasBeenActive is false
PASS window.cached_navigator_userActivation.isActive is false
PASS window.cached_navigator_userAgentData.brands[0].brand is ''
PASS window.cached_navigator_userAgentData.brands[0].version is ''
PASS window.cached_navigator_userAgentData.mobile is false
PASS window.cached_navigator_xr.ondevicechange is null
PASS window.cached_performance.onresourcetimingbufferfull is null
PASS window.cached_performance_navigation.redirectCount is 0
......
......@@ -56,6 +56,9 @@ PASS window.cached_navigator_usb.onconnect is null
PASS window.cached_navigator_usb.ondisconnect is null
PASS window.cached_navigator_userActivation.hasBeenActive is false
PASS window.cached_navigator_userActivation.isActive is false
PASS window.cached_navigator_userAgentData.brands[0].brand is ''
PASS window.cached_navigator_userAgentData.brands[0].version is ''
PASS window.cached_navigator_userAgentData.mobile is false
PASS window.cached_navigator_xr.ondevicechange is null
PASS window.cached_performance.onresourcetimingbufferfull is null
PASS window.cached_performance_navigation.redirectCount is 0
......
......@@ -56,6 +56,9 @@ PASS window.cached_navigator_usb.onconnect is null
PASS window.cached_navigator_usb.ondisconnect is null
PASS window.cached_navigator_userActivation.hasBeenActive is false
PASS window.cached_navigator_userActivation.isActive is false
PASS window.cached_navigator_userAgentData.brands[0].brand is ''
PASS window.cached_navigator_userAgentData.brands[0].version is ''
PASS window.cached_navigator_userAgentData.mobile is false
PASS window.cached_navigator_xr.ondevicechange is null
PASS window.cached_performance.onresourcetimingbufferfull is null
PASS window.cached_performance_navigation.redirectCount is 0
......
......@@ -63,6 +63,9 @@ PASS oldChildWindow.navigator.usb.ondisconnect is newChildWindow.navigator.usb.o
PASS oldChildWindow.navigator.userActivation.hasBeenActive is newChildWindow.navigator.userActivation.hasBeenActive
PASS oldChildWindow.navigator.userActivation.isActive is newChildWindow.navigator.userActivation.isActive
PASS oldChildWindow.navigator.userAgent is newChildWindow.navigator.userAgent
PASS oldChildWindow.navigator.userAgentData.brands[0].brand is newChildWindow.navigator.userAgentData.brands[0].brand
PASS oldChildWindow.navigator.userAgentData.brands[0].version is newChildWindow.navigator.userAgentData.brands[0].version
PASS oldChildWindow.navigator.userAgentData.mobile is newChildWindow.navigator.userAgentData.mobile
PASS oldChildWindow.navigator.vendor is newChildWindow.navigator.vendor
PASS oldChildWindow.navigator.vendorSub is newChildWindow.navigator.vendorSub
PASS oldChildWindow.navigator.xr.ondevicechange is newChildWindow.navigator.xr.ondevicechange
......
......@@ -14,6 +14,8 @@ Http headers:
HTTP_CONNECTION = keep-alive
HTTP_HOST = localhost:8080
HTTP_REFERER = http://127.0.0.1:8000/navigation/form-targets-cross-site-frame-get.html
HTTP_SEC_CH_UA = "content_shell";v="999"
HTTP_SEC_CH_UA_MOBILE = ?0
HTTP_SEC_FETCH_DEST = iframe
HTTP_SEC_FETCH_MODE = navigate
HTTP_SEC_FETCH_SITE = cross-site
......
......@@ -15,6 +15,8 @@ HTTP_CACHE_CONTROL = max-age=0
HTTP_CONNECTION = keep-alive
HTTP_HOST = localhost:8080
HTTP_ORIGIN = null
HTTP_SEC_CH_UA = "content_shell";v="999"
HTTP_SEC_CH_UA_MOBILE = ?0
HTTP_SEC_FETCH_DEST = iframe
HTTP_SEC_FETCH_MODE = navigate
HTTP_SEC_FETCH_SITE = cross-site
......
......@@ -16,6 +16,8 @@ HTTP_CONNECTION = keep-alive
HTTP_HOST = localhost:8080
HTTP_ORIGIN = http://127.0.0.1:8000
HTTP_REFERER = http://127.0.0.1:8000/navigation/form-targets-cross-site-frame-post.html
HTTP_SEC_CH_UA = "content_shell";v="999"
HTTP_SEC_CH_UA_MOBILE = ?0
HTTP_SEC_FETCH_DEST = iframe
HTTP_SEC_FETCH_MODE = navigate
HTTP_SEC_FETCH_SITE = cross-site
......
......@@ -16,6 +16,8 @@ HTTP_CONNECTION = keep-alive
HTTP_HOST = localhost:8080
HTTP_ORIGIN = http://127.0.0.1:8000
HTTP_REFERER = http://127.0.0.1:8000/navigation/form-with-enctype-targets-cross-site-frame.html
HTTP_SEC_CH_UA = "content_shell";v="999"
HTTP_SEC_CH_UA_MOBILE = ?0
HTTP_SEC_FETCH_DEST = iframe
HTTP_SEC_FETCH_MODE = navigate
HTTP_SEC_FETCH_SITE = cross-site
......
......@@ -12,6 +12,8 @@ HTTP_CONNECTION = keep-alive
HTTP_HOST = 127.0.0.1:8000
HTTP_ORIGIN = http://127.0.0.1:8000
HTTP_REFERER = http://127.0.0.1:8000/navigation/resources/page-that-posts.html
HTTP_SEC_CH_UA = "content_shell";v="999"
HTTP_SEC_CH_UA_MOBILE = ?0
HTTP_SEC_FETCH_DEST = document
HTTP_SEC_FETCH_MODE = navigate
HTTP_SEC_FETCH_SITE = same-origin
......
......@@ -17,6 +17,8 @@ HTTP_CONNECTION = keep-alive
HTTP_HOST = 127.0.0.1:8000
HTTP_ORIGIN = http://127.0.0.1:8000
HTTP_REFERER = http://127.0.0.1:8000/navigation/resources/page-that-posts.html
HTTP_SEC_CH_UA = "content_shell";v="999"
HTTP_SEC_CH_UA_MOBILE = ?0
HTTP_SEC_FETCH_DEST = iframe
HTTP_SEC_FETCH_MODE = navigate
HTTP_SEC_FETCH_SITE = same-origin
......
......@@ -16,6 +16,8 @@ HTTP_CONNECTION = keep-alive
HTTP_HOST = 127.0.0.1:8000
HTTP_ORIGIN = http://127.0.0.1:8000
HTTP_REFERER = http://127.0.0.1:8000/navigation/post-frames-goback1.html
HTTP_SEC_CH_UA = "content_shell";v="999"
HTTP_SEC_CH_UA_MOBILE = ?0
HTTP_SEC_FETCH_DEST = iframe
HTTP_SEC_FETCH_MODE = navigate
HTTP_SEC_FETCH_SITE = same-origin
......
......@@ -12,6 +12,8 @@ HTTP_CONNECTION = keep-alive
HTTP_HOST = 127.0.0.1:8000
HTTP_ORIGIN = http://127.0.0.1:8000
HTTP_REFERER = http://127.0.0.1:8000/navigation/resources/page-that-posts.html
HTTP_SEC_CH_UA = "content_shell";v="999"
HTTP_SEC_CH_UA_MOBILE = ?0
HTTP_SEC_FETCH_DEST = document
HTTP_SEC_FETCH_MODE = navigate
HTTP_SEC_FETCH_SITE = same-origin
......
......@@ -20,6 +20,8 @@ HTTP_CONNECTION = keep-alive
HTTP_HOST = 127.0.0.1:8000
HTTP_ORIGIN = http://127.0.0.1:8000
HTTP_REFERER = http://127.0.0.1:8000/navigation/resources/page-that-posts.html
HTTP_SEC_CH_UA = "content_shell";v="999"
HTTP_SEC_CH_UA_MOBILE = ?0
HTTP_SEC_FETCH_DEST = iframe
HTTP_SEC_FETCH_MODE = navigate
HTTP_SEC_FETCH_SITE = same-origin
......
......@@ -742,6 +742,12 @@ interface NavigationPreloadManager
method enable
method getState
method setHeaderValue
interface NavigatorUAData
attribute @@toStringTag
getter brands
getter mobile
method constructor
method getHighEntropyValues
interface NetworkInformation : EventTarget
attribute @@toStringTag
getter downlink
......@@ -2668,6 +2674,7 @@ interface WorkerNavigator
getter storage
getter usb
getter userAgent
getter userAgentData
method clearAppBadge
method constructor
method setAppBadge
......
......@@ -4,6 +4,21 @@ All changes to this list should go through Blink's feature review process: http:
accelerometer
autoplay
camera
ch-device-memory
ch-downlink
ch-dpr
ch-ect
ch-lang
ch-rtt
ch-ua
ch-ua-arch
ch-ua-full-version
ch-ua-mobile
ch-ua-model
ch-ua-platform
ch-ua-platform-version
ch-viewport-width
ch-width
document-domain
encrypted-media
fullscreen
......
......@@ -700,6 +700,12 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] method enable
[Worker] method getState
[Worker] method setHeaderValue
[Worker] interface NavigatorUAData
[Worker] attribute @@toStringTag
[Worker] getter brands
[Worker] getter mobile
[Worker] method constructor
[Worker] method getHighEntropyValues
[Worker] interface NetworkInformation : EventTarget
[Worker] attribute @@toStringTag
[Worker] getter downlink
......@@ -2684,6 +2690,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] getter storage
[Worker] getter usb
[Worker] getter userAgent
[Worker] getter userAgentData
[Worker] method constructor
[Worker] interface WritableStream
[Worker] attribute @@toStringTag
......
......@@ -4556,6 +4556,7 @@ interface Navigator
getter usb
getter userActivation
getter userAgent
getter userAgentData
getter vendor
getter vendorSub
getter wakeLock
......@@ -4577,6 +4578,12 @@ interface Navigator
method unregisterProtocolHandler
method vibrate
method webkitGetUserMedia
interface NavigatorUAData
attribute @@toStringTag
getter brands
getter mobile
method constructor
method getHighEntropyValues
interface NetworkInformation : EventTarget
attribute @@toStringTag
getter downlink
......
......@@ -695,6 +695,12 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] method enable
[Worker] method getState
[Worker] method setHeaderValue
[Worker] interface NavigatorUAData
[Worker] attribute @@toStringTag
[Worker] getter brands
[Worker] getter mobile
[Worker] method constructor
[Worker] method getHighEntropyValues
[Worker] interface NetworkInformation : EventTarget
[Worker] attribute @@toStringTag
[Worker] getter downlink
......@@ -2571,6 +2577,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] getter storage
[Worker] getter usb
[Worker] getter userAgent
[Worker] getter userAgentData
[Worker] method constructor
[Worker] interface WritableStream
[Worker] attribute @@toStringTag
......
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