tor-browser

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

commit 3dc7fe0231f68418ccdc667cadd522d9ee7d8bf4
parent 8b899afe009f881f7b4325be8ce78636d493f8b2
Author: Hiroki Nakagawa <nhiroki@chromium.org>
Date:   Fri, 28 Nov 2025 14:53:36 +0000

Bug 2002935 [wpt PR 56334] - Prerender: Remove Prerender2FallbackPrefetchSpecRules from VirtualTestSuites, a=testonly

Automatic update from web-platform-tests
Prerender: Remove Prerender2FallbackPrefetchSpecRules from VirtualTestSuites

Prerender2FallbackPrefetchSpecRules was disabled because it failed
following tests:

- response-code-non-successful.https.html?code=204
- response-code-non-successful.https.html?code=205

This is because Prerender2FallbackPrefetchSpecRules triggers prefetch
prior to prerender, and the prefetched response is used for later
navigation multiple times. This broke the assumption of the test. See
the implementation comment and the comment thread[1] for details.

This CL avoids the behavior by explicitly clearing the prefetch cache
before navigation, and removes the feature flag from VirtualTestSuites
for simpler test setup.

[1]https://docs.google.com/document/d/10IU51ZONHKYBcK0BNyazABGa2K5-bVE5496wkqjDr2c/edit?disco=AAABwtHjXyk

Bug: 463527942
Change-Id: I306e68971a17630518f5f2bc7ef431748cfcb0ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7205895
Reviewed-by: Kent Tamura <tkent@chromium.org>
Auto-Submit: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Ken Okada <kenoss@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1551257}

--

wpt-commits: 09db8eb34f099dc3a350ef6f6360464d98c61949
wpt-pr: 56334

Diffstat:
Mtesting/web-platform/tests/speculation-rules/prerender/response-code-non-successful.https.html | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/speculation-rules/prerender/response-code-non-successful.https.html b/testing/web-platform/tests/speculation-rules/prerender/response-code-non-successful.https.html @@ -25,6 +25,26 @@ promise_test(async t => { // response code. const {exec, tryToActivate} = await create_prerendered_page(t, {'prerendering': params}); + + // Open new window with url to clear cache data through Clear-Site-Data header. + // Ensure that the cache is cleared before the navigation. + // + // This is a hack for Chromium that may trigger prefetch prior to prerender, + // and serve the same prefetched response multiple times (This is known as + // PrefetchReusable). This breaks the assumption of this test that the first + // prerender request fails for non-OK status code and then the next real + // navigation succeeds with 200. With the PrefetchReusable, the real + // navigation sees the prefetched error response and fails. + const gotMessage = new Promise(resolve => { + window.addEventListener('message', e => { + resolve(e.data); + }, { + once: true + }); + }); + window.open("/../../clear-site-data/support/clear-site-data-prefetchCache.py"); + await gotMessage; + const result = await tryToActivate(); assert_equals(result, 'discarded'); },`Responses with code ${params.get('code')} should be discarded`);