Runs: Chrome 160.0.8195.0 (wpt@1ab8957e4, 2026-12-01) | Firefox 163.0a1 (wpt@1ab8957e4, 2026-12-01) | Safari 257 preview (wpt@13099faa1, 2026-12-02) | Ladybird 1.0-cbbd8 (wpt@a4e842dc3, 2026-12-02) | Servo Servo 0.8 (wpt@75c11f957, 2026-12-01) | Blitz af350c0af (wpt@705f393a6, 2026-12-02)
| Chrome | Firefox | Safari | Ladybird | Servo | Blitz | |
|---|---|---|---|---|---|---|
| Total | 0/1 | 0/1 | 0/1 | 0/1 | 0/1 | NOT RUN |
| Subtest | Chrome | Firefox | Safari | Ladybird | Servo | Blitz |
|---|---|---|---|---|---|---|
| If the redirect needs to be rerequested and goes elsewhere, we cannot can use the prefetched final response. | FAIL | TIMEOUT | TIMEOUT | — | — | — |
/speculation-rules/prefetch/tentative/cookie-indices.https.html
<!DOCTYPE html> <meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/resources/testdriver.js?feature=bidi"></script> <script src='/resources/testdriver-vendor.js'></script> <script src="/common/dispatcher/dispatcher.js"></script> <script src="/common/subset-tests-by-key.js"></script> <script src="/common/utils.js"></script> <script src="../../resources/utils.js"></script> <script src="../resources/utils.sub.js"></script> <meta name="variant" content="?include=unchanged"> <meta name="variant" content="?include=changed"> <meta name="variant" content="?include=unchangedWithRedirect"> <meta name="variant" content="?include=changedWithRedirect"> <meta name="variant" content="?include=changedWithRedirect2"> <meta name="variant" content="?include=changedWithRedirect3"> <!-- This is a test for the integration of https://mnot.github.io/I-D/draft-nottingham-http-availability-hints.html with prefetch. Chromium has an implementation of such integration behind a flag; see https://issues.chromium.org/issues/328628231. --> <script> setup(() => assertSpeculationRulesIsSupported()); subsetTestByKey("unchanged", promise_test, async t => { await test_driver.delete_all_cookies(); document.cookie = 'vary1=hello'; let agent = await spawnWindow(t); let nextUrl = agent.getExecutorURL({ executor: "cookies.py", cookieindices: "1" }); await agent.forceSinglePrefetchAndWaitForStatus(nextUrl); await agent.navigate(nextUrl); assert_prefetched(await agent.getRequestHeaders()); let request_cookies = await agent.getRequestCookies(); let response_cookies = await agent.getResponseCookies(); assert_equals(request_cookies.vary1, "hello"); assert_equals(request_cookies.vary2, undefined); assert_equals(response_cookies.vary1, "hello"); assert_equals(response_cookies.vary2, undefined); }, "Cookie-Indices should not prevent a prefetch from succeeding if the cookie has not changed."); subsetTestByKey("changed", promise_test, async t => { await test_driver.delete_all_cookies(); document.cookie = 'vary1=hello'; let agent = await spawnWindow(t); let nextUrl = agent.getExecutorURL({ executor: "cookies.py", cookieindices: "1" }); await agent.forceSinglePrefetchAndWaitForStatus(nextUrl); document.cookie = 'vary1=two'; await agent.navigate(nextUrl); assert_not_prefetched(await agent.getRequestHeaders()); let request_cookies = await agent.getRequestCookies(); let response_cookies = await agent.getResponseCookies(); assert_equals(request_cookies.vary1, "two"); assert_equals(request_cookies.vary2, undefined); assert_equals(response_cookies.vary1, "two"); assert_equals(response_cookies.vary2, undefined); }, "Cookie-Indices should prevent a prefetch from being used if the cookie has changed."); subsetTestByKey("unchangedWithRedirect", promise_test, async t => { await test_driver.delete_all_cookies(); document.cookie = 'vary1=hello'; let agent = await spawnWindow(t); let finalUrl = agent.getExecutorURL({ executor: "cookies.py", cookieindices: "1" }); let nextUrl = new URL("/common/redirect.py?location=" + encodeURIComponent(finalUrl), document.baseURI); await agent.forceSinglePrefetchAndWaitForStatus(nextUrl); await agent.navigate(nextUrl, {expectedDestinationUrl: finalUrl}); assert_prefetched(await agent.getRequestHeaders()); let request_cookies = await agent.getRequestCookies(); let response_cookies = await agent.getResponseCookies(); assert_equals(request_cookies.vary1, "hello"); assert_equals(request_cookies.vary2, undefined); assert_equals(response_cookies.vary1, "hello"); assert_equals(response_cookies.vary2, undefined); }, "Cookie-Indices should not prevent a prefetch from succeeding with unchanged cookies, even with redirect"); subsetTestByKey("changedWithRedirect", promise_test, async t => { await test_driver.delete_all_cookies(); document.cookie = 'vary1=hello'; let agent = await spawnWindow(t); let finalUrl = agent.getExecutorURL({ executor: "cookies.py", cookieindices: "1" }); let nextUrl = new URL("/common/redirect.py?location=" + encodeURIComponent(finalUrl), document.baseURI); await agent.forceSinglePrefetchAndWaitForStatus(nextUrl); document.cookie = 'vary1=two'; await agent.navigate(nextUrl, {expectedDestinationUrl: finalUrl}); assert_not_prefetched(await agent.getRequestHeaders()); let request_cookies = await agent.getRequestCookies(); let response_cookies = await agent.getResponseCookies(); assert_equals(request_cookies.vary1, "two"); assert_equals(request_cookies.vary2, undefined); assert_equals(response_cookies.vary1, "two"); assert_equals(response_cookies.vary2, undefined); }, "Cookie-Indices should prevent a prefetch from succeeding if the cookie changed, with a redirect"); subsetTestByKey("changedWithRedirect2", promise_test, async t => { await test_driver.delete_all_cookies(); document.cookie = 'vary1=hello'; let agent = await spawnWindow(t); // One subtlety here: the wptserve pipe parser doesn't allow commas inside // the header value (since that delimits the pipe arguments). // There is currently no way around this, so we simply don't use a value with a comma. let finalUrl = agent.getExecutorURL({ executor: "cookies.py" }); let pipe = "header(Cache-Control,no-store)|header(Vary,Cookie)|header(Cookie-Indices,\"vary1\")"; let nextUrl = new URL(`/common/redirect.py?location=${encodeURIComponent(finalUrl)}&pipe=${encodeURIComponent(pipe)}`, document.baseURI); await agent.forceSinglePrefetchAndWaitForStatus(nextUrl); document.cookie = 'vary1=two'; await agent.navigate(nextUrl, {expectedDestinationUrl: finalUrl}); assert_prefetched(await agent.getRequestHeaders()); let request_cookies = await agent.getRequestCookies(); let response_cookies = await agent.getResponseCookies(); assert_equals(request_cookies.vary1, "hello"); assert_equals(request_cookies.vary2, undefined); assert_equals(response_cookies.vary1, "two"); assert_equals(response_cookies.vary2, undefined); }, "If the redirect needs to be rerequested but goes to the same place and that one doesn't vary, we actually can use the prefetched final response."); subsetTestByKey("changedWithRedirect3", promise_test, async t => { await test_driver.delete_all_cookies(); document.cookie = 'vary1=hello'; let agent = await spawnWindow(t); // One subtlety here: the wptserve pipe parser doesn't allow commas inside // the header value (since that delimits the pipe arguments). // There is currently no way around this, so we simply don't use a value with a comma. let finalUrl = agent.getExecutorURL({ executor: "cookies.py" }); let pipe = "header(Cache-Control,no-store)|header(Vary,Cookie)|header(Cookie-Indices,\"vary1\")"; let nextUrl = new URL(`resources/random_redirect.py?location=${encodeURIComponent(finalUrl)}&pipe=${encodeURIComponent(pipe)}`, document.baseURI); await agent.forceSinglePrefetchAndWaitForStatus(nextUrl); document.cookie = 'vary1=two'; await agent.navigate(nextUrl, {expectedDestinationUrl: null}); assert_not_prefetched(await agent.getRequestHeaders()); let request_cookies = await agent.getRequestCookies(); let response_cookies = await agent.getResponseCookies(); assert_equals(request_cookies.vary1, "two"); assert_equals(request_cookies.vary2, undefined); assert_equals(response_cookies.vary1, "two"); assert_equals(response_cookies.vary2, undefined); }, "If the redirect needs to be rerequested and goes elsewhere, we cannot can use the prefetched final response."); </script>