From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/client-hints/META.yml | 5 + .../tests/client-hints/accept-ch-change.https.html | 67 +++++++++++ .../accept-ch-malformed-header.https.html | 24 ++++ .../accept-ch-malformed-header.https.html.headers | 1 + .../client-hints/accept-ch-stickiness/README.md | 14 +++ ...gin-iframe-not-setting-other-origins.https.html | 19 +++ ...origin-iframe-not-setting-own-origin.https.html | 19 +++ ...n-iframe-redirect-with-fp-delegation.https.html | 18 +++ ...-redirect-with-fp-delegation.https.html.headers | 2 + .../cross-origin-navigation-redirect.https.html | 18 +++ ...s-origin-navigation-redirect.https.html.headers | 1 + .../cross-origin-navigation.https.html | 19 +++ ...resource-redirect-with-fp-delegation.https.html | 17 +++ ...-redirect-with-fp-delegation.https.html.headers | 2 + .../cross-origin-subresource-redirect.https.html | 17 +++ ...-origin-subresource-redirect.https.html.headers | 1 + ...igin-subresource-with-feature-policy.https.html | 19 +++ .../cross-origin-subresource.https.html | 19 +++ .../cross-origin-syncxhr-redirect.https.html | 17 +++ ...ross-origin-syncxhr-redirect.https.html.headers | 1 + ...gin-iframe-not-setting-other-origins.https.html | 19 +++ ...origin-iframe-not-setting-own-origin.https.html | 19 +++ .../http-equiv-cross-origin-navigation.https.html | 19 +++ .../http-equiv-cross-origin-subresource.https.html | 19 +++ .../http-equiv-same-origin-iframe.https.html | 19 +++ .../http-equiv-same-origin-navigation.https.html | 19 +++ .../http-equiv-same-origin-subresource.https.html | 19 +++ ...gin-iframe-not-setting-other-origins.https.html | 19 +++ ...origin-iframe-not-setting-own-origin.https.html | 19 +++ .../meta-equiv-cross-origin-navigation.https.html | 19 +++ .../meta-equiv-cross-origin-subresource.https.html | 19 +++ ...h-cross-origin-iframe-with-hints.https.sub.html | 18 +++ ...ross-origin-iframe-without-hints.https.sub.html | 18 +++ ...ss-origin-subresource-with-hints.https.sub.html | 18 +++ ...origin-subresource-without-hints.https.sub.html | 18 +++ .../meta-equiv-same-origin-iframe.https.html | 19 +++ .../meta-equiv-same-origin-navigation.https.html | 19 +++ .../meta-equiv-same-origin-subresource.https.html | 19 +++ .../resources/accept-ch-and-redir.py | 5 + .../resources/accept-ch-blank.html | 11 ++ .../resources/accept-ch-blank.html.headers | 2 + .../resources/accept-ch-test.js | 133 +++++++++++++++++++++ .../accept-ch-stickiness/resources/accept-ch.html | 16 +++ .../resources/accept-ch.html.headers | 2 + .../resources/clear-site-data.html | 0 .../resources/clear-site-data.html.headers | 2 + .../resources/do-expect-received.py | 20 ++++ .../do-not-expect-client-hints-headers.html | 22 ++++ .../resources/do-not-expect-received.py | 20 ++++ .../resources/echo-client-hints-received.py | 14 +++ .../resources/expect-client-hints-headers.html | 22 ++++ .../resources/expect-received.py | 28 +++++ ...ature-policy-with-cross-origin-subresource.html | 25 ++++ ...licy-with-cross-origin-subresource.html.headers | 1 + .../resources/http-equiv-accept-ch.html | 8 ++ .../resources/http-equiv-accept-ch.html.headers | 2 + .../resources/meta-equiv-delegate-ch.html | 9 ++ .../resources/meta-equiv-delegate-ch.html.headers | 2 + .../resources/no-accept-ch.html | 11 ++ .../resources/no-accept-ch.html.headers | 1 + .../same-origin-iframe.https.html | 19 +++ ...me-origin-navigation-empty-accept-ch.https.html | 20 ++++ .../same-origin-navigation-no-accept-ch.https.html | 20 ++++ .../same-origin-navigation-redirect.https.html | 19 +++ .../same-origin-navigation.https.html | 19 +++ ...origin-subresource-redirect-opted-in.https.html | 17 +++ ...ubresource-redirect-opted-in.https.html.headers | 1 + .../same-origin-subresource-redirect.https.html | 18 +++ .../same-origin-subresource.https.html | 19 +++ .../tests/client-hints/accept-ch/__dir__.headers | 1 + .../client-hints/accept-ch/answers.sub.https.html | 68 +++++++++++ .../accept-ch/cache-revalidation.https.html | 36 ++++++ .../feature-policy-navigation/__dir__.headers | 1 + .../feature-policy.https.html | 29 +++++ .../feature-policy.https.html.headers | 1 + .../no-feature-policy.https.html | 36 ++++++ .../accept-ch/feature-policy.sub.https.html | 77 ++++++++++++ .../feature-policy.sub.https.html.headers | 1 + .../meta/resource-in-markup-accept-ch.https.html | 14 +++ .../meta/resource-in-markup-delegate-ch.https.html | 14 +++ .../accept-ch/no-feature-policy.sub.https.html | 65 ++++++++++ .../client-hints/accept-ch/non-secure.http.html | 38 ++++++ .../critical-ch/iframe.https.window.js | 8 ++ .../critical-ch/mis-matched-count.https.window.js | 4 + .../critical-ch/mis-matched.https.window.js | 3 + .../critical-ch/navigation.https.window.js | 3 + .../critical-ch/non-secure.http.window.js | 3 + .../critical-ch/request-count.https.window.js | 4 + .../critical-ch/resources/echo-critical-hint.py | 43 +++++++ .../client-hints/critical-ch/resources/util.js | 15 +++ .../critical-ch/subresource.https.window.js | 10 ++ .../critical-ch/unsafe-method.https.window.js | 23 ++++ .../http-equiv-accept-ch-iframe.https.html | 26 ++++ ...ttp-equiv-accept-ch-malformed-header.https.html | 31 +++++ .../http-equiv-accept-ch-merge.https.html | 49 ++++++++ .../http-equiv-accept-ch-merge.https.html.headers | 2 + .../http-equiv-accept-ch-non-secure.http.html | 39 ++++++ .../accept_ch_delegation_to_all.sub.https.html | 37 ++++++ ...ept_ch_delegation_to_all.sub.https.html.headers | 2 + .../accept_ch_delegation_to_none.sub.https.html | 36 ++++++ ...pt_ch_delegation_to_none.sub.https.html.headers | 2 + .../accept_ch_delegation_to_self.sub.https.html | 37 ++++++ ...pt_ch_delegation_to_self.sub.https.html.headers | 2 + .../accept_ch_delegation_to_some.sub.https.html | 37 ++++++ ...h_delegation_to_some.sub.https.html.sub.headers | 2 + .../accept_ch_delegation_to_src.sub.https.html | 37 ++++++ ...ept_ch_delegation_to_src.sub.https.html.headers | 2 + ...cept_ch_delegation_to_all_iframe.sub.https.html | 32 +++++ ..._delegation_to_all_iframe_iframe.sub.https.html | 23 ++++ ...ept_ch_delegation_to_none_iframe.sub.https.html | 32 +++++ ...delegation_to_none_iframe_iframe.sub.https.html | 23 ++++ ...ept_ch_delegation_to_self_iframe.sub.https.html | 32 +++++ ...delegation_to_self_iframe_iframe.sub.https.html | 23 ++++ ...ept_ch_delegation_to_some_iframe.sub.https.html | 32 +++++ ...elegation_to_some_iframe.sub.https.html.headers | 1 + ...delegation_to_some_iframe_iframe.sub.https.html | 23 ++++ ...o_some_iframe_iframe.sub.https.html.sub.headers | 1 + ...cept_ch_delegation_to_src_iframe.sub.https.html | 33 +++++ ..._delegation_to_src_iframe_iframe.sub.https.html | 23 ++++ .../resources/was-sec-ch-device-memory-received.py | 11 ++ .../meta-equiv-delegate-ch-iframe.https.html | 26 ++++ .../meta-equiv-delegate-ch-injection.https.html | 42 +++++++ ...a-equiv-delegate-ch-malformed-header.https.html | 32 +++++ .../meta-equiv-delegate-ch-merge.https.html | 50 ++++++++ ...meta-equiv-delegate-ch-merge.https.html.headers | 2 + .../meta-equiv-delegate-ch-non-secure.http.html | 40 +++++++ .../resources/accept-ch-different.html | 11 ++ .../resources/accept-ch-different.html.headers | 2 + .../client-hints/resources/accept-ch-empty.html | 11 ++ .../resources/accept-ch-empty.html.headers | 2 + .../resources/accept-ch-malformed.html | 11 ++ .../resources/accept-ch-malformed.html.headers | 2 + .../tests/client-hints/resources/accept-ch.html | 10 ++ .../client-hints/resources/accept-ch.html.headers | 2 + .../client-hints/resources/clienthintslist.py | 40 +++++++ .../resources/echo-client-hints-received.py | 36 ++++++ .../resources/echo-ua-client-hints-received.py | 23 ++++ .../expect-client-hints-headers-iframe.py | 31 +++++ .../resources/expect-client-hints-headers.html | 22 ++++ .../expect-different-client-hints-headers.html | 22 ++++ .../resources/expect-no-client-hints-headers.html | 24 ++++ .../tests/client-hints/resources/export.js | 49 ++++++++ .../resources/feature-policy-navigation.js | 72 +++++++++++ .../resources/open-and-add-load-event.js | 23 ++++ .../resources/script-set-dpr-header.py | 4 + .../tests/client-hints/resources/sec-ch-ua.py | 9 ++ .../resources/stale-echo-client-hints.py | 50 ++++++++ .../tests/client-hints/resources/viewport-frame.py | 25 ++++ .../resources/viewport-measurement.html | 8 ++ .../tests/client-hints/resources/viewport.py | 13 ++ .../tests/client-hints/sandbox/__dir__.headers | 1 + .../sandbox/iframe-csp-same-origin.https.html | 19 +++ .../iframe-csp-same-origin.https.html.headers | 1 + .../client-hints/sandbox/iframe-csp.https.html | 19 +++ .../sandbox/iframe-csp.https.html.headers | 1 + .../sandbox/iframe-iframe-popups.https.html | 19 +++ .../iframe-popups-escape-sandbox.https.html | 19 +++ .../client-hints/sandbox/iframe-popups.https.html | 19 +++ .../sandbox/iframe-same-origin.https.html | 17 +++ .../tests/client-hints/sandbox/iframe.https.html | 19 +++ .../resources/embedded-popup-expect-hints.html | 11 ++ .../resources/embedded-popup-expect-no-hints.html | 11 ++ ...iframe-with-embedded-popup-expect-no-hints.html | 12 ++ .../tests/client-hints/sandbox/resources/util.js | 25 ++++ .../tests/client-hints/sec-ch-quotes.https.html | 63 ++++++++++ .../client-hints/sec-ch-quotes.https.html.headers | 1 + .../tests/client-hints/sec-ch-ua.http.html | 16 +++ .../tests/client-hints/sec-ch-ua.https.html | 50 ++++++++ .../critical-ch/echo-hint-in-html.py | 24 ++++ .../service-workers/critical-ch/foo.html | 1 + .../service-workers/critical-ch/foo.html.headers | 2 + .../critical-ch/intercept-request.js | 6 + .../critical-ch/navigation-preload.js | 2 + .../service-workers/critical-ch/new-request.js | 3 + .../critical-ch/passthrough-request.js | 1 + .../intercept-request-critical.https.window.js | 5 + .../service-workers/intercept-request.https.html | 11 ++ .../intercept-request.https.html.headers | 1 + .../navigation-preload-critical.https.window.js | 5 + .../service-workers/navigation-preload.https.html | 11 ++ .../navigation-preload.https.html.headers | 1 + .../new-request-critical.https.window.js | 5 + .../service-workers/new-request.https.html | 11 ++ .../service-workers/new-request.https.html.headers | 1 + .../passthrough-request-critical.https.window.js | 5 + .../service-workers/passthrough-request.https.html | 11 ++ .../passthrough-request.https.html.headers | 1 + .../service-workers/resources/echo-hint-in-html.py | 21 ++++ .../service-workers/resources/foo.html | 1 + .../service-workers/resources/intercept-request.js | 6 + .../resources/navigation-preload.js | 2 + .../service-workers/resources/new-request.js | 3 + .../resources/passthrough-request.js | 1 + .../client-hints/service-workers/resources/util.js | 23 ++++ .../viewport-size/viewport-size-iframe.https.html | 17 +++ .../viewport-size-iframe.https.html.headers | 1 + .../viewport-size-subresource.https.html | 16 +++ .../viewport-size-subresource.https.html.headers | 1 + ...ort-size-window-different-dimensions.https.html | 17 +++ ...-window-different-dimensions.https.html.headers | 1 + .../viewport-size/viewport-size-window.https.html | 17 +++ .../viewport-size-window.https.html.headers | 1 + 202 files changed, 3525 insertions(+) create mode 100644 testing/web-platform/tests/client-hints/META.yml create mode 100644 testing/web-platform/tests/client-hints/accept-ch-change.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-malformed-header.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-malformed-header.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/README.md create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-not-setting-other-origins.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-not-setting-own-origin.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-redirect-with-fp-delegation.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-redirect-with-fp-delegation.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation-redirect.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation-redirect.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect-with-fp-delegation.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect-with-fp-delegation.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-with-feature-policy.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-syncxhr-redirect.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-syncxhr-redirect.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-iframe-not-setting-other-origins.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-iframe-not-setting-own-origin.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-navigation.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-subresource.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-iframe.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-navigation.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-subresource.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-iframe-not-setting-other-origins.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-iframe-not-setting-own-origin.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-navigation.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-subresource.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-with-hints.https.sub.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-without-hints.https.sub.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-with-hints.https.sub.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-without-hints.https.sub.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-iframe.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-navigation.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-subresource.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-and-redir.py create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-blank.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-blank.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-test.js create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/clear-site-data.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/clear-site-data.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-expect-received.py create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-not-expect-client-hints-headers.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-not-expect-received.py create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/expect-client-hints-headers.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/expect-received.py create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/no-accept-ch.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/no-accept-ch.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-iframe.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-empty-accept-ch.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-no-accept-ch.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-redirect.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect-opted-in.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect-opted-in.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch/__dir__.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch/answers.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch/cache-revalidation.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/__dir__.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/feature-policy.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/feature-policy.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/no-feature-policy.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/accept-ch/meta/resource-in-markup-accept-ch.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch/meta/resource-in-markup-delegate-ch.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch/no-feature-policy.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch/non-secure.http.html create mode 100644 testing/web-platform/tests/client-hints/critical-ch/iframe.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/mis-matched-count.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/mis-matched.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/navigation.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/non-secure.http.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/request-count.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/resources/echo-critical-hint.py create mode 100644 testing/web-platform/tests/client-hints/critical-ch/resources/util.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/subresource.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/unsafe-method.https.window.js create mode 100644 testing/web-platform/tests/client-hints/http-equiv-accept-ch-iframe.https.html create mode 100644 testing/web-platform/tests/client-hints/http-equiv-accept-ch-malformed-header.https.html create mode 100644 testing/web-platform/tests/client-hints/http-equiv-accept-ch-merge.https.html create mode 100644 testing/web-platform/tests/client-hints/http-equiv-accept-ch-merge.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/http-equiv-accept-ch-non-secure.http.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html.sub.headers create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html.sub.headers create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe_iframe.sub.https.html create mode 100644 testing/web-platform/tests/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py create mode 100644 testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-iframe.https.html create mode 100644 testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-injection.https.html create mode 100644 testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-malformed-header.https.html create mode 100644 testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-merge.https.html create mode 100644 testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-merge.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-non-secure.http.html create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch-different.html create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch-different.html.headers create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch-empty.html create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch-empty.html.headers create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch-malformed.html create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch-malformed.html.headers create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch.html create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch.html.headers create mode 100644 testing/web-platform/tests/client-hints/resources/clienthintslist.py create mode 100644 testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py create mode 100644 testing/web-platform/tests/client-hints/resources/echo-ua-client-hints-received.py create mode 100644 testing/web-platform/tests/client-hints/resources/expect-client-hints-headers-iframe.py create mode 100644 testing/web-platform/tests/client-hints/resources/expect-client-hints-headers.html create mode 100644 testing/web-platform/tests/client-hints/resources/expect-different-client-hints-headers.html create mode 100644 testing/web-platform/tests/client-hints/resources/expect-no-client-hints-headers.html create mode 100644 testing/web-platform/tests/client-hints/resources/export.js create mode 100644 testing/web-platform/tests/client-hints/resources/feature-policy-navigation.js create mode 100644 testing/web-platform/tests/client-hints/resources/open-and-add-load-event.js create mode 100644 testing/web-platform/tests/client-hints/resources/script-set-dpr-header.py create mode 100644 testing/web-platform/tests/client-hints/resources/sec-ch-ua.py create mode 100644 testing/web-platform/tests/client-hints/resources/stale-echo-client-hints.py create mode 100644 testing/web-platform/tests/client-hints/resources/viewport-frame.py create mode 100644 testing/web-platform/tests/client-hints/resources/viewport-measurement.html create mode 100644 testing/web-platform/tests/client-hints/resources/viewport.py create mode 100644 testing/web-platform/tests/client-hints/sandbox/__dir__.headers create mode 100644 testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/sandbox/iframe-iframe-popups.https.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/iframe-popups-escape-sandbox.https.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/iframe-popups.https.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/iframe-same-origin.https.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/iframe.https.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-hints.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-no-hints.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/resources/iframe-with-embedded-popup-expect-no-hints.html create mode 100644 testing/web-platform/tests/client-hints/sandbox/resources/util.js create mode 100644 testing/web-platform/tests/client-hints/sec-ch-quotes.https.html create mode 100644 testing/web-platform/tests/client-hints/sec-ch-quotes.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/sec-ch-ua.http.html create mode 100644 testing/web-platform/tests/client-hints/sec-ch-ua.https.html create mode 100644 testing/web-platform/tests/client-hints/service-workers/critical-ch/echo-hint-in-html.py create mode 100644 testing/web-platform/tests/client-hints/service-workers/critical-ch/foo.html create mode 100644 testing/web-platform/tests/client-hints/service-workers/critical-ch/foo.html.headers create mode 100644 testing/web-platform/tests/client-hints/service-workers/critical-ch/intercept-request.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/critical-ch/navigation-preload.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/critical-ch/new-request.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/critical-ch/passthrough-request.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/intercept-request-critical.https.window.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/intercept-request.https.html create mode 100644 testing/web-platform/tests/client-hints/service-workers/intercept-request.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/service-workers/navigation-preload-critical.https.window.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/navigation-preload.https.html create mode 100644 testing/web-platform/tests/client-hints/service-workers/navigation-preload.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/service-workers/new-request-critical.https.window.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/new-request.https.html create mode 100644 testing/web-platform/tests/client-hints/service-workers/new-request.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/service-workers/passthrough-request-critical.https.window.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/passthrough-request.https.html create mode 100644 testing/web-platform/tests/client-hints/service-workers/passthrough-request.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/service-workers/resources/echo-hint-in-html.py create mode 100644 testing/web-platform/tests/client-hints/service-workers/resources/foo.html create mode 100644 testing/web-platform/tests/client-hints/service-workers/resources/intercept-request.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/resources/navigation-preload.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/resources/new-request.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/resources/passthrough-request.js create mode 100644 testing/web-platform/tests/client-hints/service-workers/resources/util.js create mode 100644 testing/web-platform/tests/client-hints/viewport-size/viewport-size-iframe.https.html create mode 100644 testing/web-platform/tests/client-hints/viewport-size/viewport-size-iframe.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/viewport-size/viewport-size-subresource.https.html create mode 100644 testing/web-platform/tests/client-hints/viewport-size/viewport-size-subresource.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/viewport-size/viewport-size-window-different-dimensions.https.html create mode 100644 testing/web-platform/tests/client-hints/viewport-size/viewport-size-window-different-dimensions.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/viewport-size/viewport-size-window.https.html create mode 100644 testing/web-platform/tests/client-hints/viewport-size/viewport-size-window.https.html.headers (limited to 'testing/web-platform/tests/client-hints') diff --git a/testing/web-platform/tests/client-hints/META.yml b/testing/web-platform/tests/client-hints/META.yml new file mode 100644 index 0000000000..68cbc4d4fa --- /dev/null +++ b/testing/web-platform/tests/client-hints/META.yml @@ -0,0 +1,5 @@ +spec: https://wicg.github.io/client-hints-infrastructure/ +suggested_reviewers: + - igrigorik + - yoavweiss + - tarunban diff --git a/testing/web-platform/tests/client-hints/accept-ch-change.https.html b/testing/web-platform/tests/client-hints/accept-ch-change.https.html new file mode 100644 index 0000000000..b0a4da61dd --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-change.https.html @@ -0,0 +1,67 @@ + + +Accept-CH test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-malformed-header.https.html b/testing/web-platform/tests/client-hints/accept-ch-malformed-header.https.html new file mode 100644 index 0000000000..649ecf9590 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-malformed-header.https.html @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-malformed-header.https.html.headers b/testing/web-platform/tests/client-hints/accept-ch-malformed-header.https.html.headers new file mode 100644 index 0000000000..81396b1e41 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-malformed-header.https.html.headers @@ -0,0 +1 @@ +Accept-CH: sec-ch-device-memory device-memory sec-ch-dpr dpr \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/README.md b/testing/web-platform/tests/client-hints/accept-ch-stickiness/README.md new file mode 100644 index 0000000000..7dd1c6ddaf --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/README.md @@ -0,0 +1,14 @@ +These tests all follow the same format, calling the `run_test` function from +`resources/accept_ch_test.js`. This function does the following: + + * checks to make sure no client-hint preferences are saved for a particular origin + * loading a page with the response header `Accept-CH: device-memory` via a + particular method: + * Navigation (via window.open) + * Subresource (via fetch) + * iframe (added via js) + * Navigates to another page to check if the device-memory client hint was sent + with the next request + +Each test is in a separate file to ensure that the browser and it's state is +properly reset between each test. diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-not-setting-other-origins.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-not-setting-other-origins.https.html new file mode 100644 index 0000000000..5316c2874c --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-not-setting-other-origins.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-not-setting-own-origin.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-not-setting-own-origin.https.html new file mode 100644 index 0000000000..f83aa6173e --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-not-setting-own-origin.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-redirect-with-fp-delegation.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-redirect-with-fp-delegation.https.html new file mode 100644 index 0000000000..a2bc66fca1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-redirect-with-fp-delegation.https.html @@ -0,0 +1,18 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-redirect-with-fp-delegation.https.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-redirect-with-fp-delegation.https.html.headers new file mode 100644 index 0000000000..f3f85f9eba --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-iframe-redirect-with-fp-delegation.https.html.headers @@ -0,0 +1,2 @@ +Accept-CH: Sec-CH-DPR, DPR, Sec-CH-Device-Memory, Device-Memory +Feature-Policy: ch-dpr *; ch-device-memory * diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation-redirect.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation-redirect.https.html new file mode 100644 index 0000000000..14ba51ab5d --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation-redirect.https.html @@ -0,0 +1,18 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation-redirect.https.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation-redirect.https.html.headers new file mode 100644 index 0000000000..af6945319d --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation-redirect.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-CH-DPR, DPR, Sec-CH-Device-Memory, Device-Memory diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation.https.html new file mode 100644 index 0000000000..e05c8e3ef5 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-navigation.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect-with-fp-delegation.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect-with-fp-delegation.https.html new file mode 100644 index 0000000000..dd7b9fab97 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect-with-fp-delegation.https.html @@ -0,0 +1,17 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect-with-fp-delegation.https.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect-with-fp-delegation.https.html.headers new file mode 100644 index 0000000000..ed41009784 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect-with-fp-delegation.https.html.headers @@ -0,0 +1,2 @@ +Accept-CH: Sec-CH-DPR, DPR, Sec-CH-Device-Memory, Device-Memory +Feature-Policy: ch-dpr *;ch-device-memory * diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect.https.html new file mode 100644 index 0000000000..31334543cf --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect.https.html @@ -0,0 +1,17 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect.https.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect.https.html.headers new file mode 100644 index 0000000000..af6945319d --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-redirect.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-CH-DPR, DPR, Sec-CH-Device-Memory, Device-Memory diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-with-feature-policy.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-with-feature-policy.https.html new file mode 100644 index 0000000000..3108c23faa --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource-with-feature-policy.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource.https.html new file mode 100644 index 0000000000..249ccb4a60 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-subresource.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-syncxhr-redirect.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-syncxhr-redirect.https.html new file mode 100644 index 0000000000..1cce664d2c --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-syncxhr-redirect.https.html @@ -0,0 +1,17 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-syncxhr-redirect.https.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-syncxhr-redirect.https.html.headers new file mode 100644 index 0000000000..af6945319d --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/cross-origin-syncxhr-redirect.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-CH-DPR, DPR, Sec-CH-Device-Memory, Device-Memory diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-iframe-not-setting-other-origins.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-iframe-not-setting-other-origins.https.html new file mode 100644 index 0000000000..226b3116fc --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-iframe-not-setting-other-origins.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-iframe-not-setting-own-origin.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-iframe-not-setting-own-origin.https.html new file mode 100644 index 0000000000..705b65a7bf --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-iframe-not-setting-own-origin.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-navigation.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-navigation.https.html new file mode 100644 index 0000000000..d2fa472015 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-navigation.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-subresource.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-subresource.https.html new file mode 100644 index 0000000000..7bb5d1520c --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-cross-origin-subresource.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-iframe.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-iframe.https.html new file mode 100644 index 0000000000..93380ad23c --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-iframe.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-navigation.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-navigation.https.html new file mode 100644 index 0000000000..6efd7ccdf5 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-navigation.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-subresource.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-subresource.https.html new file mode 100644 index 0000000000..793bf5e079 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/http-equiv-same-origin-subresource.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-iframe-not-setting-other-origins.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-iframe-not-setting-other-origins.https.html new file mode 100644 index 0000000000..9c4e9cf506 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-iframe-not-setting-other-origins.https.html @@ -0,0 +1,19 @@ + + +Meta cross origin iframe not setting other origins + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-iframe-not-setting-own-origin.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-iframe-not-setting-own-origin.https.html new file mode 100644 index 0000000000..26e30a40e7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-iframe-not-setting-own-origin.https.html @@ -0,0 +1,19 @@ + + +Meta cross origin iframe not setting own origin + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-navigation.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-navigation.https.html new file mode 100644 index 0000000000..eb2292b22f --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-navigation.https.html @@ -0,0 +1,19 @@ + + +Meta cross origin navigation + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-subresource.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-subresource.https.html new file mode 100644 index 0000000000..31775cbea2 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-cross-origin-subresource.https.html @@ -0,0 +1,19 @@ + + +Meta cross origin subresource + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-with-hints.https.sub.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-with-hints.https.sub.html new file mode 100644 index 0000000000..0a2c4897bc --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-with-hints.https.sub.html @@ -0,0 +1,18 @@ + + + +Meta-equiv Delegate-CH cross origin iframe with hints + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-without-hints.https.sub.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-without-hints.https.sub.html new file mode 100644 index 0000000000..b79a941237 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-without-hints.https.sub.html @@ -0,0 +1,18 @@ + + + +Meta-equiv Delegate-CH cross origin iframe without hints + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-with-hints.https.sub.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-with-hints.https.sub.html new file mode 100644 index 0000000000..bd39cbaff4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-with-hints.https.sub.html @@ -0,0 +1,18 @@ + + + +Meta-equiv Delegate-CH cross origin subresource with hints + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-without-hints.https.sub.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-without-hints.https.sub.html new file mode 100644 index 0000000000..20a3357fb6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-without-hints.https.sub.html @@ -0,0 +1,18 @@ + + + +Meta-equiv Delegate-CH cross origin subresource without hints + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-iframe.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-iframe.https.html new file mode 100644 index 0000000000..06a68ce3bc --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-iframe.https.html @@ -0,0 +1,19 @@ + + +Meta same origin iframe + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-navigation.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-navigation.https.html new file mode 100644 index 0000000000..10fb120fc2 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-navigation.https.html @@ -0,0 +1,19 @@ + + +Meta same origin navigation + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-subresource.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-subresource.https.html new file mode 100644 index 0000000000..b4374476c6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/meta-equiv-same-origin-subresource.https.html @@ -0,0 +1,19 @@ + + +Meta same origin subresource + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-and-redir.py b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-and-redir.py new file mode 100644 index 0000000000..16ab11faa7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-and-redir.py @@ -0,0 +1,5 @@ +def main(request, response): + url = b'' + if b'url' in request.GET: + url = request.GET[b'url'] + return 301, [(b'Location', url),(b'Accept-CH', b'sec-ch-device-memory, device-memory, Sec-CH-DPR, DPR')], u'' diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-blank.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-blank.html new file mode 100644 index 0000000000..8a2e40ad90 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-blank.html @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-blank.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-blank.html.headers new file mode 100644 index 0000000000..25215abdf7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-blank.html.headers @@ -0,0 +1,2 @@ +Accept-CH: +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-test.js b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-test.js new file mode 100644 index 0000000000..b0bf39250c --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch-test.js @@ -0,0 +1,133 @@ +const echo = "/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py"; +const accept = "/client-hints/accept-ch-stickiness/resources/accept-ch.html"; +const accept_blank = "/client-hints/accept-ch-stickiness/resources/accept-ch-blank.html"; +const no_accept = "/client-hints/accept-ch-stickiness/resources/no-accept-ch.html"; +const httpequiv_accept = "/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html"; +const metaequiv_delegate = "/client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.html"; +const expect = "/client-hints/accept-ch-stickiness/resources/expect-client-hints-headers.html" +const do_not_expect = "/client-hints/accept-ch-stickiness/resources/do-not-expect-client-hints-headers.html" + +const host_info = get_host_info(); + +function verify_initial_state(initial_url, test_name) { + promise_test(t => { + return fetch(initial_url).then(r => { + assert_equals(r.status, 200) + // Verify that the browser did not include client hints in the request + // headers when fetching echo-client-hints-received.py. + assert_false(r.headers.has("device-memory-received"), + "device-memory-received"); + assert_false(r.headers.has("device-memory-deprecated-received"), + "device-memory-deprecated-received"); + }); + }, test_name + " precondition: Test that the browser does not have client " + + "hints preferences cached"); +} + +function verify_iframe_state(expect_url, test_name) { + promise_test(t => { + return new Promise(resolve => { + window.addEventListener('message', t.step_func(function(e) { + assert_equals(e.data, "PASS", "message from opened frame"); + fetch("/client-hints/accept-ch-stickiness/resources/clear-site-data.html").then(resolve); + })); + const iframe = document.createElement("iframe"); + iframe.src = expect_url; + document.body.appendChild(iframe); + }); + }, test_name + " got client hints according to expectations."); +} + +function verify_navigation_state(expect_url, test_name) { + promise_test(t => { + return new Promise(resolve => { + let win; + window.addEventListener('message', t.step_func(function(e) { + win.close(); + assert_equals(e.data, "PASS", "message from opened page"); + fetch("/client-hints/accept-ch-stickiness/resources/clear-site-data.html").then(resolve); + })); + // Open a new window. Verify that the user agent attaches client hints. + win = window.open(expect_url); + assert_not_equals(win, null, "Popup windows not allowed?"); + }); + }, test_name + " got client hints according to expectations."); +} + +function verify_subresource_state(expect_url, test_name) { + promise_test(t => { + return new Promise(resolve => { + fetch(expect_url).then(response => response.text()).then(t.step_func(text => { + assert_true(text.includes("PASS")); + fetch("/client-hints/accept-ch-stickiness/resources/clear-site-data.html").then(resolve); + })); + }); + }, test_name + " got client hints according to expectations."); +} + +function verify_syncxhr_state(expect_url, test_name) { + promise_test(t => { + return new Promise(resolve => { + const xhr = new XMLHttpRequest(); + xhr.onreadystatechange = t.step_func(() => { + if (xhr.readyState != XMLHttpRequest.DONE) { + return; + } + assert_true(xhr.responseText.includes("PASS")); + fetch("/client-hints/accept-ch-stickiness/resources/clear-site-data.html").then(resolve); + }); + xhr.open("GET", expect_url, false /* async */); + xhr.send(); + }); + }, test_name + " got client hints according to expectations."); +} + +function attempt_set(test_type, accept_url, test_name, test_name_suffix) { + promise_test(t => { + return new Promise(resolve => { + if (test_type == "navigation") { + const win = window.open(accept_url); + assert_not_equals(win, null, "Popup windows not allowed?"); + addEventListener('message', t.step_func(() => { + win.close(); + resolve(); + }), false); + } else if (test_type == "iframe") { + const iframe = document.createElement("iframe"); + iframe.addEventListener('load', t.step_func(() => { + resolve(); + }), false); + iframe.src = accept_url; + document.body.appendChild(iframe); + } else if (test_type == "subresource") { + fetch(accept_url).then(r => { + assert_equals(r.status, 200, "subresource response status") + // Verify that the browser did not include client hints in the request + // headers, just because we can.. + assert_false(r.headers.has("device-memory-received"), + "device-memory-received", + "subresource request had no client hints"); + assert_false(r.headers.has("device-memory-deprecated-received"), + "device-memory-deprecated-received", + "subresource request had no client hints"); + resolve(); + }); + } else { + assert_unreached("unknown test type"); + } + }); + }, test_name + " set Accept-CH" + test_name_suffix); +} + +const run_test = test => { + // First, verify the initial state to make sure that the browser does not have + // client hints preferences cached from a previous run of the test. + verify_initial_state(test.initial_url, test.name); + + // Then, attempt to set Accept-CH + attempt_set(test.type, test.accept_url, test.name, ""); + + // Finally, verify that CH are actually sent (or not) on requests + verify_navigation_state(test.expect_url, test.name); +}; + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch.html new file mode 100644 index 0000000000..694c5b03bc --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch.html @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch.html.headers new file mode 100644 index 0000000000..e3ee616f2b --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/accept-ch.html.headers @@ -0,0 +1,2 @@ +Accept-CH: sec-ch-device-memory, device-memory, Sec-CH-DPR, DPR +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/clear-site-data.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/clear-site-data.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/clear-site-data.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/clear-site-data.html.headers new file mode 100644 index 0000000000..955424f246 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/clear-site-data.html.headers @@ -0,0 +1,2 @@ +Clear-Site-Data: "*" +Access-Control-Allow-Origin: * \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-expect-received.py b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-expect-received.py new file mode 100644 index 0000000000..d2a544e46a --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-expect-received.py @@ -0,0 +1,20 @@ +def main(request, response): + """ + Check that headers sent to navigate here *do* contain the device-memory client + hint, and report success/failure in a way compatible with + verify_{subresource|iframe}_state() in accept-ch-test.js + """ + + if b"device-memory" in request.headers and b"sec-ch-device-memory" in request.headers: + result = u"PASS" + else: + result = u"FAIL" + + content = u''' + +''' % (result) + headers = [(b"Content-Type", b"text/html"), (b"Access-Control-Allow-Origin", b"*")] + return 200, headers, content diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-not-expect-client-hints-headers.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-not-expect-client-hints-headers.html new file mode 100644 index 0000000000..2421eea18e --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-not-expect-client-hints-headers.html @@ -0,0 +1,22 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-not-expect-received.py b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-not-expect-received.py new file mode 100644 index 0000000000..48ebc21d14 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/do-not-expect-received.py @@ -0,0 +1,20 @@ +def main(request, response): + """ + Check that headers sent to navigate here *do not* contain the device-memory client + hint, and report success/failure in a way compatible with + verify_{subresource|iframe}_state() in accept-ch-test.js + """ + + if b"device-memory" in request.headers or b"sec-ch-device-memory" in request.headers: + result = u"FAIL" + else: + result = u"PASS" + + content = u''' + +''' % (result) + headers = [(b"Content-Type", b"text/html"), (b"Access-Control-Allow-Origin", b"*")] + return 200, headers, content diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py new file mode 100644 index 0000000000..3c61330671 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py @@ -0,0 +1,14 @@ +def main(request, response): + """ + Simple handler that sets a response header based on which client hint + request headers were received. + """ + + response.headers.append(b"Access-Control-Allow-Origin", b"*") + response.headers.append(b"Access-Control-Allow-Headers", b"*") + response.headers.append(b"Access-Control-Expose-Headers", b"*") + + if b"sec-ch-device-memory" in request.headers: + response.headers.set(b"device-memory-received", request.headers.get(b"sec-ch-device-memory")) + if b"device-memory" in request.headers: + response.headers.set(b"device-memory-deprecated-received", request.headers.get(b"device-memory")) diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/expect-client-hints-headers.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/expect-client-hints-headers.html new file mode 100644 index 0000000000..1cde2ffd05 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/expect-client-hints-headers.html @@ -0,0 +1,22 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/expect-received.py b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/expect-received.py new file mode 100644 index 0000000000..876f025f3e --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/expect-received.py @@ -0,0 +1,28 @@ +def main(request, response): + """ + Check that headers sent to navigate here contain the device-memory client + hint, and report success/failure in a way compatible with + verify_navigation_state() in accept-ch-test.js + """ + + if b"sec-ch-device-memory" not in request.headers: + result = u"DEVICE-MEMORY" + elif b"device-memory" not in request.headers: + result = u"DEVICE-MEMORY-DEPRECATED" + elif b"sec-ch-ua" not in request.headers: + result = u"UA" + elif b"sec-ch-ua-mobile" not in request.headers: + result = u"MOBILE" + elif b"sec-ch-ua-platform" not in request.headers: + result = u"PLATFORM" + else: + result = u"PASS" + + content = u''' + +''' % (result) + headers = [(b"Content-Type", b"text/html"), (b"Access-Control-Allow-Origin", b"*")] + return 200, headers, content diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html new file mode 100644 index 0000000000..f7e1a767b4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html @@ -0,0 +1,25 @@ + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html.headers new file mode 100644 index 0000000000..cb6b0cfd13 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html.headers @@ -0,0 +1 @@ +Feature-Policy: ch-device-memory *; diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html new file mode 100644 index 0000000000..561cae49ca --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html @@ -0,0 +1,8 @@ + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html.headers new file mode 100644 index 0000000000..27140bf36e --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html.headers @@ -0,0 +1,2 @@ +Access-Control-Allow-Origin: * + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.html new file mode 100644 index 0000000000..7d7c4ccdf7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.html @@ -0,0 +1,9 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.html.headers new file mode 100644 index 0000000000..27140bf36e --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.html.headers @@ -0,0 +1,2 @@ +Access-Control-Allow-Origin: * + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/no-accept-ch.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/no-accept-ch.html new file mode 100644 index 0000000000..16ed6c1a7c --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/no-accept-ch.html @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/no-accept-ch.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/no-accept-ch.html.headers new file mode 100644 index 0000000000..cb762eff80 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/no-accept-ch.html.headers @@ -0,0 +1 @@ +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-iframe.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-iframe.https.html new file mode 100644 index 0000000000..c768094544 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-iframe.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-empty-accept-ch.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-empty-accept-ch.https.html new file mode 100644 index 0000000000..e57f1c3dc6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-empty-accept-ch.https.html @@ -0,0 +1,20 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-no-accept-ch.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-no-accept-ch.https.html new file mode 100644 index 0000000000..ab59770176 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-no-accept-ch.https.html @@ -0,0 +1,20 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-redirect.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-redirect.https.html new file mode 100644 index 0000000000..69fc55e8f3 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation-redirect.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation.https.html new file mode 100644 index 0000000000..e35cbdcedd --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-navigation.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect-opted-in.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect-opted-in.https.html new file mode 100644 index 0000000000..66c0e57497 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect-opted-in.https.html @@ -0,0 +1,17 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect-opted-in.https.html.headers b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect-opted-in.https.html.headers new file mode 100644 index 0000000000..af6945319d --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect-opted-in.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-CH-DPR, DPR, Sec-CH-Device-Memory, Device-Memory diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect.https.html new file mode 100644 index 0000000000..8e687b58b1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource-redirect.https.html @@ -0,0 +1,18 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource.https.html b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource.https.html new file mode 100644 index 0000000000..0b7151a2cc --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/same-origin-subresource.https.html @@ -0,0 +1,19 @@ + + +Accept-CH Persistence test + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch/__dir__.headers b/testing/web-platform/tests/client-hints/accept-ch/__dir__.headers new file mode 100644 index 0000000000..f233c2e9d6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/__dir__.headers @@ -0,0 +1 @@ +Accept-CH: device-memory, dpr, width, viewport-width, rtt, downlink, ect, sec-ch-ua, sec-ch-ua-arch, sec-ch-ua-platform, sec-ch-ua-model, sec-ch-ua-mobile, sec-ch-ua-full-version, sec-ch-ua-platform-version, sec-ch-prefers-color-scheme, sec-ch-prefers-reduced-motion, sec-ch-ua-bitness, sec-ch-viewport-height, sec-ch-device-memory, sec-ch-dpr, sec-ch-width, sec-ch-viewport-width, sec-ch-ua-full-version-list, sec-ch-ua-wow64 diff --git a/testing/web-platform/tests/client-hints/accept-ch/answers.sub.https.html b/testing/web-platform/tests/client-hints/accept-ch/answers.sub.https.html new file mode 100644 index 0000000000..e49a515bf4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/answers.sub.https.html @@ -0,0 +1,68 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch/cache-revalidation.https.html b/testing/web-platform/tests/client-hints/accept-ch/cache-revalidation.https.html new file mode 100644 index 0000000000..5ed6f074a7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/cache-revalidation.https.html @@ -0,0 +1,36 @@ + + +Tests Stale While Revalidate is not executed for fetch API + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/__dir__.headers b/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/__dir__.headers new file mode 100644 index 0000000000..f233c2e9d6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/__dir__.headers @@ -0,0 +1 @@ +Accept-CH: device-memory, dpr, width, viewport-width, rtt, downlink, ect, sec-ch-ua, sec-ch-ua-arch, sec-ch-ua-platform, sec-ch-ua-model, sec-ch-ua-mobile, sec-ch-ua-full-version, sec-ch-ua-platform-version, sec-ch-prefers-color-scheme, sec-ch-prefers-reduced-motion, sec-ch-ua-bitness, sec-ch-viewport-height, sec-ch-device-memory, sec-ch-dpr, sec-ch-width, sec-ch-viewport-width, sec-ch-ua-full-version-list, sec-ch-ua-wow64 diff --git a/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/feature-policy.https.html b/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/feature-policy.https.html new file mode 100644 index 0000000000..90a27280c1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/feature-policy.https.html @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/feature-policy.https.html.headers b/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/feature-policy.https.html.headers new file mode 100644 index 0000000000..8e976388ec --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/feature-policy.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: ch-device-memory *; ch-dpr 'none'; ch-viewport-width 'self'; ch-ua 'self'; ch-ua-mobile 'none' diff --git a/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/no-feature-policy.https.html b/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/no-feature-policy.https.html new file mode 100644 index 0000000000..02458f3116 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/no-feature-policy.https.html @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html b/testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html new file mode 100644 index 0000000000..e1aa3ad68f --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html @@ -0,0 +1,77 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html.headers b/testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html.headers new file mode 100644 index 0000000000..78bbb8c872 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: ch-device-memory *; ch-dpr 'none'; ch-viewport-width 'self'; ch-mobile; ch-prefers-color-scheme 'none'; ch-prefers-reduced-motion 'none'; ch-viewport-height 'none' diff --git a/testing/web-platform/tests/client-hints/accept-ch/meta/resource-in-markup-accept-ch.https.html b/testing/web-platform/tests/client-hints/accept-ch/meta/resource-in-markup-accept-ch.https.html new file mode 100644 index 0000000000..c9b98daccf --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/meta/resource-in-markup-accept-ch.https.html @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch/meta/resource-in-markup-delegate-ch.https.html b/testing/web-platform/tests/client-hints/accept-ch/meta/resource-in-markup-delegate-ch.https.html new file mode 100644 index 0000000000..751f07f278 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/meta/resource-in-markup-delegate-ch.https.html @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch/no-feature-policy.sub.https.html b/testing/web-platform/tests/client-hints/accept-ch/no-feature-policy.sub.https.html new file mode 100644 index 0000000000..8458bbed7b --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/no-feature-policy.sub.https.html @@ -0,0 +1,65 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch/non-secure.http.html b/testing/web-platform/tests/client-hints/accept-ch/non-secure.http.html new file mode 100644 index 0000000000..9115578b57 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/non-secure.http.html @@ -0,0 +1,38 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/critical-ch/iframe.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/iframe.https.window.js new file mode 100644 index 0000000000..f4dd295208 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/iframe.https.window.js @@ -0,0 +1,8 @@ +// META: script=resources/util.js + +async_test((t) => { + var iframe = document.createElement("iframe"); + iframe.src = ECHO_URL; + document.body.appendChild(iframe); + iframe.contentWindow.addEventListener('message', message_listener(t, "FAIL")); +}, "Critical-CH iframe"); diff --git a/testing/web-platform/tests/client-hints/critical-ch/mis-matched-count.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/mis-matched-count.https.window.js new file mode 100644 index 0000000000..54bd667897 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/mis-matched-count.https.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js +// META: script=/common/utils.js + +async_test(make_message_test(ECHO_URL+"?mismatch=true&token="+token(), "1"), "Critical-CH no restart on mismatched hints") diff --git a/testing/web-platform/tests/client-hints/critical-ch/mis-matched.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/mis-matched.https.window.js new file mode 100644 index 0000000000..9476640b35 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/mis-matched.https.window.js @@ -0,0 +1,3 @@ +// META: script=resources/util.js + +async_test(make_message_test(ECHO_URL+"?mismatch=true", "FAIL"), "Critical-CH Mis-matched hints") diff --git a/testing/web-platform/tests/client-hints/critical-ch/navigation.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/navigation.https.window.js new file mode 100644 index 0000000000..549b321443 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/navigation.https.window.js @@ -0,0 +1,3 @@ +// META: script=resources/util.js + +async_test(make_message_test(ECHO_URL, "PASS"), "Critical-CH navigation") diff --git a/testing/web-platform/tests/client-hints/critical-ch/non-secure.http.window.js b/testing/web-platform/tests/client-hints/critical-ch/non-secure.http.window.js new file mode 100644 index 0000000000..cdd7924398 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/non-secure.http.window.js @@ -0,0 +1,3 @@ +// META: script=resources/util.js + +async_test(make_message_test(ECHO_URL, "FAIL"), "Critical-CH navigation non-secure") diff --git a/testing/web-platform/tests/client-hints/critical-ch/request-count.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/request-count.https.window.js new file mode 100644 index 0000000000..b337340509 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/request-count.https.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js +// META: script=/common/utils.js + +async_test(make_message_test(ECHO_URL+"?token="+token(), "2"), "Critical-CH navigation restart") diff --git a/testing/web-platform/tests/client-hints/critical-ch/resources/echo-critical-hint.py b/testing/web-platform/tests/client-hints/critical-ch/resources/echo-critical-hint.py new file mode 100644 index 0000000000..e4e77ad2a9 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/resources/echo-critical-hint.py @@ -0,0 +1,43 @@ +import sys + +def main(request, response): + """ + Simple handler that sets a response header based on which client hint + request headers were received. + """ + + response.headers.append(b"Content-Type", b"text/html; charset=UTF-8") + response.headers.append(b"Access-Control-Allow-Origin", b"*") + response.headers.append(b"Access-Control-Allow-Headers", b"*") + response.headers.append(b"Access-Control-Expose-Headers", b"*") + + response.headers.append(b"Accept-CH", b"sec-ch-device-memory,device-memory") + + critical = b"sec-ch-device-memory,device-memory" + if(request.GET.first(b"mismatch", None) is not None): + critical = b"sec-ch-viewport-width,viewport-width" + + response.headers.append(b"Critical-CH", critical) + + response.headers.append(b"Cache-Control", b"no-store") + + result = "FAIL" + + if b"sec-ch-device-memory" in request.headers and b"device-memory" in request.headers: + result = "PASS" + + token = request.GET.first(b"token", None) + if(token is not None): + with request.server.stash.lock: + count = request.server.stash.take(token) + if(count == None): + count = 1 + else: + count += 1 + request.server.stash.put(token, count) + result = str(count) + + if b"sec-ch-viewport-width" in request.headers and b"viewport-width" in request.headers: + result = "MISMATCH" + + response.content = "".format(result) diff --git a/testing/web-platform/tests/client-hints/critical-ch/resources/util.js b/testing/web-platform/tests/client-hints/critical-ch/resources/util.js new file mode 100644 index 0000000000..7471d9022e --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/resources/util.js @@ -0,0 +1,15 @@ +ECHO_URL = "resources/echo-critical-hint.py" + +message_listener = (t, message) => + (e) => { + t.step(()=>{assert_equals(e.data, message)}); + t.done(); + } + +make_message_test = (url, message) => + (t) => { + popup_window = window.open("/common/blank.html"); + assert_not_equals(popup_window, null, "Popup windows not allowed?"); + popup_window.addEventListener('message', message_listener(t, message)); + popup_window.location = url; + } diff --git a/testing/web-platform/tests/client-hints/critical-ch/subresource.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/subresource.https.window.js new file mode 100644 index 0000000000..f8112b628d --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/subresource.https.window.js @@ -0,0 +1,10 @@ +// META: script=resources/util.js +// META: script=/common/utils.js + +promise_test(() => + fetch("resources/echo-critical-hint.py") + .then((r) => r.text()) + .then((r) => { + assert_true(r.includes("FAIL")); + }) +, "Critical-CH subresource fetch"); diff --git a/testing/web-platform/tests/client-hints/critical-ch/unsafe-method.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/unsafe-method.https.window.js new file mode 100644 index 0000000000..0eca0eb8e9 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/unsafe-method.https.window.js @@ -0,0 +1,23 @@ +async_test((t) => { + // This test requires a navigation with a non-safe (i.e. non-GET) HTTP + // response, which the Critical-CH spec says to ignore. The most + // "straight-forward" way to do this in JS is by making a form with an + // unsafe method (e.g. POST) method and submit it. + + // Build the form DOM element + var form = document.createElement("form"); + form.setAttribute("method", "post"); + form.setAttribute("action", "resources/echo-critical-hint.py"); + form.setAttribute("target", "popup"); //don't navigate away from the page running the test... + document.body.appendChild(form); + + var popup_window = window.open("/common/blank.html", "popup"); + assert_not_equals(popup_window, null, "Popup windows not allowed?"); + + popup_window.addEventListener('message', (e) => { + t.step(()=>{assert_equals(e.data, "FAIL")}); + t.done(); + }); + + form.submit(); +}, "Critical-CH unsafe method") diff --git a/testing/web-platform/tests/client-hints/http-equiv-accept-ch-iframe.https.html b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-iframe.https.html new file mode 100644 index 0000000000..4bde8ebc2d --- /dev/null +++ b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-iframe.https.html @@ -0,0 +1,26 @@ + + +Accept-CH http-equiv iframe test + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/http-equiv-accept-ch-malformed-header.https.html b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-malformed-header.https.html new file mode 100644 index 0000000000..3576dc9920 --- /dev/null +++ b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-malformed-header.https.html @@ -0,0 +1,31 @@ + + +Accept-CH malformed http-equiv test + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/http-equiv-accept-ch-merge.https.html b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-merge.https.html new file mode 100644 index 0000000000..832c057887 --- /dev/null +++ b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-merge.https.html @@ -0,0 +1,49 @@ + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/http-equiv-accept-ch-merge.https.html.headers b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-merge.https.html.headers new file mode 100644 index 0000000000..34edb7b82b --- /dev/null +++ b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-merge.https.html.headers @@ -0,0 +1,2 @@ +Accept-CH: sec-ch-device-memory, device-memory, sec-ch-dpr, dpr + diff --git a/testing/web-platform/tests/client-hints/http-equiv-accept-ch-non-secure.http.html b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-non-secure.http.html new file mode 100644 index 0000000000..58a55d44c3 --- /dev/null +++ b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-non-secure.http.html @@ -0,0 +1,39 @@ + + +Accept-CH http-equiv insecure transport test + + + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html new file mode 100644 index 0000000000..27ce76302d --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html @@ -0,0 +1,37 @@ + + +Client Hints: Delegation of hints to cross-origin frames and resources for * + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html.headers new file mode 100644 index 0000000000..a8b1708b9d --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html.headers @@ -0,0 +1,2 @@ +Permissions-Policy: ch-device-memory=(*) +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html new file mode 100644 index 0000000000..1d4bfffe0a --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html @@ -0,0 +1,36 @@ + + +Client Hints: Delegation of hints to cross-origin frames and resources for none + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html.headers new file mode 100644 index 0000000000..0b260a43f0 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html.headers @@ -0,0 +1,2 @@ +Permissions-Policy: ch-device-memory=() +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html new file mode 100644 index 0000000000..9647a8741a --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html @@ -0,0 +1,37 @@ + + +Client Hints: Delegation of hints to cross-origin frames and resources for self + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html.headers new file mode 100644 index 0000000000..3b9de86bbd --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html.headers @@ -0,0 +1,2 @@ +Permissions-Policy: ch-device-memory=(self) +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html new file mode 100644 index 0000000000..9ea0049c39 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html @@ -0,0 +1,37 @@ + + +Client Hints: Delegation of hints to cross-origin frames and resources for some + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html.sub.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html.sub.headers new file mode 100644 index 0000000000..24fe4e84c8 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html.sub.headers @@ -0,0 +1,2 @@ +Permissions-Policy: ch-device-memory=("https://{{host}}:{{ports[https][0]}}" "https://{{hosts[alt][]}}:{{ports[https][0]}}") +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html new file mode 100644 index 0000000000..e01853e5e9 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html @@ -0,0 +1,37 @@ + + +Client Hints: Delegation of hints to cross-origin frames and resources for src + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html.headers new file mode 100644 index 0000000000..3b9de86bbd --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.html.headers @@ -0,0 +1,2 @@ +Permissions-Policy: ch-device-memory=(self) +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html new file mode 100644 index 0000000000..09df9ec46f --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html @@ -0,0 +1,32 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html new file mode 100644 index 0000000000..4291ae954c --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html @@ -0,0 +1,23 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html new file mode 100644 index 0000000000..cd88fa54fc --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html @@ -0,0 +1,32 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html new file mode 100644 index 0000000000..5d661f4b15 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html @@ -0,0 +1,23 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html new file mode 100644 index 0000000000..92157f4989 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html @@ -0,0 +1,32 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html new file mode 100644 index 0000000000..e12759e076 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html @@ -0,0 +1,23 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html new file mode 100644 index 0000000000..39a4307230 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html @@ -0,0 +1,32 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html.headers b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html.headers new file mode 100644 index 0000000000..3e53702c6e --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html.headers @@ -0,0 +1 @@ +Permissions-Policy: ch-device-memory=(*) diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html new file mode 100644 index 0000000000..999e3b6c99 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html @@ -0,0 +1,23 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html.sub.headers b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html.sub.headers new file mode 100644 index 0000000000..e8ccc92f51 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe_iframe.sub.https.html.sub.headers @@ -0,0 +1 @@ +Permissions-Policy: ch-device-memory=("https://{{host}}:{{ports[https][0]}}") diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html new file mode 100644 index 0000000000..05d1db9fc9 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html @@ -0,0 +1,33 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe_iframe.sub.https.html b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe_iframe.sub.https.html new file mode 100644 index 0000000000..497a19161f --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe_iframe.sub.https.html @@ -0,0 +1,23 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py b/testing/web-platform/tests/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py new file mode 100644 index 0000000000..f57e121252 --- /dev/null +++ b/testing/web-platform/tests/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py @@ -0,0 +1,11 @@ +def main(request, response): + """ + Simple handler that sets the status based on whether sec-ch-device-memory was received. + """ + response.headers.append(b"Access-Control-Allow-Origin", b"*") + response.headers.append(b"Access-Control-Allow-Headers", b"*") + response.headers.append(b"Access-Control-Expose-Headers", b"*") + if b"sec-ch-device-memory" in request.headers: + response.status = 200 + else: + response.status = 400 \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-iframe.https.html b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-iframe.https.html new file mode 100644 index 0000000000..2ce9c63c18 --- /dev/null +++ b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-iframe.https.html @@ -0,0 +1,26 @@ + + + +Delegate-CH meta-equiv iframe test + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-injection.https.html b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-injection.https.html new file mode 100644 index 0000000000..b9e4a334fc --- /dev/null +++ b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-injection.https.html @@ -0,0 +1,42 @@ + + + + Delegate-CH meta-equiv injection test + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-malformed-header.https.html b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-malformed-header.https.html new file mode 100644 index 0000000000..a4b91fd99b --- /dev/null +++ b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-malformed-header.https.html @@ -0,0 +1,32 @@ + + + +Delegate-CH malformed meta-equiv test + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-merge.https.html b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-merge.https.html new file mode 100644 index 0000000000..d8dbc9f96c --- /dev/null +++ b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-merge.https.html @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-merge.https.html.headers b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-merge.https.html.headers new file mode 100644 index 0000000000..34edb7b82b --- /dev/null +++ b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-merge.https.html.headers @@ -0,0 +1,2 @@ +Accept-CH: sec-ch-device-memory, device-memory, sec-ch-dpr, dpr + diff --git a/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-non-secure.http.html b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-non-secure.http.html new file mode 100644 index 0000000000..1fbe62c281 --- /dev/null +++ b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-non-secure.http.html @@ -0,0 +1,40 @@ + + + +Delegate-CH meta-equiv insecure transport test + + + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch-different.html b/testing/web-platform/tests/client-hints/resources/accept-ch-different.html new file mode 100644 index 0000000000..05cc0b61b0 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-different.html @@ -0,0 +1,11 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch-different.html.headers b/testing/web-platform/tests/client-hints/resources/accept-ch-different.html.headers new file mode 100644 index 0000000000..b428fda331 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-different.html.headers @@ -0,0 +1,2 @@ +Accept-CH: sec-ch-viewport-width,viewport-width +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch-empty.html b/testing/web-platform/tests/client-hints/resources/accept-ch-empty.html new file mode 100644 index 0000000000..27393e5a1a --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-empty.html @@ -0,0 +1,11 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch-empty.html.headers b/testing/web-platform/tests/client-hints/resources/accept-ch-empty.html.headers new file mode 100644 index 0000000000..25215abdf7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-empty.html.headers @@ -0,0 +1,2 @@ +Accept-CH: +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch-malformed.html b/testing/web-platform/tests/client-hints/resources/accept-ch-malformed.html new file mode 100644 index 0000000000..70c1c75713 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-malformed.html @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch-malformed.html.headers b/testing/web-platform/tests/client-hints/resources/accept-ch-malformed.html.headers new file mode 100644 index 0000000000..83a6a05e54 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-malformed.html.headers @@ -0,0 +1,2 @@ +Accept-CH: device memory +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch.html b/testing/web-platform/tests/client-hints/resources/accept-ch.html new file mode 100644 index 0000000000..1f1da26ceb --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch.html @@ -0,0 +1,10 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch.html.headers b/testing/web-platform/tests/client-hints/resources/accept-ch.html.headers new file mode 100644 index 0000000000..f5beb4c365 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch.html.headers @@ -0,0 +1,2 @@ +Accept-CH: sec-ch-device-memory,device-memory +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/client-hints/resources/clienthintslist.py b/testing/web-platform/tests/client-hints/resources/clienthintslist.py new file mode 100644 index 0000000000..3d1f7caf46 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/clienthintslist.py @@ -0,0 +1,40 @@ +def client_hints_list(): + return [b"device-memory", + b"dpr", + # b"width", (Only available for images) + b"viewport-width", + b"rtt", + b"downlink", + b"ect", + b"sec-ch-ua", + b"sec-ch-ua-arch", + b"sec-ch-ua-platform", + b"sec-ch-ua-model", + b"sec-ch-ua-mobile", + b"sec-ch-ua-full-version", + b"sec-ch-ua-platform-version", + b"sec-ch-prefers-color-scheme", + b"sec-ch-prefers-reduced-motion", + b"sec-ch-ua-bitness", + b"sec-ch-viewport-height", + b"sec-ch-device-memory", + b"sec-ch-dpr", + # b"sec-ch-width", (Only available for images) + b"sec-ch-viewport-width", + b"sec-ch-ua-full-version-list", + b"sec-ch-ua-wow64", + ] + +def client_hints_full_list(): + return client_hints_list() + [b"width", b"sec-ch-width"] + +def client_hints_ua_list(): + return [b"sec-ch-ua", + b"sec-ch-ua-arch", + b"sec-ch-ua-platform", + b"sec-ch-ua-platform-version", + b"sec-ch-ua-model", + b"sec-ch-ua-full-version", + b"sec-ch-ua-full-version-list", + b"sec-ch-ua-wow64", + ] \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py b/testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py new file mode 100644 index 0000000000..190cd86289 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py @@ -0,0 +1,36 @@ +def main(request, response): + """ + Simple handler that sets a response header based on which client hint + request headers were received. + """ + + response.headers.append(b"Access-Control-Allow-Origin", b"*") + response.headers.append(b"Access-Control-Allow-Headers", b"*") + response.headers.append(b"Access-Control-Expose-Headers", b"*") + + if b"sec-ch-device-memory" in request.headers: + response.headers.set(b"device-memory-received", request.headers.get(b"sec-ch-device-memory")) + if b"device-memory" in request.headers: + response.headers.set(b"device-memory-deprecated-received", request.headers.get(b"device-memory")) + if b"sec-ch-dpr" in request.headers: + response.headers.set(b"dpr-received", request.headers.get(b"sec-ch-dpr")) + if b"dpr" in request.headers: + response.headers.set(b"dpr-deprecated-received", request.headers.get(b"dpr")) + if b"sec-ch-viewport-width" in request.headers: + response.headers.set(b"viewport-width-received", request.headers.get(b"sec-ch-viewport-width")) + if b"viewport-width" in request.headers: + response.headers.set(b"viewport-width-deprecated-received", request.headers.get(b"viewport-width")) + if b"sec-ch-viewport-height" in request.headers: + response.headers.set(b"viewport-height-received", request.headers.get(b"sec-ch-viewport-height")) + if b"rtt" in request.headers: + response.headers.set(b"rtt-received", request.headers.get(b"rtt")) + if b"downlink" in request.headers: + response.headers.set(b"downlink-received", request.headers.get(b"downlink")) + if b"ect" in request.headers: + response.headers.set(b"ect-received", request.headers.get(b"ect")) + if b"sec-ch-ua-mobile" in request.headers: + response.headers.set(b"mobile-received", request.headers.get(b"sec-ch-ua-mobile")) + if b"sec-ch-prefers-color-scheme" in request.headers: + response.headers.set(b"prefers-color-scheme-received", request.headers.get(b"sec-ch-prefers-color-scheme")) + if b"sec-ch-prefers-reduced-motion" in request.headers: + response.headers.set(b"prefers-reduced-motion-received", request.headers.get(b"sec-ch-prefers-reduced-motion")) diff --git a/testing/web-platform/tests/client-hints/resources/echo-ua-client-hints-received.py b/testing/web-platform/tests/client-hints/resources/echo-ua-client-hints-received.py new file mode 100644 index 0000000000..7982421d07 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/echo-ua-client-hints-received.py @@ -0,0 +1,23 @@ +import importlib +client_hints_ua_list = importlib.import_module("client-hints.resources.clienthintslist").client_hints_ua_list + +def main(request, response): + """ + Simple handler that sets a response header based on which client hint + request headers were received. + """ + + response.headers.append(b"Access-Control-Allow-Origin", b"*") + response.headers.append(b"Access-Control-Allow-Headers", b"*") + response.headers.append(b"Access-Control-Expose-Headers", b"*") + + client_hint_headers = client_hints_ua_list() + request_client_hints = {i: request.headers.get(i) for i in client_hint_headers} + + for header in client_hint_headers: + if request_client_hints[header] is not None: + response.headers.set(header + b"-received", request_client_hints[header]) + + headers = [] + content = u"" + return 200, headers, content diff --git a/testing/web-platform/tests/client-hints/resources/expect-client-hints-headers-iframe.py b/testing/web-platform/tests/client-hints/resources/expect-client-hints-headers-iframe.py new file mode 100644 index 0000000000..6a1218264e --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/expect-client-hints-headers-iframe.py @@ -0,0 +1,31 @@ +from wptserve.utils import isomorphic_decode + +import importlib +client_hints_list = importlib.import_module("client-hints.resources.clienthintslist").client_hints_list + +def main(request, response): + """ + Simple handler that returns an HTML response that passes when the required + Client Hints are received as request headers. + """ + + result = u"PASS" + log = u"" + for value in client_hints_list(): + should = (request.GET[value.lower()] == b"true") + present = request.headers.get(value.lower()) or request.headers.get(value) + if present: + log += isomorphic_decode(value) + u" " + str(should) + u" " + isomorphic_decode(present) + u", " + else: + log += isomorphic_decode(value) + u" " + str(should) + u" " + str(present) + u", " + if (should and not present) or (not should and present): + if present: + result = u"FAIL " + isomorphic_decode(value) + u" " + str(should) + u" " + isomorphic_decode(present) + else: + result = u"FAIL " + isomorphic_decode(value) + u" " + str(should) + u" " + str(present) + break + + response.headers.append(b"Access-Control-Allow-Origin", b"*") + body = u"" + + response.content = body diff --git a/testing/web-platform/tests/client-hints/resources/expect-client-hints-headers.html b/testing/web-platform/tests/client-hints/resources/expect-client-hints-headers.html new file mode 100644 index 0000000000..928a82db45 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/expect-client-hints-headers.html @@ -0,0 +1,22 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/expect-different-client-hints-headers.html b/testing/web-platform/tests/client-hints/resources/expect-different-client-hints-headers.html new file mode 100644 index 0000000000..19ee394f46 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/expect-different-client-hints-headers.html @@ -0,0 +1,22 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/expect-no-client-hints-headers.html b/testing/web-platform/tests/client-hints/resources/expect-no-client-hints-headers.html new file mode 100644 index 0000000000..07eb0568d4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/expect-no-client-hints-headers.html @@ -0,0 +1,24 @@ + + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/export.js b/testing/web-platform/tests/client-hints/resources/export.js new file mode 100644 index 0000000000..68cea03ce4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/export.js @@ -0,0 +1,49 @@ +const client_hints_list = [ + "device-memory", + "dpr", + // "width", (only available for images) + "viewport-width", + "rtt", + "downlink", + "ect", + "sec-ch-ua", + "sec-ch-ua-arch", + "sec-ch-ua-platform", + "sec-ch-ua-model", + "sec-ch-ua-mobile", + "sec-ch-ua-full-version", + "sec-ch-ua-platform-version", + "sec-ch-prefers-color-scheme", + "sec-ch-prefers-reduced-motion", + "sec-ch-ua-bitness", + "sec-ch-viewport-height", + "sec-ch-device-memory", + "sec-ch-dpr", + // "sec-ch-width", (Only available for images) + "sec-ch-viewport-width", + "sec-ch-ua-full-version-list", + "sec-ch-ua-wow64", +]; + +const client_hints_full_list = client_hints_list.concat(["width", "sec-ch-width"]) + +const default_on_client_hints = [ + "sec-ch-ua", + "sec-ch-ua-mobile", + "sec-ch-ua-platform", +]; + +const iframe_src = + "/client-hints/resources/expect-client-hints-headers-iframe.py?"; + +const expect_iframe_no_hints = iframe_src + + client_hints_list.map((e) => { + if(default_on_client_hints.includes(e)) { + return e+"=true"; + } else { + return e+"=false"; + } + }).join("&"); + +const expect_iframe_hints = iframe_src + + client_hints_list.map(e => e+"=true").join("&"); \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/resources/feature-policy-navigation.js b/testing/web-platform/tests/client-hints/resources/feature-policy-navigation.js new file mode 100644 index 0000000000..23782fdfdb --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/feature-policy-navigation.js @@ -0,0 +1,72 @@ +const meta_name_enabled = [ + "sec-ch-device-memory", + "device-memory", + "sec-ch-dpr", + "dpr", + "sec-ch-viewport-width", + "viewport-width", + "sec-ch-ua", + "sec-ch-ua-mobile", + "sec-ch-ua-platform", +]; + +const meta_name_client_hints = iframe_src + + client_hints_list.map((e) => { + if(meta_name_enabled.includes(e)) { + return e+"=true"; + } else { + return e+"=false"; + } + }).join("&"); + +const cross_origin_enabled = [ + "device-memory", + "sec-ch-device-memory", + "sec-ch-ua-platform", +]; + +const cross_origin_client_hints = iframe_src + + client_hints_list.map((e) => { + if(cross_origin_enabled.includes(e)) { + return e+"=true"; + } else { + return e+"=false"; + } + }).join("&"); + +const same_origin_disabled = [ + "dpr", + "sec-ch-dpr", + "sec-ch-ua-mobile", +]; + +const same_origin_client_hints = iframe_src + + client_hints_list.map((e) => { + if(same_origin_disabled.includes(e)) { + return e+"=false"; + } else { + return e+"=true"; + } + }).join("&"); + +const test_frame = (origin, url, allow, message) => { + promise_test(() => { + return new Promise((resolve, reject) => { + let frame = document.createElement('iframe'); + frame.allow = allow; + window.addEventListener('message', function(e) { + try { + assert_equals(typeof e.data, "string"); + assert_equals(e.data, "PASS"); + } catch { + reject(e.data); + } + resolve(); + }); + document.body.appendChild(frame); + // Writing to |frame.src| triggers the navigation, so + // everything else need to happen first. + frame.src = get_host_info()[origin] + url; + }); + }, message); +} diff --git a/testing/web-platform/tests/client-hints/resources/open-and-add-load-event.js b/testing/web-platform/tests/client-hints/resources/open-and-add-load-event.js new file mode 100644 index 0000000000..bd88fcc28e --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/open-and-add-load-event.js @@ -0,0 +1,23 @@ +function open_and_add_load_event(href) { + return new Promise((resolve) => { + // While not practically possible, opening "blank" first and setting the + // href after allows for the theoretical possibility of registering the event + // after the window is loaded. + let popup_window = window.open("/resources/blank.html"); + assert_not_equals(popup_window, null, "Popup windows not allowed?"); + popup_window.addEventListener('load', resolve, {once: true}); + popup_window.location.href = href; + }); +} + +async function open_and_expect_headers(href) { + let e = await new Promise(resolve => { + let popup_window = window.open("/resources/blank.html"); + assert_not_equals(popup_window, null, "Popup windows not allowed?"); + window.addEventListener('message', resolve, false); + popup_window.location.href = href; + }); + + assert_equals(e.data, "PASS"); + return e; +} \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/resources/script-set-dpr-header.py b/testing/web-platform/tests/client-hints/resources/script-set-dpr-header.py new file mode 100644 index 0000000000..9a65886ed8 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/script-set-dpr-header.py @@ -0,0 +1,4 @@ +def main(request, response): + headers = [(b"Content-Type", b"text/javascript")] + body = u'dprHeader = "%s";' % request.headers.get(b'sec-ch-dpr', '') + return 200, headers, body diff --git a/testing/web-platform/tests/client-hints/resources/sec-ch-ua.py b/testing/web-platform/tests/client-hints/resources/sec-ch-ua.py new file mode 100644 index 0000000000..ddeb582a19 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/sec-ch-ua.py @@ -0,0 +1,9 @@ +def main(request, response): + ua = request.headers.get(b'Sec-CH-UA', b'') + response.headers.set(b"Content-Type", b"text/html") + response.content = b''' + +Sec-CH-UA: %s +''' % (ua, ua) diff --git a/testing/web-platform/tests/client-hints/resources/stale-echo-client-hints.py b/testing/web-platform/tests/client-hints/resources/stale-echo-client-hints.py new file mode 100644 index 0000000000..e9832273b8 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/stale-echo-client-hints.py @@ -0,0 +1,50 @@ +import random +import string + +from wptserve.utils import isomorphic_encode +import importlib +client_hints_full_list = importlib.import_module("client-hints.resources.clienthintslist").client_hints_full_list + +def id_token(): + letters = string.ascii_lowercase + return u''.join(random.choice(letters) for i in range(20)) + +def main(request, response): + client_hint_headers = client_hints_full_list() + client_hints_curr = {i:request.headers.get(i) for i in client_hint_headers} + + token = request.GET.first(b"token", None) + is_query = request.GET.first(b"query", None) is not None + with request.server.stash.lock: + stash = request.server.stash.take(token) + if stash != None: + (value, client_hints_prev) = stash + count = int(value) + else: + count = 0 + client_hints_prev = {} + + if is_query: + if count < 2: + request.server.stash.put(token, (count, client_hints_curr)) + else: + count = count + 1 + request.server.stash.put(token, (count, client_hints_curr)) + + for header in client_hint_headers: + if client_hints_curr[header] is not None: + response.headers.set(header+b"-recieved", client_hints_curr[header]) + if (header in client_hints_prev) and (client_hints_prev[header] is not None): + response.headers.set(header+b"-previous", client_hints_prev[header]) + + if is_query: + headers = [(b"Count", count)] + content = u"" + return 200, headers, content + else: + unique_id = id_token() + headers = [(b"Content-Type", b"text/html"), + (b"Cache-Control", b"private, max-age=0, stale-while-revalidate=60"), + (b"Unique-Id", isomorphic_encode(unique_id))] + content = u"report('{}')".format(unique_id) + return 200, headers, content diff --git a/testing/web-platform/tests/client-hints/resources/viewport-frame.py b/testing/web-platform/tests/client-hints/resources/viewport-frame.py new file mode 100644 index 0000000000..67b592c71a --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/viewport-frame.py @@ -0,0 +1,25 @@ +def main(request, response): + """ + postMessage with Viewport-Width and Sec-Ch-Viewport-Height headers + """ + + if b"sec-ch-viewport-width" in request.headers: + width = request.headers["sec-ch-viewport-width"] + else: + width = b"FAIL" + + if b"sec-ch-viewport-height" in request.headers: + height = request.headers["sec-ch-viewport-height"] + else: + height = b"FAIL" + + headers = [(b"Content-Type", b"text/html"), + (b"Access-Control-Allow-Origin", b"*")] + content = b''' + +''' % (width, height) + + return 200, headers, content diff --git a/testing/web-platform/tests/client-hints/resources/viewport-measurement.html b/testing/web-platform/tests/client-hints/resources/viewport-measurement.html new file mode 100644 index 0000000000..2ac9043af7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/viewport-measurement.html @@ -0,0 +1,8 @@ + + diff --git a/testing/web-platform/tests/client-hints/resources/viewport.py b/testing/web-platform/tests/client-hints/resources/viewport.py new file mode 100644 index 0000000000..d5ab6d4eee --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/viewport.py @@ -0,0 +1,13 @@ +def main(request, response): + """ + Reflect Sec-Ch-Viewport-Width and Sec-Ch-Viewport-Height headers + """ + + if b"sec-ch-viewport-width" in request.headers and b"sec-ch-viewport-height" in request.headers: + result = request.headers["sec-ch-viewport-width"] + b"," + request.headers["sec-ch-viewport-height"] + else: + result = u"FAIL" + + headers = [(b"Content-Type", b"text/html"), + (b"Access-Control-Allow-Origin", b"*")] + return 200, headers, result diff --git a/testing/web-platform/tests/client-hints/sandbox/__dir__.headers b/testing/web-platform/tests/client-hints/sandbox/__dir__.headers new file mode 100644 index 0000000000..f233c2e9d6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/__dir__.headers @@ -0,0 +1 @@ +Accept-CH: device-memory, dpr, width, viewport-width, rtt, downlink, ect, sec-ch-ua, sec-ch-ua-arch, sec-ch-ua-platform, sec-ch-ua-model, sec-ch-ua-mobile, sec-ch-ua-full-version, sec-ch-ua-platform-version, sec-ch-prefers-color-scheme, sec-ch-prefers-reduced-motion, sec-ch-ua-bitness, sec-ch-viewport-height, sec-ch-device-memory, sec-ch-dpr, sec-ch-width, sec-ch-viewport-width, sec-ch-ua-full-version-list, sec-ch-ua-wow64 diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html new file mode 100644 index 0000000000..a5f094af9d --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html.headers b/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html.headers new file mode 100644 index 0000000000..895eb51993 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-csp-same-origin.https.html.headers @@ -0,0 +1 @@ +Content-Security-Policy: sandbox allow-scripts allow-same-origin \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html new file mode 100644 index 0000000000..fb63c393fd --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html.headers b/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html.headers new file mode 100644 index 0000000000..c7e4e7cc5b --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-csp.https.html.headers @@ -0,0 +1 @@ +Content-Security-Policy: sandbox allow-scripts \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-iframe-popups.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-iframe-popups.https.html new file mode 100644 index 0000000000..9cbf6006c8 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-iframe-popups.https.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-popups-escape-sandbox.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-popups-escape-sandbox.https.html new file mode 100644 index 0000000000..35a94b537d --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-popups-escape-sandbox.https.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-popups.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-popups.https.html new file mode 100644 index 0000000000..3d7bc6eb80 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-popups.https.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe-same-origin.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe-same-origin.https.html new file mode 100644 index 0000000000..0ea6a8ed53 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe-same-origin.https.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/iframe.https.html b/testing/web-platform/tests/client-hints/sandbox/iframe.https.html new file mode 100644 index 0000000000..f37b91011b --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/iframe.https.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-hints.html b/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-hints.html new file mode 100644 index 0000000000..6cd5f0a29e --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-hints.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-no-hints.html b/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-no-hints.html new file mode 100644 index 0000000000..46dbb7f236 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/resources/embedded-popup-expect-no-hints.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sandbox/resources/iframe-with-embedded-popup-expect-no-hints.html b/testing/web-platform/tests/client-hints/sandbox/resources/iframe-with-embedded-popup-expect-no-hints.html new file mode 100644 index 0000000000..21efd76180 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/resources/iframe-with-embedded-popup-expect-no-hints.html @@ -0,0 +1,12 @@ + + + + + diff --git a/testing/web-platform/tests/client-hints/viewport-size/viewport-size-iframe.https.html.headers b/testing/web-platform/tests/client-hints/viewport-size/viewport-size-iframe.https.html.headers new file mode 100644 index 0000000000..76c3cb886c --- /dev/null +++ b/testing/web-platform/tests/client-hints/viewport-size/viewport-size-iframe.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-Ch-Viewport-Width,Sec-Ch-Viewport-Height diff --git a/testing/web-platform/tests/client-hints/viewport-size/viewport-size-subresource.https.html b/testing/web-platform/tests/client-hints/viewport-size/viewport-size-subresource.https.html new file mode 100644 index 0000000000..ec22a4bdf3 --- /dev/null +++ b/testing/web-platform/tests/client-hints/viewport-size/viewport-size-subresource.https.html @@ -0,0 +1,16 @@ + + + + + + +