summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-default.tentative.https.sub.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-default.tentative.https.sub.html
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-default.tentative.https.sub.html')
-rw-r--r--testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-default.tentative.https.sub.html55
1 files changed, 55 insertions, 0 deletions
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..884ad9276a
--- /dev/null
+++ b/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-default.tentative.https.sub.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<body>
+ <script src=/resources/testharness.js></script>
+ <script src=/resources/testharnessreport.js></script>
+ <script src=/browsing-topics/resources/navigation-header-util.sub.js></script>
+ <script src=/browsing-topics/resources/permissions-policy-util.sub.js></script>
+ <script>
+ 'use strict';
+ const header = 'Default permissions policy';
+
+ promise_test(async t => {
+ let topics = await document.browsingTopics();
+ assert_equals(topics.length, 0);
+ }, header + ' allows document.browsingTopics() in the current page.');
+
+ async_test(t => {
+ test_topics_feature_availability_in_subframe(t, /*is_same_origin=*/true,
+ expect_topics_feature_available);
+ }, header + ' allows document.browsingTopics() in same-origin iframes.');
+
+ async_test(t => {
+ test_topics_feature_availability_in_subframe(t, /*is_same_origin=*/false,
+ expect_topics_feature_available);
+ }, header + ' allows document.browsingTopics() in cross-origin iframes.');
+
+ const same_origin_url = '/browsing-topics/resources/check-topics-request-header.py';
+ const cross_origin_url = 'https://{{domains[www]}}:{{ports[https][0]}}' +
+ same_origin_url;
+
+ promise_test(async t => {
+ let response = await fetch(same_origin_url, {browsingTopics: true});
+ let topics_header = await response.text();
+ assert_equals(topics_header, "");
+ }, header + 'allows the \'Sec-Browsing-Topics\' header to be sent for the same-origin topics fetch request.');
+
+ promise_test(async t => {
+ let response = await fetch(cross_origin_url, {browsingTopics: true});
+ let topics_header = await response.text();
+ assert_equals(topics_header, "");
+ }, header + 'allows the \'Sec-Browsing-Topics\' header to be sent for the cross-origin topics fetch request.');
+
+ async_test(t => {
+ test_topics_iframe_navigation_header(
+ t, /*has_browsing_topics_attribute=*/true, /*is_same_origin=*/true,
+ expect_topics_header_available);
+ }, header + ' allows the \'Sec-Browsing-Topics\' header to be sent for the same-origin iframe navigation request.');
+
+ async_test(t => {
+ test_topics_iframe_navigation_header(
+ t, /*has_browsing_topics_attribute=*/true, /*is_same_origin=*/false,
+ expect_topics_header_available);
+ }, header + ' allows the \'Sec-Browsing-Topics\' header to be sent for the cross-origin iframe navigation request.');
+
+ </script>
+</body>