summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html')
-rw-r--r--testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html25
1 files changed, 22 insertions, 3 deletions
diff --git a/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html b/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html
index d8c2bea87a..8cb7388479 100644
--- a/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html
+++ b/testing/web-platform/tests/speculation-rules/prefetch/referrer-policy-not-accepted.https.html
@@ -10,7 +10,8 @@
<!--Split test cases due to the use of timeouts in speculation rules test utilities.-->
<meta name="variant" content="?1-1">
-<meta name="variant" content="?2-last">
+<meta name="variant" content="?2-2">
+<meta name="variant" content="?3-last">
<script>
"use strict";
@@ -39,12 +40,30 @@ subsetTest(promise_test, async t => {
const nextURL = agent.getExecutorURL({ hostname: PREFETCH_PROXY_BYPASS_HOST, page: 2 });
// This prefetch attempt should be ignored.
- await agent.forceSinglePrefetch(
- nextURL, { requires: ["anonymous-client-ip-when-cross-origin"] });
+ await agent.forceSinglePrefetch(nextURL);
await agent.navigate(nextURL);
const headers = await agent.getRequestHeaders();
assert_not_prefetched(headers, "must not be prefetched");
assert_equals(headers.referer, expectedReferrer, "must send the full URL as the referrer");
}, 'with "unsafe-url" referrer policy on cross-site referring page');
+
+subsetTest(promise_test, async t => {
+ const agent = await spawnWindow(t);
+ await agent.setReferrerPolicy("unsafe-url");
+ const expectedReferrer = agent.getExecutorURL().href;
+
+ const nextURL = agent.getExecutorURL({ hostname: PREFETCH_PROXY_BYPASS_HOST, page: 2 });
+ // This prefetch attempt should be ignored.
+ await agent.execute_script((url) => {
+ addLink(url);
+ insertDocumentRule();
+ }, [nextURL]);
+ await new Promise(resolve => t.step_timeout(resolve, 2000));
+ await agent.navigate(nextURL);
+
+ const headers = await agent.getRequestHeaders();
+ assert_not_prefetched(headers, "must not be prefetched");
+ assert_equals(headers.referer, expectedReferrer, "must send the full URL as the referrer");
+}, 'with "unsafe-url" referrer policy on cross-site referring page with document rule');
</script>