tor-browser

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

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

Bug 2003011 - add an Android-only CSS webcompat intervention for ehealth.gov.gr; r=ksenia,webcompat-reviewers

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

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 17+++++++++++++++++
Abrowser/extensions/webcompat/injections/css/bug2003011-ehealth.gov.gr-fix-font-inflation-issue.css | 15+++++++++++++++
Mtesting/webcompat/client.py | 15+++++++++++++++
Atesting/webcompat/interventions/tests/test_2003011_ehealth_gov_gr.py | 43+++++++++++++++++++++++++++++++++++++++++++
4 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -6223,6 +6223,23 @@ } ] }, + "2003011": { + "label": "ehealth.gov.gr", + "bugs": { + "2003011": { + "issue": "broken-layout", + "matches": ["*://ehealth.gov.gr/*"] + } + }, + "interventions": [ + { + "platforms": ["android"], + "content_scripts": { + "css": ["bug2003011-ehealth.gov.gr-fix-font-inflation-issue.css"] + } + } + ] + }, "2003019": { "label": "jw.org", "bugs": { diff --git a/browser/extensions/webcompat/injections/css/bug2003011-ehealth.gov.gr-fix-font-inflation-issue.css b/browser/extensions/webcompat/injections/css/bug2003011-ehealth.gov.gr-fix-font-inflation-issue.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/. */ + +/** + * ehealth.gov.gr - popup text does not properly fit. + * Bug #2003011 - https://bugzilla.mozilla.org/show_bug.cgi?id=2003011 + * WebCompat issue #192011 - https://webcompat.com/issues/192011 + * + * Firefox for Android's font inflation causes text in a popup to be too + * large to fit in its space. This CSS corrects that issue. + */ +:root { + -moz-text-size-adjust: none; +} diff --git a/testing/webcompat/client.py b/testing/webcompat/client.py @@ -46,6 +46,20 @@ class Client: level, ) + async def maybe_enable_font_inflation(self): + # GVE does not enable font inflation by default. We want to match Fenix. + if self.session.capabilities["platformName"] != "android": + return + with self.using_context("chrome"): + self.execute_script( + r""" + const minTwips = "font.size.inflation.minTwips"; + if (!Services.prefs.getIntPref(minTwips)) { + Services.prefs.setIntPref(minTwips, 120); + } + """ + ) + async def maybe_override_platform(self): if hasattr(self, "_platform_override_checked"): return @@ -525,6 +539,7 @@ class Client: async def navigate(self, url, timeout=90, no_skip=False, **kwargs): await self.await_interventions_started() await self.maybe_override_platform() + await self.maybe_enable_font_inflation() try: return await asyncio.wait_for( asyncio.ensure_future(self._navigate(url, **kwargs)), timeout=timeout diff --git a/testing/webcompat/interventions/tests/test_2003011_ehealth_gov_gr.py b/testing/webcompat/interventions/tests/test_2003011_ehealth_gov_gr.py @@ -0,0 +1,43 @@ +from asyncio.exceptions import TimeoutError + +import pytest +from webdriver.error import NoSuchElementException + +URL = "https://ehealth.gov.gr/p-rv/p" + +POPUP_CSS = ".popupContent" +POPUP_CC_LINK_CSS = ".popupContent .cc-link" + + +async def is_popup_text_cut_off(client): + try: + await client.navigate(URL, wait="none", timeout=10, no_skip=True) + popup = client.await_css(POPUP_CSS, is_displayed=True) + cc_link = client.await_css(POPUP_CC_LINK_CSS, is_displayed=True) + return client.execute_script( + """ + const [popup, cc_link] = arguments; + return cc_link.getBoundingClientRect().top > popup.getBoundingClientRect().bottom; + """, + popup, + cc_link, + ) + except (TimeoutError, NoSuchElementException): + pytest.skip("Region-locked, cannot test. Try using a VPN set to Greece.") + return False + + +@pytest.mark.only_platforms("android") +@pytest.mark.actual_platform_required +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_popup_text_cut_off(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.actual_platform_required +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_popup_text_cut_off(client)