tor-browser

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

commit de88805b413047ca10a79d95eeab912f5a1fcd61
parent af61846fe3430fbaacd3735179b2b2c1d9d54925
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Tue,  2 Dec 2025 18:41:14 +0000

Bug 2003019 - add a CSS webcompat intervention for www.jw.org library pages; r=ksenia,webcompat-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D274792

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 17+++++++++++++++++
Abrowser/extensions/webcompat/injections/css/bug2003019-www.jw.org-fix-ruby-text-linebreaks.css | 15+++++++++++++++
Atesting/webcompat/interventions/tests/test_2003019_jw_org.py | 30++++++++++++++++++++++++++++++
3 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -6222,5 +6222,22 @@ "ua_string": ["Chrome", "add_Firefox_as_Gecko"] } ] + }, + "2003019": { + "label": "jw.org", + "bugs": { + "2003019": { + "issue": "broken-layout", + "matches": ["*://www.jw.org/*/library/*"] + } + }, + "interventions": [ + { + "platforms": ["all"], + "content_scripts": { + "css": ["bug2003019-www.jw.org-fix-ruby-text-linebreaks.css"] + } + } + ] } } diff --git a/browser/extensions/webcompat/injections/css/bug2003019-www.jw.org-fix-ruby-text-linebreaks.css b/browser/extensions/webcompat/injections/css/bug2003019-www.jw.org-fix-ruby-text-linebreaks.css @@ -0,0 +1,15 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * www.jw.org - ruby text does not wrap correctly. + * Bug #2003019 - https://bugzilla.mozilla.org/show_bug.cgi?id=2003019 + * WebCompat issue #191594 - https://webcompat.com/issues/191594 + * + * Until bug 2003395 is fixed, we can introduce line-breaking opportunities + * into the ruby-text ourselves to work around this issue. + */ +ruby::after { + content: "\200B"; /* Zero-width space (line break opportunity) */ +} diff --git a/testing/webcompat/interventions/tests/test_2003019_jw_org.py b/testing/webcompat/interventions/tests/test_2003019_jw_org.py @@ -0,0 +1,30 @@ +import pytest + +URL = "https://www.jw.org/en/library/bible/kingdom-interlinear-greek-translation/books/revelation/22/" + +ARTICLE_CSS = "#bibleText" + + +async def does_text_wrap(client): + await client.navigate(URL, wait="none") + text = client.await_css(ARTICLE_CSS, is_displayed=True) + return client.execute_script( + """ + const container = arguments[0]; + const verse = container.querySelector(":scope > .verse"); + return verse.getBoundingClientRect().width <= container.getBoundingClientRect().width; + """, + text, + ) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await does_text_wrap(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await does_text_wrap(client)