tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 42a1c83e5e22856800b60c9eb0badf2157c5413a
parent 4cfb948717b813977102af162818f1c6987d3b6f
Author: Yoav Weiss <yoav.weiss@shopify.com>
Date:   Wed, 15 Oct 2025 08:20:51 +0000

Bug 1992759 [wpt PR 55251] - Reorder the speculation rules tests, a=testonly

Automatic update from web-platform-tests
Reorder the speculation rules tests (#55251)

--

wpt-commits: 7fac9521e23f41f50570e4e8fdcd2c0f56b938aa
wpt-pr: 55251

Diffstat:
Dtesting/web-platform/tests/speculation-rules/prefetch/anonymous-client.https.html | 20--------------------
Atesting/web-platform/tests/speculation-rules/prefetch/anonymous/anonymous-client.https.html | 20++++++++++++++++++++
Atesting/web-platform/tests/speculation-rules/prefetch/anonymous/cross-origin-cookies-anonymous-client-ip-duplicate.https.html | 41+++++++++++++++++++++++++++++++++++++++++
Dtesting/web-platform/tests/speculation-rules/prefetch/cookie-indices.tentative.https.html | 162-------------------------------------------------------------------------------
Dtesting/web-platform/tests/speculation-rules/prefetch/cross-origin-cookies-anonymous-client-ip-duplicate.https.html | 41-----------------------------------------
Atesting/web-platform/tests/speculation-rules/prefetch/tentative/cookie-indices.https.html | 162+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 223 insertions(+), 223 deletions(-)

diff --git a/testing/web-platform/tests/speculation-rules/prefetch/anonymous-client.https.html b/testing/web-platform/tests/speculation-rules/prefetch/anonymous-client.https.html @@ -1,20 +0,0 @@ -<!DOCTYPE html> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="/common/dispatcher/dispatcher.js"></script> -<script src="/common/utils.js"></script> -<script src="../resources/utils.js"></script> -<script src="resources/utils.sub.js"></script> -<script> - setup(() => assertSpeculationRulesIsSupported()); - - promise_test(async t => { - let agent = await spawnWindow(t); - let nextUrl = agent.getExecutorURL({ hostname: CROSS_ORIGIN_HOST_THAT_WORKS_WITH_ACIWCO, page: 2 }); - await agent.forceSinglePrefetch(nextUrl, { requires: ["anonymous-client-ip-when-cross-origin"] }); - await agent.navigate(nextUrl); - - let requestHeaders = await agent.getRequestHeaders(); - assert_prefetched_anonymous_client_ip(requestHeaders); - }, "test anonymous-client url prefetch for cross origin pages"); -</script> diff --git a/testing/web-platform/tests/speculation-rules/prefetch/anonymous/anonymous-client.https.html b/testing/web-platform/tests/speculation-rules/prefetch/anonymous/anonymous-client.https.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/dispatcher/dispatcher.js"></script> +<script src="/common/utils.js"></script> +<script src="../../resources/utils.js"></script> +<script src="../resources/utils.sub.js"></script> +<script> + setup(() => assertSpeculationRulesIsSupported()); + + promise_test(async t => { + let agent = await spawnWindow(t); + let nextUrl = agent.getExecutorURL({ hostname: CROSS_ORIGIN_HOST_THAT_WORKS_WITH_ACIWCO, page: 2 }); + await agent.forceSinglePrefetch(nextUrl, { requires: ["anonymous-client-ip-when-cross-origin"] }); + await agent.navigate(nextUrl); + + let requestHeaders = await agent.getRequestHeaders(); + assert_prefetched_anonymous_client_ip(requestHeaders); + }, "test anonymous-client url prefetch for cross origin pages"); +</script> diff --git a/testing/web-platform/tests/speculation-rules/prefetch/anonymous/cross-origin-cookies-anonymous-client-ip-duplicate.https.html b/testing/web-platform/tests/speculation-rules/prefetch/anonymous/cross-origin-cookies-anonymous-client-ip-duplicate.https.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src='/resources/testdriver-vendor.js'></script> +<script src="/common/dispatcher/dispatcher.js"></script> +<script src="/common/utils.js"></script> +<script src="../../resources/utils.js"></script> +<script src="../resources/utils.sub.js"></script> +<script> + setup(() => assertSpeculationRulesIsSupported()); + + promise_test(async t => { + await test_driver.delete_all_cookies(); + + let executor = 'cookies.py'; + let agent = await spawnWindow(t, { executor }); + let response_cookies = await agent.getResponseCookies(); + let request_cookies = await agent.getRequestCookies(); + assert_equals(request_cookies["count"], undefined); + assert_equals(request_cookies["type"], undefined); + assert_equals(response_cookies["count"], "1"); + assert_equals(response_cookies["type"], "navigate"); + + let nextUrl = agent.getExecutorURL({ executor, hostname: CROSS_ORIGIN_HOST_THAT_WORKS_WITH_ACIWCO, page: 2 }); + await agent.forceSinglePrefetch(nextUrl, { requires: ["anonymous-client-ip-when-cross-origin"] }); + await agent.forceSinglePrefetch(nextUrl); + await agent.navigate(nextUrl); + + response_cookies = await agent.getResponseCookies(); + request_cookies = await agent.getRequestCookies(); + assert_equals(request_cookies["count"], undefined); + assert_equals(request_cookies["type"], undefined); + assert_equals(response_cookies["count"], "1"); + assert_equals(response_cookies["type"], "prefetch"); + + let requestHeaders = await agent.getRequestHeaders(); + assert_prefetched_anonymous_client_ip(requestHeaders); + }, "speculation rules based prefetch should not use cookies for cross origin urls and should issue only the IP-anonymized request if that one is first."); +</script> diff --git a/testing/web-platform/tests/speculation-rules/prefetch/cookie-indices.tentative.https.html b/testing/web-platform/tests/speculation-rules/prefetch/cookie-indices.tentative.https.html @@ -1,162 +0,0 @@ -<!DOCTYPE html> -<meta name="timeout" content="long"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="/resources/testdriver.js"></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.forceSinglePrefetch(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.forceSinglePrefetch(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.forceSinglePrefetch(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.forceSinglePrefetch(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.forceSinglePrefetch(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.forceSinglePrefetch(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> diff --git a/testing/web-platform/tests/speculation-rules/prefetch/cross-origin-cookies-anonymous-client-ip-duplicate.https.html b/testing/web-platform/tests/speculation-rules/prefetch/cross-origin-cookies-anonymous-client-ip-duplicate.https.html @@ -1,41 +0,0 @@ -<!DOCTYPE html> -<meta name="timeout" content="long"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="/resources/testdriver.js"></script> -<script src='/resources/testdriver-vendor.js'></script> -<script src="/common/dispatcher/dispatcher.js"></script> -<script src="/common/utils.js"></script> -<script src="../resources/utils.js"></script> -<script src="resources/utils.sub.js"></script> -<script> - setup(() => assertSpeculationRulesIsSupported()); - - promise_test(async t => { - await test_driver.delete_all_cookies(); - - let executor = 'cookies.py'; - let agent = await spawnWindow(t, { executor }); - let response_cookies = await agent.getResponseCookies(); - let request_cookies = await agent.getRequestCookies(); - assert_equals(request_cookies["count"], undefined); - assert_equals(request_cookies["type"], undefined); - assert_equals(response_cookies["count"], "1"); - assert_equals(response_cookies["type"], "navigate"); - - let nextUrl = agent.getExecutorURL({ executor, hostname: CROSS_ORIGIN_HOST_THAT_WORKS_WITH_ACIWCO, page: 2 }); - await agent.forceSinglePrefetch(nextUrl, { requires: ["anonymous-client-ip-when-cross-origin"] }); - await agent.forceSinglePrefetch(nextUrl); - await agent.navigate(nextUrl); - - response_cookies = await agent.getResponseCookies(); - request_cookies = await agent.getRequestCookies(); - assert_equals(request_cookies["count"], undefined); - assert_equals(request_cookies["type"], undefined); - assert_equals(response_cookies["count"], "1"); - assert_equals(response_cookies["type"], "prefetch"); - - let requestHeaders = await agent.getRequestHeaders(); - assert_prefetched_anonymous_client_ip(requestHeaders); - }, "speculation rules based prefetch should not use cookies for cross origin urls and should issue only the IP-anonymized request if that one is first."); -</script> diff --git a/testing/web-platform/tests/speculation-rules/prefetch/tentative/cookie-indices.https.html b/testing/web-platform/tests/speculation-rules/prefetch/tentative/cookie-indices.https.html @@ -0,0 +1,162 @@ +<!DOCTYPE html> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></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.forceSinglePrefetch(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.forceSinglePrefetch(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.forceSinglePrefetch(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.forceSinglePrefetch(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.forceSinglePrefetch(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.forceSinglePrefetch(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>