tor-browser

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

commit 98513edeff22f2c5b8b0c2710fa0e00f17695f48
parent dfa457acd8015934ef2f1318d38d1118fd930ff0
Author: Basuke Suzuki <basuke@apple.com>
Date:   Wed, 15 Oct 2025 08:23:20 +0000

Bug 1990608 [wpt PR 55051] - Create variants of Navigation API scroll behavior tests with scroll anchoring off, a=testonly

Automatic update from web-platform-tests
Added test with no-dependency to the Scroll Anchoring for scroll behavior tests of Navigation API (#55051)

https://github.com/web-platform-tests/wpt/issues/55050

Following tests depend on Scroll Anchoring behavior after removing the div.
The scroll position is asserted but they are different whether Scroll Anchoring
is on or off.

- navigation-api/scroll-behavior/after-transition-reload.html
- navigation-api/scroll-behavior/manual-scroll-reload.html

In this PR, similar tests are added that is not dependent on Scroll Anchoring.

- navigation-api/scroll-behavior/after-transition-reload-no-scroll-anchoring.html
- navigation-api/scroll-behavior/manual-scroll-reload-no-scroll-anchoring.html

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Wed Sep 24 12:47:57 2025 -0700
#
# On branch basuke/fix/55050
# Changes to be committed:
#	new file:   after-transition-reload-no-scroll-anchoring.html
#	new file:   manual-scroll-reload-no-scroll-anchoring.html
#
--

wpt-commits: dfafec8d85ccc4f98802dac880ccee906e96c468
wpt-pr: 55051

Diffstat:
Atesting/web-platform/tests/navigation-api/scroll-behavior/after-transition-reload-no-scroll-anchoring.html | 47+++++++++++++++++++++++++++++++++++++++++++++++
Atesting/web-platform/tests/navigation-api/scroll-behavior/manual-scroll-reload-no-scroll-anchoring.html | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/navigation-api/scroll-behavior/after-transition-reload-no-scroll-anchoring.html b/testing/web-platform/tests/navigation-api/scroll-behavior/after-transition-reload-no-scroll-anchoring.html @@ -0,0 +1,47 @@ +<!doctype html> +<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<div id="buffer" style="height: 1000px; width: 200vw;"></div> +<div id="frag"></div> +<div style="height: 2000px; width: 200vw;"></div> +<style> + * { + overflow-anchor: none; + } +</style> +<script> +promise_test(async t => { + // Wait for after the load event so that the navigation doesn't get converted + // into a replace navigation. + await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); + assert_equals(window.scrollY, 0); + await navigation.navigate("#frag").finished; + // Scroll down 10px from #frag + window.scrollBy(0, 10); + let scrollY_frag_plus_10 = window.scrollY; + + let intercept_resolve; + let navigate_event; + navigation.onnavigate = e => { + navigate_event = e; + e.intercept({ handler: () => new Promise(r => intercept_resolve = r), + scroll: "after-transition" }); + }; + let reload_promises = navigation.reload(); + await reload_promises.committed; + + // removing the <div id="buffer"> should stay in same position. + assert_equals(window.scrollY, scrollY_frag_plus_10); + buffer.remove(); + let scrollY_after_buffer_remove = window.scrollY; + assert_equals(scrollY_after_buffer_remove, scrollY_frag_plus_10); + + // Finishing should scroll to #frag, which is 10px up from the current location + intercept_resolve(); + await reload_promises.finished; + assert_equals(window.scrollY, scrollY_after_buffer_remove - 1000 - 10); +}, "scroll: after-transition should work on a reload navigation"); +</script> +</body> diff --git a/testing/web-platform/tests/navigation-api/scroll-behavior/manual-scroll-reload-no-scroll-anchoring.html b/testing/web-platform/tests/navigation-api/scroll-behavior/manual-scroll-reload-no-scroll-anchoring.html @@ -0,0 +1,51 @@ +<!doctype html> +<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<div id="buffer" style="height: 1000px; width: 200vw;"></div> +<div id="frag"></div> +<div style="height: 2000px; width: 200vw;"></div> +<style> + * { + overflow-anchor: none; + } +</style> +<script> +promise_test(async t => { + // Wait for after the load event so that the navigation doesn't get converted + // into a replace navigation. + await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); + assert_equals(window.scrollY, 0); + await navigation.navigate("#frag").finished; + // Scroll down 10px from #frag + window.scrollBy(0, 10); + let scrollY_frag_plus_10 = window.scrollY; + + let intercept_resolve; + let navigate_event; + navigation.onnavigate = e => { + navigate_event = e; + e.intercept({ handler: () => new Promise(r => intercept_resolve = r), + scroll: "manual" }); + }; + let reload_promises = navigation.reload(); + await reload_promises.committed; + + // removing the <div id="buffer"> should stay in same position. + assert_equals(window.scrollY, scrollY_frag_plus_10); + buffer.remove(); + let scrollY_after_buffer_remove = window.scrollY; + assert_equals(scrollY_after_buffer_remove, scrollY_frag_plus_10); + + // scroll() should scroll to #frag, which is 10px up from the current location + navigate_event.scroll(); + assert_equals(window.scrollY, scrollY_after_buffer_remove - 1000 - 10); + + // Finishing should not scroll. + intercept_resolve(); + await reload_promises.finished; + assert_equals(window.scrollY, scrollY_after_buffer_remove - 1000 - 10); +}, "scroll: scroll() should work on a reload navigation"); +</script> +</body>