From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/client-hints/META.yml | 5 + .../tests/client-hints/accept-ch-change.https.html | 75 ++++++++++++ .../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 +++ .../client-hints/accept-ch.wildcard.https.sub.html | 25 ++++ .../accept-ch.wildcard.https.sub.html.sub.headers | 2 + .../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 | 79 ++++++++++++ .../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 ++++++ .../clear-site-data/clear-site-data-all.https.html | 37 ++++++ .../clear-site-data-all.https.html.headers | 1 + .../clear-site-data-cache.https.html | 37 ++++++ .../clear-site-data-cache.https.html.headers | 1 + .../clear-site-data-client-hints.https.html | 37 ++++++ ...clear-site-data-client-hints.https.html.headers | 1 + .../clear-site-data-cookies.https.html | 37 ++++++ .../clear-site-data-cookies.https.html.headers | 1 + .../clear-site-data-storage.https.html | 37 ++++++ .../clear-site-data-storage.https.html.headers | 1 + .../resources/check-client-hints.py | 15 +++ .../clear-site-data/resources/clear-site-data.py | 12 ++ .../set-client-hints-after-clear-all.https.html | 24 ++++ ...client-hints-after-clear-all.https.html.headers | 2 + .../set-client-hints-after-clear-cache.https.html | 24 ++++ ...ient-hints-after-clear-cache.https.html.headers | 2 + ...lient-hints-after-clear-client-hints.https.html | 24 ++++ ...nts-after-clear-client-hints.https.html.headers | 2 + ...set-client-hints-after-clear-cookies.https.html | 24 ++++ ...nt-hints-after-clear-cookies.https.html.headers | 2 + ...set-client-hints-after-clear-storage.https.html | 24 ++++ ...nt-hints-after-clear-storage.https.html.headers | 2 + ...ritical-client-hints-after-clear-all.https.html | 24 ++++ ...client-hints-after-clear-all.https.html.headers | 3 + ...tical-client-hints-after-clear-cache.https.html | 24 ++++ ...ient-hints-after-clear-cache.https.html.headers | 3 + ...lient-hints-after-clear-client-hints.https.html | 24 ++++ ...nts-after-clear-client-hints.https.html.headers | 3 + ...cal-client-hints-after-clear-cookies.https.html | 24 ++++ ...nt-hints-after-clear-cookies.https.html.headers | 3 + ...cal-client-hints-after-clear-storage.https.html | 24 ++++ ...nt-hints-after-clear-storage.https.html.headers | 3 + ...ical-ch.navigation-timing.no-restart.https.html | 13 ++ ...ritical-ch.navigation-timing.restart.https.html | 14 +++ ...ch.navigation-timing.restart.https.html.headers | 2 + .../critical-ch/iframe.https.window.js | 15 +++ .../critical-ch/mis-matched-count.https.window.js | 5 + .../critical-ch/mis-matched.https.window.js | 3 + .../mis-matched.multiple.https.window.js | 3 + .../navigation.cross-origin.https.window.js | 4 + ...avigation.cross-origin.multiple.https.window.js | 4 + .../navigation.same-origin.https.window.js | 3 + ...navigation.same-origin.multiple.https.window.js | 3 + .../critical-ch/non-secure.http.window.js | 4 + .../redirect.critical.cross-origin.https.window.js | 4 + ....critical.cross-origin.multiple.https.window.js | 4 + .../redirect.critical.same-origin.https.window.js | 3 + ...t.critical.same-origin.multiple.https.window.js | 3 + .../redirect.cross-origin.https.window.js | 4 + .../redirect.cross-origin.multiple.https.window.js | 4 + .../redirect.same-origin.https.window.js | 3 + .../redirect.same-origin.multiple.https.window.js | 3 + .../critical-ch/request-count.https.window.js | 4 + .../request-count.multiple.https.window.js | 4 + .../critical-ch/resources/echo-critical-hint.py | 52 ++++++++ .../resources/redirect-critical-hint.py | 14 +++ .../client-hints/critical-ch/resources/util.js | 16 +++ .../critical-ch/subresource.https.window.js | 18 +++ .../critical-ch/unsafe-method.https.window.js | 49 ++++++++ .../http-equiv-accept-ch-iframe.https.html | 26 ++++ ...ttp-equiv-accept-ch-malformed-header.https.html | 31 +++++ .../http-equiv-accept-ch-merge.https.html | 50 ++++++++ .../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 | 43 +++++++ ...a-equiv-delegate-ch-malformed-header.https.html | 32 +++++ .../meta-equiv-delegate-ch-merge.https.html | 51 ++++++++ ...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 + .../client-hints/resources/accept-ch-mixed.html | 10 ++ .../resources/accept-ch-mixed.html.headers | 5 + .../client-hints/resources/accept-ch-split.html | 10 ++ .../resources/accept-ch-split.html.headers | 3 + .../tests/client-hints/resources/accept-ch.html | 10 ++ .../client-hints/resources/accept-ch.html.headers | 2 + .../accept-ch.wildcard.iframe.https.sub.html | 16 +++ ...t-ch.wildcard.iframe.https.sub.html.sub.headers | 1 + .../client-hints/resources/clienthintslist.py | 41 +++++++ .../resources/echo-client-hints-received.py | 38 ++++++ .../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 | 50 ++++++++ .../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 | 64 ++++++++++ .../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 + 259 files changed, 4239 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.wildcard.https.sub.html create mode 100644 testing/web-platform/tests/client-hints/accept-ch.wildcard.https.sub.html.sub.headers 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/clear-site-data/clear-site-data-all.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-all.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cache.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cache.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-client-hints.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-client-hints.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cookies.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cookies.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-storage.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-storage.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/resources/check-client-hints.py create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/resources/clear-site-data.py create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-all.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-all.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cache.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cache.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-client-hints.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-client-hints.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cookies.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cookies.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-storage.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-storage.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-all.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-all.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-client-hints.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-client-hints.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-storage.https.html create mode 100644 testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-storage.https.html.headers create mode 100644 testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.no-restart.https.html create mode 100644 testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.restart.https.html create mode 100644 testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.restart.https.html.headers 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/mis-matched.multiple.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/navigation.cross-origin.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/navigation.cross-origin.multiple.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/navigation.same-origin.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/navigation.same-origin.multiple.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/redirect.critical.cross-origin.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/redirect.critical.cross-origin.multiple.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/redirect.critical.same-origin.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/redirect.critical.same-origin.multiple.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/redirect.cross-origin.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/redirect.cross-origin.multiple.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/redirect.same-origin.https.window.js create mode 100644 testing/web-platform/tests/client-hints/critical-ch/redirect.same-origin.multiple.https.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/request-count.multiple.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/redirect-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-mixed.html create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch-mixed.html.headers create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch-split.html create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch-split.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/accept-ch.wildcard.iframe.https.sub.html create mode 100644 testing/web-platform/tests/client-hints/resources/accept-ch.wildcard.iframe.https.sub.html.sub.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..826aca85a4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-change.https.html @@ -0,0 +1,75 @@ + + +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..28580b0a6f --- /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 +Permissions-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..28580b0a6f --- /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 +Permissions-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..4738714fb4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch-stickiness/resources/feature-policy-with-cross-origin-subresource.html.headers @@ -0,0 +1 @@ +Permissions-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.wildcard.https.sub.html b/testing/web-platform/tests/client-hints/accept-ch.wildcard.https.sub.html new file mode 100644 index 0000000000..36eccd6a52 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch.wildcard.https.sub.html @@ -0,0 +1,25 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/accept-ch.wildcard.https.sub.html.sub.headers b/testing/web-platform/tests/client-hints/accept-ch.wildcard.https.sub.html.sub.headers new file mode 100644 index 0000000000..66ad9243c7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch.wildcard.https.sub.html.sub.headers @@ -0,0 +1,2 @@ +Accept-CH: sec-ch-ua-platform-version +Permissions-Policy: ch-ua-platform-version=("https://*.{{domains[]}}:{{ports[https][0]}}") \ No newline at end of file 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..4d4739028d --- /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, sec-ch-prefers-reduced-transparency 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..4d4739028d --- /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, sec-ch-prefers-reduced-transparency 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..11bbceff0a --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/feature-policy-navigation/feature-policy.https.html.headers @@ -0,0 +1 @@ +Permissions-Policy: ch-device-memory=*, ch-dpr=(), ch-viewport-width=(self), ch-ua=(self), ch-ua-mobile=() 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..8f9be9fde4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html @@ -0,0 +1,79 @@ + + + + + + + + + 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..6e6b89e923 --- /dev/null +++ b/testing/web-platform/tests/client-hints/accept-ch/feature-policy.sub.https.html.headers @@ -0,0 +1 @@ +Permissions-Policy: ch-device-memory=*, ch-dpr=(), ch-viewport-width=(self), ch-mobile, ch-prefers-color-scheme=(), ch-prefers-reduced-motion=(), ch-viewport-height=(), ch-prefers-reduced-transparency=() 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/clear-site-data/clear-site-data-all.https.html b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-all.https.html new file mode 100644 index 0000000000..a371f07fed --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-all.https.html @@ -0,0 +1,37 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-all.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-all.https.html.headers new file mode 100644 index 0000000000..226bb1c3b1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-all.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cache.https.html b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cache.https.html new file mode 100644 index 0000000000..1be71bf8b0 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cache.https.html @@ -0,0 +1,37 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cache.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cache.https.html.headers new file mode 100644 index 0000000000..226bb1c3b1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cache.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-client-hints.https.html b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-client-hints.https.html new file mode 100644 index 0000000000..d37f62af8f --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-client-hints.https.html @@ -0,0 +1,37 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-client-hints.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-client-hints.https.html.headers new file mode 100644 index 0000000000..226bb1c3b1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-client-hints.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cookies.https.html b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cookies.https.html new file mode 100644 index 0000000000..e506b717e1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cookies.https.html @@ -0,0 +1,37 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cookies.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cookies.https.html.headers new file mode 100644 index 0000000000..226bb1c3b1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-cookies.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-storage.https.html b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-storage.https.html new file mode 100644 index 0000000000..19bce9e91e --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-storage.https.html @@ -0,0 +1,37 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-storage.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-storage.https.html.headers new file mode 100644 index 0000000000..226bb1c3b1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/clear-site-data-storage.https.html.headers @@ -0,0 +1 @@ +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/resources/check-client-hints.py b/testing/web-platform/tests/client-hints/clear-site-data/resources/check-client-hints.py new file mode 100644 index 0000000000..4fc4c331f2 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/resources/check-client-hints.py @@ -0,0 +1,15 @@ +""" +Step 2/6 (/client-hints/clear-site-data/clear-site-data-{}.https.html) +Step 3/4 (/client-hints/clear-site-data/set-client-hints-{}-clear-{}.https.html) +""" +def main(request, response): + if b"sec-ch-device-memory" in request.headers: + result = u"HadDeviceMemory" + else: + result = u"MissingDeviceMemory" + content = u''' + ''' % (result) + headers = [(b"Content-Type", b"text/html")] + return 200, headers, content diff --git a/testing/web-platform/tests/client-hints/clear-site-data/resources/clear-site-data.py b/testing/web-platform/tests/client-hints/clear-site-data/resources/clear-site-data.py new file mode 100644 index 0000000000..fd16be9fbc --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/resources/clear-site-data.py @@ -0,0 +1,12 @@ +""" +Step 5 (/client-hints/clear-site-data/clear-site-data-{}.https.html) +""" +def main(request, response): + content = u''' + ''' + headers = [(b"Content-Type", b"text/html"), (b"Clear-Site-Data", b'"%s"' % (request.GET.first(b"target", b"*")))] + return 200, headers, content diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-all.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-all.https.html new file mode 100644 index 0000000000..22ee0f9861 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-all.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-all.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-all.https.html.headers new file mode 100644 index 0000000000..9768d865bc --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-all.https.html.headers @@ -0,0 +1,2 @@ +Clear-Site-Data: "*" +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cache.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cache.https.html new file mode 100644 index 0000000000..3436138b2c --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cache.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cache.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cache.https.html.headers new file mode 100644 index 0000000000..bb61032ede --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cache.https.html.headers @@ -0,0 +1,2 @@ +Clear-Site-Data: "cache" +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-client-hints.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-client-hints.https.html new file mode 100644 index 0000000000..18aeab2f63 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-client-hints.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-client-hints.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-client-hints.https.html.headers new file mode 100644 index 0000000000..e815201076 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-client-hints.https.html.headers @@ -0,0 +1,2 @@ +Clear-Site-Data: "clientHints" +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cookies.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cookies.https.html new file mode 100644 index 0000000000..db780d3abd --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cookies.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cookies.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cookies.https.html.headers new file mode 100644 index 0000000000..d0c1afae77 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-cookies.https.html.headers @@ -0,0 +1,2 @@ +Clear-Site-Data: "cookies" +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-storage.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-storage.https.html new file mode 100644 index 0000000000..30d541b6ed --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-storage.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-storage.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-storage.https.html.headers new file mode 100644 index 0000000000..d898684cac --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-client-hints-after-clear-storage.https.html.headers @@ -0,0 +1,2 @@ +Clear-Site-Data: "storage" +Accept-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-all.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-all.https.html new file mode 100644 index 0000000000..062e72b544 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-all.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-all.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-all.https.html.headers new file mode 100644 index 0000000000..ebd7a88cc6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-all.https.html.headers @@ -0,0 +1,3 @@ +Clear-Site-Data: "*" +Accept-CH: Sec-CH-Device-Memory +Critical-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.https.html new file mode 100644 index 0000000000..ab97fa182b --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.https.html.headers new file mode 100644 index 0000000000..03d39b6fd7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.https.html.headers @@ -0,0 +1,3 @@ +Clear-Site-Data: "cache" +Accept-CH: Sec-CH-Device-Memory +Critical-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-client-hints.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-client-hints.https.html new file mode 100644 index 0000000000..cdddb9ff35 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-client-hints.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-client-hints.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-client-hints.https.html.headers new file mode 100644 index 0000000000..f55913cb5b --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-client-hints.https.html.headers @@ -0,0 +1,3 @@ +Clear-Site-Data: "clientHints" +Accept-CH: Sec-CH-Device-Memory +Critical-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.https.html new file mode 100644 index 0000000000..0060f3aaa0 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.https.html.headers new file mode 100644 index 0000000000..69c7e720ac --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.https.html.headers @@ -0,0 +1,3 @@ +Clear-Site-Data: "cookies" +Accept-CH: Sec-CH-Device-Memory +Critical-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-storage.https.html b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-storage.https.html new file mode 100644 index 0000000000..9237e28ced --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-storage.https.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-storage.https.html.headers b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-storage.https.html.headers new file mode 100644 index 0000000000..0f18541cf7 --- /dev/null +++ b/testing/web-platform/tests/client-hints/clear-site-data/set-critical-client-hints-after-clear-storage.https.html.headers @@ -0,0 +1,3 @@ +Clear-Site-Data: "storage" +Accept-CH: Sec-CH-Device-Memory +Critical-CH: Sec-CH-Device-Memory diff --git a/testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.no-restart.https.html b/testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.no-restart.https.html new file mode 100644 index 0000000000..a7c2ad705d --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.no-restart.https.html @@ -0,0 +1,13 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.restart.https.html b/testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.restart.https.html new file mode 100644 index 0000000000..d3a49a2e91 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.restart.https.html @@ -0,0 +1,14 @@ + + + + + + + diff --git a/testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.restart.https.html.headers b/testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.restart.https.html.headers new file mode 100644 index 0000000000..b221a32886 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/critical-ch.navigation-timing.restart.https.html.headers @@ -0,0 +1,2 @@ +Accept-CH: sec-ch-device-memory +Critical-CH: sec-ch-device-memory 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..cbf128149e --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/iframe.https.window.js @@ -0,0 +1,15 @@ +// META: script=resources/util.js + +async_test((t) => { + window.addEventListener('message', message_listener(t, "FAIL")); + var iframe = document.createElement("iframe"); + iframe.src = ECHO_URL; + document.body.appendChild(iframe); +}, "Critical-CH iframe"); + +async_test((t) => { + window.addEventListener('message', message_listener(t, "FAIL")); + var iframe = document.createElement("iframe"); + iframe.src = ECHO_URL+"?multiple=true"; + document.body.appendChild(iframe); +}, "Critical-CH w/ multiple headers and 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..23d297837e --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/mis-matched-count.https.window.js @@ -0,0 +1,5 @@ +// 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") +async_test(make_message_test(ECHO_URL+"?multiple=true&mismatch=true&token="+token(), "1"), "Critical-CH w/ multiple headers and 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/mis-matched.multiple.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/mis-matched.multiple.https.window.js new file mode 100644 index 0000000000..97b94ccf71 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/mis-matched.multiple.https.window.js @@ -0,0 +1,3 @@ +// META: script=resources/util.js + +async_test(make_message_test(ECHO_URL+"?multiple=true&mismatch=true", "FAIL"), "Critical-CH w/ multiple headers and Mis-matched hints") diff --git a/testing/web-platform/tests/client-hints/critical-ch/navigation.cross-origin.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/navigation.cross-origin.https.window.js new file mode 100644 index 0000000000..6fdcee71d4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/navigation.cross-origin.https.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js +// META: script=/common/get-host-info.sub.js + +async_test(make_message_test(get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL, "PASS"), "Critical-CH cross-origin navigation") diff --git a/testing/web-platform/tests/client-hints/critical-ch/navigation.cross-origin.multiple.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/navigation.cross-origin.multiple.https.window.js new file mode 100644 index 0000000000..91a57da3e4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/navigation.cross-origin.multiple.https.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js +// META: script=/common/get-host-info.sub.js + +async_test(make_message_test(get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "PASS"), "Critical-CH w/ multiple headers and cross-origin navigation") diff --git a/testing/web-platform/tests/client-hints/critical-ch/navigation.same-origin.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/navigation.same-origin.https.window.js new file mode 100644 index 0000000000..549b321443 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/navigation.same-origin.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/navigation.same-origin.multiple.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/navigation.same-origin.multiple.https.window.js new file mode 100644 index 0000000000..ff9cc210fe --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/navigation.same-origin.multiple.https.window.js @@ -0,0 +1,3 @@ +// META: script=resources/util.js + +async_test(make_message_test(ECHO_URL+"?multiple=true", "PASS"), "Critical-CH w/ multiple headers and 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..b634f98e55 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/non-secure.http.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js + +async_test(make_message_test(ECHO_URL, "FAIL"), "Critical-CH navigation non-secure") +async_test(make_message_test(ECHO_URL+"?multiple=true", "FAIL"), "Critical-CH w/ multiple headers and navigation non-secure") diff --git a/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.cross-origin.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.cross-origin.https.window.js new file mode 100644 index 0000000000..74d9a0cc3b --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.cross-origin.https.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js +// META: script=/common/get-host-info.sub.js + +async_test(make_message_test(REDIRECT_URL+"?critical=true&location="+get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL, "PASS"), "Critical-CH cross-origin critical redirect") diff --git a/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.cross-origin.multiple.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.cross-origin.multiple.https.window.js new file mode 100644 index 0000000000..d1a3c67ecb --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.cross-origin.multiple.https.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js +// META: script=/common/get-host-info.sub.js + +async_test(make_message_test(REDIRECT_URL+"?critical=true&location="+get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "PASS"), "Critical-CH w/ multiple headers cross-origin critical redirect") diff --git a/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.same-origin.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.same-origin.https.window.js new file mode 100644 index 0000000000..1c6511a007 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.same-origin.https.window.js @@ -0,0 +1,3 @@ +// META: script=resources/util.js + +async_test(make_message_test(REDIRECT_URL+"?critical=true&location=/client-hints/critical-ch/"+ECHO_URL, "FAIL"), "Critical-CH critical redirect") diff --git a/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.same-origin.multiple.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.same-origin.multiple.https.window.js new file mode 100644 index 0000000000..5bf653afbc --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/redirect.critical.same-origin.multiple.https.window.js @@ -0,0 +1,3 @@ +// META: script=resources/util.js + +async_test(make_message_test(REDIRECT_URL+"?critical=true&location=/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "FAIL"), "Critical-CH w/ multiple headers and critical redirect") diff --git a/testing/web-platform/tests/client-hints/critical-ch/redirect.cross-origin.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/redirect.cross-origin.https.window.js new file mode 100644 index 0000000000..5d781bd082 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/redirect.cross-origin.https.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js +// META: script=/common/get-host-info.sub.js + +async_test(make_message_test(REDIRECT_URL+"?location="+get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL, "PASS"), "Critical-CH cross-origin redirect") diff --git a/testing/web-platform/tests/client-hints/critical-ch/redirect.cross-origin.multiple.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/redirect.cross-origin.multiple.https.window.js new file mode 100644 index 0000000000..5688c8459c --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/redirect.cross-origin.multiple.https.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js +// META: script=/common/get-host-info.sub.js + +async_test(make_message_test(REDIRECT_URL+"?location="+get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "PASS"), "Critical-CH w/ multiple headers cross-origin redirect") diff --git a/testing/web-platform/tests/client-hints/critical-ch/redirect.same-origin.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/redirect.same-origin.https.window.js new file mode 100644 index 0000000000..b2401025d9 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/redirect.same-origin.https.window.js @@ -0,0 +1,3 @@ +// META: script=resources/util.js + +async_test(make_message_test(REDIRECT_URL+"?location=/client-hints/critical-ch/"+ECHO_URL, "PASS"), "Critical-CH redirect") diff --git a/testing/web-platform/tests/client-hints/critical-ch/redirect.same-origin.multiple.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/redirect.same-origin.multiple.https.window.js new file mode 100644 index 0000000000..86305023f4 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/redirect.same-origin.multiple.https.window.js @@ -0,0 +1,3 @@ +// META: script=resources/util.js + +async_test(make_message_test(REDIRECT_URL+"?location=/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "PASS"), "Critical-CH w/ multiple headers and redirect") 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/request-count.multiple.https.window.js b/testing/web-platform/tests/client-hints/critical-ch/request-count.multiple.https.window.js new file mode 100644 index 0000000000..602803b5d6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/request-count.multiple.https.window.js @@ -0,0 +1,4 @@ +// META: script=resources/util.js +// META: script=/common/utils.js + +async_test(make_message_test(ECHO_URL+"?multiple=true&token="+token(), "2"), "Critical-CH w/ multiple headers and 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..a5c5160f75 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/resources/echo-critical-hint.py @@ -0,0 +1,52 @@ +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"*") + + accept = b"sec-ch-device-memory,device-memory" + if(request.GET.first(b"multiple", None) is not None): + for accept_part in accept.split(b","): + response.headers.append(b"Accept-CH", accept_part) + else: + response.headers.append(b"Accept-CH", accept) + + 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" + + if(request.GET.first(b"multiple", None) is not None): + for critical_part in critical.split(b","): + response.headers.append(b"Critical-CH", critical_part) + else: + 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/redirect-critical-hint.py b/testing/web-platform/tests/client-hints/critical-ch/resources/redirect-critical-hint.py new file mode 100644 index 0000000000..77b8652e20 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/resources/redirect-critical-hint.py @@ -0,0 +1,14 @@ +def main(request, response): + """ + Simple handler that redirects to echo-critical-hint.py. + """ + + response.status = 302 + location = request.GET.first(b"location") + response.headers.set(b"Location", location) + response.headers.set(b"Access-Control-Allow-Origin", b"*") + if(request.GET.first(b"critical", None) is not None): + hints = b"sec-ch-dpr,dpr" + response.headers.append(b"Accept-CH", hints) + response.headers.append(b"Critical-CH", hints) + 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..36800f1e4f --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/resources/util.js @@ -0,0 +1,16 @@ +ECHO_URL = "resources/echo-critical-hint.py" +REDIRECT_URL = "resources/redirect-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?"); + 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..81dfc303c6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/subresource.https.window.js @@ -0,0 +1,18 @@ +// META: script=resources/util.js +// META: script=/common/utils.js + +promise_test(() => + fetch(ECHO_URL) + .then((r) => r.text()) + .then((r) => { + assert_true(r.includes("FAIL")); + }) +, "Critical-CH subresource fetch"); + +promise_test(() => + fetch(ECHO_URL+"?multiple=true") + .then((r) => r.text()) + .then((r) => { + assert_true(r.includes("FAIL")); + }) +, "Critical-CH w/ multiple headers and 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..61fca618f3 --- /dev/null +++ b/testing/web-platform/tests/client-hints/critical-ch/unsafe-method.https.window.js @@ -0,0 +1,49 @@ +// META: script=resources/util.js + +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", ECHO_URL); + form.setAttribute("target", "popup"); //don't navigate away from the page running the test... + document.body.appendChild(form); + + window.addEventListener('message', (e) => { + t.step(()=>{assert_equals(e.data, "FAIL")}); + t.done(); + }); + + var popup_window = window.open("/common/blank.html", "popup"); + assert_not_equals(popup_window, null, "Popup windows not allowed?"); + + form.submit(); +}, "Critical-CH unsafe method") + +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", ECHO_URL+"?multiple=true"); + form.setAttribute("target", "popup"); //don't navigate away from the page running the test... + document.body.appendChild(form); + + window.addEventListener('message', (e) => { + t.step(()=>{assert_equals(e.data, "FAIL")}); + t.done(); + }); + + var popup_window = window.open("/common/blank.html", "popup"); + assert_not_equals(popup_window, null, "Popup windows not allowed?"); + + form.submit(); +}, "Critical-CH w/ multiple headers and 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..bc578afb1e --- /dev/null +++ b/testing/web-platform/tests/client-hints/http-equiv-accept-ch-merge.https.html @@ -0,0 +1,50 @@ + + + + + + + + + + + + + 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..79221efe95 --- /dev/null +++ b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-injection.https.html @@ -0,0 +1,43 @@ + + + + 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..1039be4dbe --- /dev/null +++ b/testing/web-platform/tests/client-hints/meta-equiv-delegate-ch-merge.https.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + 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-mixed.html b/testing/web-platform/tests/client-hints/resources/accept-ch-mixed.html new file mode 100644 index 0000000000..bf604dffee --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-mixed.html @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch-mixed.html.headers b/testing/web-platform/tests/client-hints/resources/accept-ch-mixed.html.headers new file mode 100644 index 0000000000..39d4e1935d --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-mixed.html.headers @@ -0,0 +1,5 @@ +Accept-CH: +Accept-CH: sec-ch-device-memory +Accept-CH: device-memory +Accept-CH: +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch-split.html b/testing/web-platform/tests/client-hints/resources/accept-ch-split.html new file mode 100644 index 0000000000..5038b94013 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-split.html @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch-split.html.headers b/testing/web-platform/tests/client-hints/resources/accept-ch-split.html.headers new file mode 100644 index 0000000000..261e1e8ee6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch-split.html.headers @@ -0,0 +1,3 @@ +Accept-CH: sec-ch-device-memory +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/accept-ch.wildcard.iframe.https.sub.html b/testing/web-platform/tests/client-hints/resources/accept-ch.wildcard.iframe.https.sub.html new file mode 100644 index 0000000000..250a9d9e22 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch.wildcard.iframe.https.sub.html @@ -0,0 +1,16 @@ + + + diff --git a/testing/web-platform/tests/client-hints/resources/accept-ch.wildcard.iframe.https.sub.html.sub.headers b/testing/web-platform/tests/client-hints/resources/accept-ch.wildcard.iframe.https.sub.html.sub.headers new file mode 100644 index 0000000000..c1c0fcd5c2 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/accept-ch.wildcard.iframe.https.sub.html.sub.headers @@ -0,0 +1 @@ +Permissions-Policy: ch-ua-platform-version=("https://*.{{domains[]}}:{{ports[https][0]}}") \ No newline at end of file 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..badf716c02 --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/clienthintslist.py @@ -0,0 +1,41 @@ +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", + b"sec-ch-prefers-reduced-transparency", + ] + +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..0aa5bfb25c --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/echo-client-hints-received.py @@ -0,0 +1,38 @@ +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")) + if b"sec-ch-prefers-reduced-transparency" in request.headers: + response.headers.set(b"prefers-reduced-transparency-received", request.headers.get(b"sec-ch-prefers-reduced-transparency")) 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..e2596e1c6f --- /dev/null +++ b/testing/web-platform/tests/client-hints/resources/export.js @@ -0,0 +1,50 @@ +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", + "sec-ch-prefers-reduced-transparency", +]; + +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("&"); 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..4d4739028d --- /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, sec-ch-prefers-reduced-transparency 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..96d2886f0e --- /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/sandbox/resources/util.js b/testing/web-platform/tests/client-hints/sandbox/resources/util.js new file mode 100644 index 0000000000..8c25e5ad8b --- /dev/null +++ b/testing/web-platform/tests/client-hints/sandbox/resources/util.js @@ -0,0 +1,25 @@ +function sandbox_iframe_test(sandbox, src, title) { + return promise_test(async t => { + const iframe = document.createElement("iframe"); + if (sandbox !== "") + iframe.sandbox = sandbox; + iframe.src = src; + + let msg = await new Promise(resolve => { + window.addEventListener('message', resolve); + document.body.appendChild(iframe); + }); + + assert_equals(msg.data, "PASS", "message from opened frame"); + await fetch("/client-hints/accept-ch-stickiness/resources/clear-site-data.html"); + }, title); +} + +function sandbox_popup_listener(src) { + window.addEventListener('message', e => { + window.parent.postMessage(e.data, '*'); + }); + + let popup_window = window.open("/resources/blank.html"); + popup_window.location.href = src; +} \ No newline at end of file diff --git a/testing/web-platform/tests/client-hints/sec-ch-quotes.https.html b/testing/web-platform/tests/client-hints/sec-ch-quotes.https.html new file mode 100644 index 0000000000..08f7c51af0 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sec-ch-quotes.https.html @@ -0,0 +1,64 @@ + + +Tests Stale While Revalidate is not executed for fetch API + + + + diff --git a/testing/web-platform/tests/client-hints/sec-ch-quotes.https.html.headers b/testing/web-platform/tests/client-hints/sec-ch-quotes.https.html.headers new file mode 100644 index 0000000000..1d6f8f26fb --- /dev/null +++ b/testing/web-platform/tests/client-hints/sec-ch-quotes.https.html.headers @@ -0,0 +1 @@ +Accept-CH: sec-ch-ua,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-prefers-color-scheme,sec-ch-prefers-reduced-motion,sec-ch-prefers-reduced-transparency diff --git a/testing/web-platform/tests/client-hints/sec-ch-ua.http.html b/testing/web-platform/tests/client-hints/sec-ch-ua.http.html new file mode 100644 index 0000000000..e333c60530 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sec-ch-ua.http.html @@ -0,0 +1,16 @@ + + + + diff --git a/testing/web-platform/tests/client-hints/sec-ch-ua.https.html b/testing/web-platform/tests/client-hints/sec-ch-ua.https.html new file mode 100644 index 0000000000..deb8169216 --- /dev/null +++ b/testing/web-platform/tests/client-hints/sec-ch-ua.https.html @@ -0,0 +1,50 @@ + + + + + + diff --git a/testing/web-platform/tests/client-hints/service-workers/critical-ch/echo-hint-in-html.py b/testing/web-platform/tests/client-hints/service-workers/critical-ch/echo-hint-in-html.py new file mode 100644 index 0000000000..87a1afed7c --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/critical-ch/echo-hint-in-html.py @@ -0,0 +1,24 @@ +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"Cache-Control", b"no-store") + + response.headers.append(b"Accept-CH", b"sec-ch-device-memory,device-memory"); + response.headers.append(b"Critical-CH", b"sec-ch-device-memory,device-memory"); + + result = "FAIL" + + if b"sec-ch-device-memory" in request.headers and b"device-memory" in request.headers: + result = "PASS" + + response.content = result diff --git a/testing/web-platform/tests/client-hints/service-workers/critical-ch/foo.html b/testing/web-platform/tests/client-hints/service-workers/critical-ch/foo.html new file mode 100644 index 0000000000..ba578e48b1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/critical-ch/foo.html @@ -0,0 +1 @@ +BAR diff --git a/testing/web-platform/tests/client-hints/service-workers/critical-ch/foo.html.headers b/testing/web-platform/tests/client-hints/service-workers/critical-ch/foo.html.headers new file mode 100644 index 0000000000..56b489178e --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/critical-ch/foo.html.headers @@ -0,0 +1,2 @@ +Accept-CH: sec-ch-device-memory, device-memory +Critical-CH: sec-ch-device-memory, device-memory diff --git a/testing/web-platform/tests/client-hints/service-workers/critical-ch/intercept-request.js b/testing/web-platform/tests/client-hints/service-workers/critical-ch/intercept-request.js new file mode 100644 index 0000000000..4d27ceadcc --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/critical-ch/intercept-request.js @@ -0,0 +1,6 @@ +self.addEventListener('fetch', (event) => { + result="FAIL"; + if(event.request.headers.has("sec-ch-device-memory") && event.request.headers.has("device-memory")) + result="PASS"; + event.respondWith(new Response(result)); +}); diff --git a/testing/web-platform/tests/client-hints/service-workers/critical-ch/navigation-preload.js b/testing/web-platform/tests/client-hints/service-workers/critical-ch/navigation-preload.js new file mode 100644 index 0000000000..d8a38ee7de --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/critical-ch/navigation-preload.js @@ -0,0 +1,2 @@ +self.addEventListener('activate', () => self.registration.navigationPreload.enable()); +self.addEventListener('fetch', (event) => event.respondWith(event.preloadResponse)); diff --git a/testing/web-platform/tests/client-hints/service-workers/critical-ch/new-request.js b/testing/web-platform/tests/client-hints/service-workers/critical-ch/new-request.js new file mode 100644 index 0000000000..395c77183e --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/critical-ch/new-request.js @@ -0,0 +1,3 @@ +self.addEventListener('fetch', (event) => { + event.respondWith(fetch("/client-hints/service-workers/resources/echo-hint-in-html.py")) +}); diff --git a/testing/web-platform/tests/client-hints/service-workers/critical-ch/passthrough-request.js b/testing/web-platform/tests/client-hints/service-workers/critical-ch/passthrough-request.js new file mode 100644 index 0000000000..5541c5eb55 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/critical-ch/passthrough-request.js @@ -0,0 +1 @@ +self.addEventListener('fetch', (event) => fetch(event.request)); diff --git a/testing/web-platform/tests/client-hints/service-workers/intercept-request-critical.https.window.js b/testing/web-platform/tests/client-hints/service-workers/intercept-request-critical.https.window.js new file mode 100644 index 0000000000..079b9fd9ba --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/intercept-request-critical.https.window.js @@ -0,0 +1,5 @@ +// META: script=/service-workers/service-worker/resources/test-helpers.sub.js +// META: script=resources/util.js +promise_test((t) => + ch_sw_test(t, 'critical-ch/intercept-request.js', 'critical-ch/foo.html', 'FAIL'), + "Service workers succsefully receives hints from request"); diff --git a/testing/web-platform/tests/client-hints/service-workers/intercept-request.https.html b/testing/web-platform/tests/client-hints/service-workers/intercept-request.https.html new file mode 100644 index 0000000000..00e024b7b6 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/intercept-request.https.html @@ -0,0 +1,11 @@ + +Client Hint/Service Worker interaction + + + + + diff --git a/testing/web-platform/tests/client-hints/service-workers/intercept-request.https.html.headers b/testing/web-platform/tests/client-hints/service-workers/intercept-request.https.html.headers new file mode 100644 index 0000000000..546ac83d4b --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/intercept-request.https.html.headers @@ -0,0 +1 @@ +Accept-CH: sec-ch-device-memory, device-memory diff --git a/testing/web-platform/tests/client-hints/service-workers/navigation-preload-critical.https.window.js b/testing/web-platform/tests/client-hints/service-workers/navigation-preload-critical.https.window.js new file mode 100644 index 0000000000..5d05ab3c53 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/navigation-preload-critical.https.window.js @@ -0,0 +1,5 @@ +//META: script=/service-workers/service-worker/resources/test-helpers.sub.js +//META: script=resources/util.js +promise_test((t) => + ch_sw_test(t, 'critical-ch/navigation-preload.js', 'critical-ch/echo-hint-in-html.py', 'PASS'), + "Service worker successfully passes hints through to new fetch"); diff --git a/testing/web-platform/tests/client-hints/service-workers/navigation-preload.https.html b/testing/web-platform/tests/client-hints/service-workers/navigation-preload.https.html new file mode 100644 index 0000000000..a952e1e406 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/navigation-preload.https.html @@ -0,0 +1,11 @@ + +Client Hint/Service Worker interaction + + + + + diff --git a/testing/web-platform/tests/client-hints/service-workers/navigation-preload.https.html.headers b/testing/web-platform/tests/client-hints/service-workers/navigation-preload.https.html.headers new file mode 100644 index 0000000000..546ac83d4b --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/navigation-preload.https.html.headers @@ -0,0 +1 @@ +Accept-CH: sec-ch-device-memory, device-memory diff --git a/testing/web-platform/tests/client-hints/service-workers/new-request-critical.https.window.js b/testing/web-platform/tests/client-hints/service-workers/new-request-critical.https.window.js new file mode 100644 index 0000000000..9dee11a934 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/new-request-critical.https.window.js @@ -0,0 +1,5 @@ +//META: script=/service-workers/service-worker/resources/test-helpers.sub.js +//META: script=resources/util.js +promise_test((t) => + ch_sw_test(t, 'critical-ch/new-request.js', 'critical-ch/foo.html', 'FAIL'), + "Service worker does NOT generate client hints in a new request"); diff --git a/testing/web-platform/tests/client-hints/service-workers/new-request.https.html b/testing/web-platform/tests/client-hints/service-workers/new-request.https.html new file mode 100644 index 0000000000..006ec24e8b --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/new-request.https.html @@ -0,0 +1,11 @@ + +Client Hint/Service Worker interaction + + + + + diff --git a/testing/web-platform/tests/client-hints/service-workers/new-request.https.html.headers b/testing/web-platform/tests/client-hints/service-workers/new-request.https.html.headers new file mode 100644 index 0000000000..546ac83d4b --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/new-request.https.html.headers @@ -0,0 +1 @@ +Accept-CH: sec-ch-device-memory, device-memory diff --git a/testing/web-platform/tests/client-hints/service-workers/passthrough-request-critical.https.window.js b/testing/web-platform/tests/client-hints/service-workers/passthrough-request-critical.https.window.js new file mode 100644 index 0000000000..4d59f5f478 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/passthrough-request-critical.https.window.js @@ -0,0 +1,5 @@ +//META: script=/service-workers/service-worker/resources/test-helpers.sub.js +//META: script=resources/util.js +promise_test((t) => + ch_sw_test(t, 'critical-ch/passthrough-request.js', 'critical-ch/echo-hint-in-html.py', 'PASS'), + "Service worker successfully passes hints through to new fetch"); diff --git a/testing/web-platform/tests/client-hints/service-workers/passthrough-request.https.html b/testing/web-platform/tests/client-hints/service-workers/passthrough-request.https.html new file mode 100644 index 0000000000..8dca424098 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/passthrough-request.https.html @@ -0,0 +1,11 @@ + +Client Hint/Service Worker interaction + + + + + diff --git a/testing/web-platform/tests/client-hints/service-workers/passthrough-request.https.html.headers b/testing/web-platform/tests/client-hints/service-workers/passthrough-request.https.html.headers new file mode 100644 index 0000000000..546ac83d4b --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/passthrough-request.https.html.headers @@ -0,0 +1 @@ +Accept-CH: sec-ch-device-memory, device-memory diff --git a/testing/web-platform/tests/client-hints/service-workers/resources/echo-hint-in-html.py b/testing/web-platform/tests/client-hints/service-workers/resources/echo-hint-in-html.py new file mode 100644 index 0000000000..e029b5433b --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/resources/echo-hint-in-html.py @@ -0,0 +1,21 @@ +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"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" + + response.content = result diff --git a/testing/web-platform/tests/client-hints/service-workers/resources/foo.html b/testing/web-platform/tests/client-hints/service-workers/resources/foo.html new file mode 100644 index 0000000000..ba578e48b1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/resources/foo.html @@ -0,0 +1 @@ +BAR diff --git a/testing/web-platform/tests/client-hints/service-workers/resources/intercept-request.js b/testing/web-platform/tests/client-hints/service-workers/resources/intercept-request.js new file mode 100644 index 0000000000..4d27ceadcc --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/resources/intercept-request.js @@ -0,0 +1,6 @@ +self.addEventListener('fetch', (event) => { + result="FAIL"; + if(event.request.headers.has("sec-ch-device-memory") && event.request.headers.has("device-memory")) + result="PASS"; + event.respondWith(new Response(result)); +}); diff --git a/testing/web-platform/tests/client-hints/service-workers/resources/navigation-preload.js b/testing/web-platform/tests/client-hints/service-workers/resources/navigation-preload.js new file mode 100644 index 0000000000..d8a38ee7de --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/resources/navigation-preload.js @@ -0,0 +1,2 @@ +self.addEventListener('activate', () => self.registration.navigationPreload.enable()); +self.addEventListener('fetch', (event) => event.respondWith(event.preloadResponse)); diff --git a/testing/web-platform/tests/client-hints/service-workers/resources/new-request.js b/testing/web-platform/tests/client-hints/service-workers/resources/new-request.js new file mode 100644 index 0000000000..395c77183e --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/resources/new-request.js @@ -0,0 +1,3 @@ +self.addEventListener('fetch', (event) => { + event.respondWith(fetch("/client-hints/service-workers/resources/echo-hint-in-html.py")) +}); diff --git a/testing/web-platform/tests/client-hints/service-workers/resources/passthrough-request.js b/testing/web-platform/tests/client-hints/service-workers/resources/passthrough-request.js new file mode 100644 index 0000000000..5541c5eb55 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/resources/passthrough-request.js @@ -0,0 +1 @@ +self.addEventListener('fetch', (event) => fetch(event.request)); diff --git a/testing/web-platform/tests/client-hints/service-workers/resources/util.js b/testing/web-platform/tests/client-hints/service-workers/resources/util.js new file mode 100644 index 0000000000..d9b8f3f4d9 --- /dev/null +++ b/testing/web-platform/tests/client-hints/service-workers/resources/util.js @@ -0,0 +1,23 @@ +async function ch_sw_test(t, worker, url, response) { + r = await service_worker_unregister_and_register(t, worker, url); + await wait_for_state(t, r.installing, 'activated') + var popup_window = window.open("/common/blank.html"); + assert_not_equals(popup_window, null, "Popup windows not allowed?"); + + t.add_cleanup(async _=>{ + popup_window.close(); + await r.unregister(); + }); + + popup_load = new Promise((resolve, reject) => { + popup_window.addEventListener('load', t.step_func((e) => { + if(popup_window.location.pathname != "/blank.html") { + assert_equals(popup_window.document.body.textContent, response); + resolve(); + } + })) + }); + + popup_window.location = url; + await popup_load; +} diff --git a/testing/web-platform/tests/client-hints/viewport-size/viewport-size-iframe.https.html b/testing/web-platform/tests/client-hints/viewport-size/viewport-size-iframe.https.html new file mode 100644 index 0000000000..6cb549d8f1 --- /dev/null +++ b/testing/web-platform/tests/client-hints/viewport-size/viewport-size-iframe.https.html @@ -0,0 +1,17 @@ + + + + + + + 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 @@ + + + + + + +