Files
tubestation/testing/web-platform/tests/browsing-topics/browsing-topics-permissions-policy-none.tentative.https.sub.html
Abigail Katcoff 5af5fcd555 Bug 1940121 [wpt PR 49926] - Reland "Topics: web platform tests for <img> request header", a=testonly
Automatic update from web-platform-tests
Reland "Topics: web platform tests for <img> request header"

This reverts commit 679cb25d08ade00885ff5c83809562c1abe891cc.

Reason for revert: Likely fixed the original problem for the revert: splitting the failing browsertest in two so that the image wouldn't be cached.

Original change's description:
> Revert "Topics: web platform tests for <img> request header"
>
> This reverts commit 3ca9787e7b4381920a1fecdc8c5942720e7b5a68.
>
> Reason for revert: See https://issues.chromium.org/u/1/issues/387306732
>
> Original change's description:
> > Topics: web platform tests for <img> request header
> >
> > Bug: 382532794
> > Change-Id: I4b9729330f43869f5defb7116343ce34d7f159a2
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6081796
> > Reviewed-by: Yao Xiao <yaoxia@chromium.org>
> > Commit-Queue: Abigail Katcoff <abigailkatcoff@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1401526}
>
> Bug: 382532794
> Change-Id: I2982af322b0099cd732e9a011adca418a273cf6a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6137099
> Commit-Queue: David Yeung <dayeung@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#1401649}

Bug: 382532794
Change-Id: I1aa96ca2e19bb0e5a4f0bc80777de38e40724d28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6149252
Commit-Queue: Abigail Katcoff <abigailkatcoff@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1402540}

--

wpt-commits: a10d50d6c6a2d7bdbd4ca800bd8da7645dd58cbc
wpt-pr: 49926
2025-01-10 09:26:48 +00:00

74 lines
3.3 KiB
HTML

<!doctype html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/browsing-topics/resources/header-util.sub.js></script>
<script src=/browsing-topics/resources/load_img.sub.js></script>
<script src=/browsing-topics/resources/permissions-policy-util.sub.js></script>
<script src=/common/utils.js></script>
<script>
'use strict';
const header = 'permissions policy header browsing-topics=()';
promise_test(async t => {
try {
await document.browsingTopics();
} catch (e) {
assert_equals(e.message, TOPICS_PERMISSIONS_POLICY_ERROR_MESSAGE);
return;
}
assert_unreached("did not reject");
}, header + ' disallows document.browsingTopics() in the current page.');
async_test(t => {
test_topics_feature_availability_in_subframe(t, /*is_same_origin=*/true,
expect_topics_feature_unavailable);
}, header + ' disallows document.browsingTopics() in same-origin iframes.');
async_test(t => {
test_topics_feature_availability_in_subframe(t, /*is_same_origin=*/false,
expect_topics_feature_unavailable);
}, header + ' disallows 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, "NO_TOPICS_HEADER");
}, header + 'disallows 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, "NO_TOPICS_HEADER");
}, header + 'disallows the \'Sec-Browsing-Topics\' header to be sent for the cross-origin topics fetch request.');
promise_test(async t => {
let topics_header = await load_topics_image(
/*has_browsing_topics_attribute=*/true, /*is_same_origin=*/true);
assert_equals(topics_header, "NO_TOPICS_HEADER");
}, header + 'disallows the \'Sec-Browsing-Topics\' header to be sent for the same-origin topics img request.');
promise_test(async t => {
let topics_header = await load_topics_image(
/*has_browsing_topics_attribute=*/true, /*is_same_origin=*/false);
assert_equals(topics_header, "NO_TOPICS_HEADER");
}, header + 'disallows the \'Sec-Browsing-Topics\' header to be sent for the cross-origin topics img request.');
async_test(t => {
test_topics_iframe_navigation_header(
t, /*has_browsing_topics_attribute=*/true, /*is_same_origin=*/true,
expect_topics_header_unavailable);
}, header + ' disallows 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_unavailable);
}, header + ' disallows the \'Sec-Browsing-Topics\' header to be sent for the cross-origin iframe navigation request.');
</script>
</body>