commit 4f17b806671936375f40ed443f51c22bec9364e8
parent 44f4c959dd4c2aa47bbf487092be7f799c062208
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date: Thu, 9 Oct 2025 01:01:18 +0000
Bug 1973976 - add a CSS webcompat intervention for iweather.gov.vn; r=webcompat-reviewers,ksenia
Differential Revision: https://phabricator.services.mozilla.com/D268015
Diffstat:
3 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json
@@ -5225,6 +5225,24 @@
}
]
},
+ "1973976": {
+ "label": "iweather.gov.vn",
+ "bugs": {
+ "1973976": {
+ "issue": "broken-layout",
+ "matches": ["*://iweather.gov.vn/*"]
+ }
+ },
+ "interventions": [
+ {
+ "platforms": ["all"],
+ "pref_check": { "layout.css.webkit-fill-available.enabled": false },
+ "content_scripts": {
+ "css": ["bug1973976-iweather.gov.vn-fix-narrow-interface.css"]
+ }
+ }
+ ]
+ },
"1976402": {
"label": "dieseldispatch.com",
"bugs": {
diff --git a/browser/extensions/webcompat/injections/css/bug1973976-iweather.gov.vn-fix-narrow-interface.css b/browser/extensions/webcompat/injections/css/bug1973976-iweather.gov.vn-fix-narrow-interface.css
@@ -0,0 +1,14 @@
+/* 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/. */
+
+/**
+ * iweather.gov.vn - the bottom map interface does not stretch to fill width
+ * Bug #1973976 - https://bugzilla.mozilla.org/show_bug.cgi?id=1973976
+ *
+ * The page uses the non-standard webkit-fill-available, which we can
+ * correct by also adding -moz-available.
+ */
+.w-mc {
+ width: -moz-available;
+}
diff --git a/testing/webcompat/interventions/tests/test_1973976_iweather_gov_vn.py b/testing/webcompat/interventions/tests/test_1973976_iweather_gov_vn.py
@@ -0,0 +1,39 @@
+import pytest
+
+URL = "https://iweather.gov.vn/dashboard/?areaRadar=COM&productRadar=CMAX"
+
+MAP_CSS = "#map"
+ASIDE_CSS = "aside.fixed"
+BOTTOM_BAR_CSS = ".w-mc.transition-all"
+
+
+async def is_bottom_bar_full_width(client, platform):
+ await client.navigate(URL, wait="none")
+ client.add_stylesheet(f"{BOTTOM_BAR_CSS} {{ transition-duration:0s !important; }}")
+ map = client.await_css(MAP_CSS, is_displayed=True)
+ aside = client.await_css(ASIDE_CSS, is_displayed=True)
+ bottom_bar = client.await_css(BOTTOM_BAR_CSS, is_displayed=True)
+ return client.execute_script(
+ """
+ const [ bottom_bar, map, aside, android ] = arguments;
+ return bottom_bar.clientWidth == map.clientWidth - (android ? 0 : aside.clientWidth);
+ """,
+ bottom_bar,
+ map,
+ aside,
+ platform == "android",
+ )
+
+
+@pytest.mark.enable_webkit_fill_available
+@pytest.mark.asyncio
+@pytest.mark.with_interventions
+async def test_enabled(client, platform):
+ assert await is_bottom_bar_full_width(client, platform)
+
+
+@pytest.mark.disable_webkit_fill_available
+@pytest.mark.asyncio
+@pytest.mark.without_interventions
+async def test_disabled(client, platform):
+ assert not await is_bottom_bar_full_width(client, platform)