tor-browser

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

commit 763eb1c301cc9d50c345c7bc64d0c39a2bd53f6f
parent 7d5500e8f528571ac717fcdca9bb915815b78713
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Fri, 21 Nov 2025 21:57:55 +0000

Bug 2000558 - add CSS webcompat intervention for www.jal.co.jp; r=ksenia,webcompat-reviewers

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

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 17+++++++++++++++++
Abrowser/extensions/webcompat/injections/css/2000558-www.jal.co.jp-hide-app-recommendation.css | 16++++++++++++++++
Atesting/webcompat/interventions/tests/test_2000558_www_jal_co_jp.py | 32++++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -6044,5 +6044,22 @@ "ua_string": ["Chrome", "add_Firefox_as_Gecko"] } ] + }, + "2000558": { + "label": "www.jal.co.jp", + "bugs": { + "2000558": { + "issue": "broken-layout", + "matches": ["*://www.jal.co.jp/*"] + } + }, + "interventions": [ + { + "platforms": ["all"], + "content_scripts": { + "css": ["2000558-www.jal.co.jp-hide-app-recommendation.css"] + } + } + ] } } diff --git a/browser/extensions/webcompat/injections/css/2000558-www.jal.co.jp-hide-app-recommendation.css b/browser/extensions/webcompat/injections/css/2000558-www.jal.co.jp-hide-app-recommendation.css @@ -0,0 +1,16 @@ +/* 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.jal.co.jp - tables are not rendered correctly + * Bug #2000558 - https://bugzilla.mozilla.org/show_bug.cgi?id=2000558 + * WebCompat issue #130020 - https://github.com/webcompat/web-bugs/issues/130020 + * WebCompat issue #189157 - https://github.com/webcompat/web-bugs/issues/189157 + * + * The site adds min-width:max-content to the tables in quesiton, which other + * browsers ignore in different ways. We can just unapply that rule to fix it. + */ +.fixed_th1st table { + min-width: unset; +} diff --git a/testing/webcompat/interventions/tests/test_2000558_www_jal_co_jp.py b/testing/webcompat/interventions/tests/test_2000558_www_jal_co_jp.py @@ -0,0 +1,32 @@ +import pytest + +URL = "https://www.jal.co.jp/jp/ja/jalmile/use/jal/inter/routemiles.html" + +ACCORDION_CSS = "#ecoEast" +TABLE_CSS = "#ecoEast table" + + +async def is_table_fully_visible(client): + await client.navigate(URL, wait="none") + client.await_css(ACCORDION_CSS, is_displayed=True).click() + return client.execute_script( + """ + const table = arguments[0]; + const tableWidth = table.getBoundingClientRect().width; + const containerWidth = table.parentNode.getBoundingClientRect().width; + return tableWidth <= containerWidth; + """, + client.await_css(TABLE_CSS, is_displayed=True), + ) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await is_table_fully_visible(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await is_table_fully_visible(client)