tor-browser

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

commit 56326e39a191e0d6b1a73d425dd5e04ddc2cded0
parent d0a095b7a83ed26587da19e76b3b8fbaa5d71e3b
Author: Taym Haddadi <haddadi.taym@gmail.com>
Date:   Fri, 19 Dec 2025 09:16:56 +0000

Bug 2006516 [wpt PR 56796] - Fix hashchange only queue when fragment actually changes, a=testonly

Automatic update from web-platform-tests
Add wpt test

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

--

wpt-commits: c4336ba029d9bf6d67390d1baaaca1f1df282562
wpt-pr: 56796

Diffstat:
Atesting/web-platform/tests/html/browsers/browsing-the-web/history-traversal/hashchange-same-fragment-does-not-fire.html | 25+++++++++++++++++++++++++
1 file changed, 25 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/hashchange-same-fragment-does-not-fire.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/hashchange-same-fragment-does-not-fire.html @@ -0,0 +1,25 @@ +<!doctype html> +<meta charset="utf-8"> +<title>hashchange is not fired when setting the same fragment</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script> +promise_test(async t => { + t.add_cleanup(() => history.replaceState(null, "", location.pathname + location.search)); + + const first = new Promise(resolve => addEventListener("hashchange", resolve, { once: true })); + location.hash = "#foo"; + await first; + + const secondHashchange = new Promise(resolve => { + addEventListener("hashchange", () => resolve("fired"), { once: true }); + }); + const timeout = new Promise(resolve => t.step_timeout(() => resolve("timeout"), 100)); + + location.hash = "#foo"; + + const result = await Promise.race([secondHashchange, timeout]); + assert_equals(result, "timeout", "hashchange must not fire when fragment does not change"); +}, "Setting the same location.hash twice must not fire hashchange the second time"); +</script>