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 --- ...issions-policy-default.tentative.https.sub.html | 55 ++++++++++++++++++ ...ermissions-policy-none.tentative.https.sub.html | 59 +++++++++++++++++++ ...ns-policy-none.tentative.https.sub.html.headers | 1 + ...ermissions-policy-self.tentative.https.sub.html | 66 ++++++++++++++++++++++ ...ns-policy-self.tentative.https.sub.html.headers | 1 + ...cument-api-insecure-context.tentative.http.html | 17 ++++++ .../document-api.tentative.https.html | 15 +++++ ...-visible-in-service-worker.tentative.https.html | 36 ++++++++++++ ...tch-topics-insecure-context.tentative.http.html | 17 ++++++ .../fetch-topics.tentative.https.html | 17 ++++++ .../fetch-without-topics-flag.tentative.https.html | 15 +++++ ...ribute-insecure-context.tentative.http.sub.html | 36 ++++++++++++ .../iframe-topics-attribute.tentative.https.html | 19 +++++++ .../check-topics-request-header-notify-parent.py | 18 ++++++ .../resources/check-topics-request-header.py | 4 ++ ...document-api-notify-parent.tentative.https.html | 11 ++++ .../tests/browsing-topics/resources/empty.html | 1 + ...e-in-service-worker-helper.tentative.https.html | 21 +++++++ .../browsing-topics/resources/fetch-topics.js | 14 +++++ .../browsing-topics/resources/header-util.sub.js | 38 +++++++++++++ .../browsing-topics/resources/intercept-request.js | 12 ++++ .../resources/permissions-policy-util.sub.js | 30 ++++++++++ ...ervice-worker-fetch-helper.tentative.https.html | 19 +++++++ ...d-for-service-worker-fetch.tentative.https.html | 36 ++++++++++++ 24 files changed, 558 insertions(+) create mode 100644 testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-default.tentative.https.sub.html create mode 100644 testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-none.tentative.https.sub.html create mode 100644 testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-none.tentative.https.sub.html.headers create mode 100644 testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-self.tentative.https.sub.html create mode 100644 testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-self.tentative.https.sub.html.headers create mode 100644 testing/web-platform/tests/browsing-topics/document-api-insecure-context.tentative.http.html create mode 100644 testing/web-platform/tests/browsing-topics/document-api.tentative.https.html create mode 100644 testing/web-platform/tests/browsing-topics/fetch-topics-header-not-visible-in-service-worker.tentative.https.html create mode 100644 testing/web-platform/tests/browsing-topics/fetch-topics-insecure-context.tentative.http.html create mode 100644 testing/web-platform/tests/browsing-topics/fetch-topics.tentative.https.html create mode 100644 testing/web-platform/tests/browsing-topics/fetch-without-topics-flag.tentative.https.html create mode 100644 testing/web-platform/tests/browsing-topics/iframe-topics-attribute-insecure-context.tentative.http.sub.html create mode 100644 testing/web-platform/tests/browsing-topics/iframe-topics-attribute.tentative.https.html create mode 100644 testing/web-platform/tests/browsing-topics/resources/check-topics-request-header-notify-parent.py create mode 100644 testing/web-platform/tests/browsing-topics/resources/check-topics-request-header.py create mode 100644 testing/web-platform/tests/browsing-topics/resources/document-api-notify-parent.tentative.https.html create mode 100644 testing/web-platform/tests/browsing-topics/resources/empty.html create mode 100644 testing/web-platform/tests/browsing-topics/resources/fetch-topics-header-not-visible-in-service-worker-helper.tentative.https.html create mode 100644 testing/web-platform/tests/browsing-topics/resources/fetch-topics.js create mode 100644 testing/web-platform/tests/browsing-topics/resources/header-util.sub.js create mode 100644 testing/web-platform/tests/browsing-topics/resources/intercept-request.js create mode 100644 testing/web-platform/tests/browsing-topics/resources/permissions-policy-util.sub.js create mode 100644 testing/web-platform/tests/browsing-topics/resources/topics-not-allowed-for-service-worker-fetch-helper.tentative.https.html create mode 100644 testing/web-platform/tests/browsing-topics/topics-not-allowed-for-service-worker-fetch.tentative.https.html (limited to 'testing/web-platform/tests/browsing-topics') diff --git a/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-default.tentative.https.sub.html b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-default.tentative.https.sub.html new file mode 100644 index 0000000000..8467ab6569 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-default.tentative.https.sub.html @@ -0,0 +1,55 @@ + + + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-none.tentative.https.sub.html b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-none.tentative.https.sub.html new file mode 100644 index 0000000000..23bac4381f --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-none.tentative.https.sub.html @@ -0,0 +1,59 @@ + + + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-none.tentative.https.sub.html.headers b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-none.tentative.https.sub.html.headers new file mode 100644 index 0000000000..9c93ff7384 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-none.tentative.https.sub.html.headers @@ -0,0 +1 @@ +Permissions-Policy: browsing-topics=() diff --git a/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-self.tentative.https.sub.html b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-self.tentative.https.sub.html new file mode 100644 index 0000000000..91ee4f05f3 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-self.tentative.https.sub.html @@ -0,0 +1,66 @@ + + + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-self.tentative.https.sub.html.headers b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-self.tentative.https.sub.html.headers new file mode 100644 index 0000000000..6eb902eb68 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-self.tentative.https.sub.html.headers @@ -0,0 +1 @@ +Permissions-Policy: browsing-topics=(self) diff --git a/testing/web-platform/tests/browsing-topics/document-api-insecure-context.tentative.http.html b/testing/web-platform/tests/browsing-topics/document-api-insecure-context.tentative.http.html new file mode 100644 index 0000000000..b2f0abf8e0 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/document-api-insecure-context.tentative.http.html @@ -0,0 +1,17 @@ + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/document-api.tentative.https.html b/testing/web-platform/tests/browsing-topics/document-api.tentative.https.html new file mode 100644 index 0000000000..d1d515ccba --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/document-api.tentative.https.html @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/fetch-topics-header-not-visible-in-service-worker.tentative.https.html b/testing/web-platform/tests/browsing-topics/fetch-topics-header-not-visible-in-service-worker.tentative.https.html new file mode 100644 index 0000000000..76f7b90957 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/fetch-topics-header-not-visible-in-service-worker.tentative.https.html @@ -0,0 +1,36 @@ + + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/fetch-topics-insecure-context.tentative.http.html b/testing/web-platform/tests/browsing-topics/fetch-topics-insecure-context.tentative.http.html new file mode 100644 index 0000000000..d4cdd9ae95 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/fetch-topics-insecure-context.tentative.http.html @@ -0,0 +1,17 @@ + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/fetch-topics.tentative.https.html b/testing/web-platform/tests/browsing-topics/fetch-topics.tentative.https.html new file mode 100644 index 0000000000..c33d4dd11d --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/fetch-topics.tentative.https.html @@ -0,0 +1,17 @@ + + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/fetch-without-topics-flag.tentative.https.html b/testing/web-platform/tests/browsing-topics/fetch-without-topics-flag.tentative.https.html new file mode 100644 index 0000000000..f942915a7f --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/fetch-without-topics-flag.tentative.https.html @@ -0,0 +1,15 @@ + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/iframe-topics-attribute-insecure-context.tentative.http.sub.html b/testing/web-platform/tests/browsing-topics/iframe-topics-attribute-insecure-context.tentative.http.sub.html new file mode 100644 index 0000000000..8e25b769ce --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/iframe-topics-attribute-insecure-context.tentative.http.sub.html @@ -0,0 +1,36 @@ + + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/iframe-topics-attribute.tentative.https.html b/testing/web-platform/tests/browsing-topics/iframe-topics-attribute.tentative.https.html new file mode 100644 index 0000000000..7b3b6c7045 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/iframe-topics-attribute.tentative.https.html @@ -0,0 +1,19 @@ + + + + + + + diff --git a/testing/web-platform/tests/browsing-topics/resources/check-topics-request-header-notify-parent.py b/testing/web-platform/tests/browsing-topics/resources/check-topics-request-header-notify-parent.py new file mode 100644 index 0000000000..98c77c2b0b --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/check-topics-request-header-notify-parent.py @@ -0,0 +1,18 @@ +def main(request, response): + """ + Returns an HTML response that notifies its parent frame the topics header + via postMessage + """ + + topics_header = request.headers.get(b"sec-browsing-topics", b"NO_TOPICS_HEADER") + + headers = [(b"Content-Type", b"text/html"), + (b"Access-Control-Allow-Origin", b"*")] + content = b''' + +''' % (topics_header) + + return 200, headers, content diff --git a/testing/web-platform/tests/browsing-topics/resources/check-topics-request-header.py b/testing/web-platform/tests/browsing-topics/resources/check-topics-request-header.py new file mode 100644 index 0000000000..569b754496 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/check-topics-request-header.py @@ -0,0 +1,4 @@ +def main(request, response): + topics_header = request.headers.get(b"sec-browsing-topics", b"NO_TOPICS_HEADER") + response.headers.append(b"Access-Control-Allow-Origin", b"*") + response.content = topics_header diff --git a/testing/web-platform/tests/browsing-topics/resources/document-api-notify-parent.tentative.https.html b/testing/web-platform/tests/browsing-topics/resources/document-api-notify-parent.tentative.https.html new file mode 100644 index 0000000000..2fd55ebeb2 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/document-api-notify-parent.tentative.https.html @@ -0,0 +1,11 @@ + + + + diff --git a/testing/web-platform/tests/browsing-topics/resources/empty.html b/testing/web-platform/tests/browsing-topics/resources/empty.html new file mode 100644 index 0000000000..c50eddd41f --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/empty.html @@ -0,0 +1 @@ + diff --git a/testing/web-platform/tests/browsing-topics/resources/fetch-topics-header-not-visible-in-service-worker-helper.tentative.https.html b/testing/web-platform/tests/browsing-topics/resources/fetch-topics-header-not-visible-in-service-worker-helper.tentative.https.html new file mode 100644 index 0000000000..e9cb8144e0 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/fetch-topics-header-not-visible-in-service-worker-helper.tentative.https.html @@ -0,0 +1,21 @@ + + + + diff --git a/testing/web-platform/tests/browsing-topics/resources/fetch-topics.js b/testing/web-platform/tests/browsing-topics/resources/fetch-topics.js new file mode 100644 index 0000000000..71064a90c5 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/fetch-topics.js @@ -0,0 +1,14 @@ +self.addEventListener('message', event => { + if (event.data.fetchUrl) { + clients.matchAll().then((clients) => { + fetch(event.data.fetchUrl, {browsingTopics: true}).then((response) => { + response.text().then((topics_header) => { + // clients[0] is the most recently focused one + clients[0].postMessage({ + topicsHeader: topics_header + }); + }); + }); + }); + } +}); diff --git a/testing/web-platform/tests/browsing-topics/resources/header-util.sub.js b/testing/web-platform/tests/browsing-topics/resources/header-util.sub.js new file mode 100644 index 0000000000..bb5a63426d --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/header-util.sub.js @@ -0,0 +1,38 @@ +const EMPTY_TOPICS_HEADER = '();p=P0000000000000000000000000000000'; + +function test_topics_iframe_navigation_header( + test, has_browsing_topics_attribute, is_same_origin, expect_topics_header_available_func) { + const same_origin_src = '/browsing-topics/resources/check-topics-request-header-notify-parent.py'; + const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' + + same_origin_src; + + let frame = document.createElement('iframe'); + frame.src = is_same_origin ? same_origin_src : cross_origin_src; + + if (has_browsing_topics_attribute) { + frame.browsingTopics = true; + } + + window.addEventListener('message', test.step_func(function handler(evt) { + if (evt.source === frame.contentWindow) { + expect_topics_header_available_func(evt.data); + + document.body.removeChild(frame); + window.removeEventListener('message', handler); + test.done(); + } + })); + + document.body.appendChild(frame); +} + +function expect_topics_header_unavailable(data) { + assert_equals(data.topicsHeader, 'NO_TOPICS_HEADER'); +} + +function expect_topics_header_available(data) { + // An empty result indicates that the request was eligible for topics. + // Currently, the web-platform-tests framework does not support actually + // handling the topics request. + assert_equals(data.topicsHeader, EMPTY_TOPICS_HEADER); +} \ No newline at end of file diff --git a/testing/web-platform/tests/browsing-topics/resources/intercept-request.js b/testing/web-platform/tests/browsing-topics/resources/intercept-request.js new file mode 100644 index 0000000000..c19efb5f2f --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/intercept-request.js @@ -0,0 +1,12 @@ +self.addEventListener('fetch', event => { + event.waitUntil(async function () { + if (!event.clientId) return; + const client = await clients.get(event.clientId); + if (!client) return; + + client.postMessage({ + fetchUrl: event.request.url, + topicsHeader: String(event.request.headers.get("Sec-Browsing-Topics")) + }); + }()); +}); diff --git a/testing/web-platform/tests/browsing-topics/resources/permissions-policy-util.sub.js b/testing/web-platform/tests/browsing-topics/resources/permissions-policy-util.sub.js new file mode 100644 index 0000000000..e8bf45049c --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/permissions-policy-util.sub.js @@ -0,0 +1,30 @@ +const TOPICS_PERMISSIONS_POLICY_ERROR_MESSAGE = 'The \"browsing-topics\" Permissions Policy denied the use of document.browsingTopics().'; + +function test_topics_feature_availability_in_subframe(test, is_same_origin, expect_feature_available_func) { + const same_origin_src = '/browsing-topics/resources/document-api-notify-parent.tentative.https.html'; + const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' + + same_origin_src; + + let frame = document.createElement('iframe'); + frame.src = is_same_origin ? same_origin_src : cross_origin_src; + + window.addEventListener('message', test.step_func(function handler(evt) { + if (evt.source === frame.contentWindow) { + expect_feature_available_func(evt.data); + + document.body.removeChild(frame); + window.removeEventListener('message', handler); + test.done(); + } + })); + + document.body.appendChild(frame); +} + +function expect_topics_feature_unavailable(data) { + assert_equals(data.error, TOPICS_PERMISSIONS_POLICY_ERROR_MESSAGE); +} + +function expect_topics_feature_available(data) { + assert_equals(data.error, 'No error'); +} diff --git a/testing/web-platform/tests/browsing-topics/resources/topics-not-allowed-for-service-worker-fetch-helper.tentative.https.html b/testing/web-platform/tests/browsing-topics/resources/topics-not-allowed-for-service-worker-fetch-helper.tentative.https.html new file mode 100644 index 0000000000..2278d5bc76 --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/resources/topics-not-allowed-for-service-worker-fetch-helper.tentative.https.html @@ -0,0 +1,19 @@ + + + + diff --git a/testing/web-platform/tests/browsing-topics/topics-not-allowed-for-service-worker-fetch.tentative.https.html b/testing/web-platform/tests/browsing-topics/topics-not-allowed-for-service-worker-fetch.tentative.https.html new file mode 100644 index 0000000000..1bd578e9bf --- /dev/null +++ b/testing/web-platform/tests/browsing-topics/topics-not-allowed-for-service-worker-fetch.tentative.https.html @@ -0,0 +1,36 @@ + + + + + + + -- cgit v1.2.3