commit 7f06dbd6b7659c62e55937c15f6c4604cd7f920a
parent d294322fca23b73c975b89c9055a6bc78f6c2a03
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date: Fri, 17 Oct 2025 21:02:59 +0000
Bug 1986438 - add a webcompat intervention for gamma.app; r=webcompat-reviewers,ksenia
Differential Revision: https://phabricator.services.mozilla.com/D269107
Diffstat:
5 files changed, 87 insertions(+), 2 deletions(-)
diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json
@@ -5250,6 +5250,23 @@
}
]
},
+ "1986438": {
+ "label": "gamma.app",
+ "bugs": {
+ "1986438": {
+ "issue": "unsupported-warning",
+ "matches": ["*://gamma.app/*"]
+ }
+ },
+ "interventions": [
+ {
+ "platforms": ["desktop"],
+ "content_scripts": {
+ "js": ["1986438-gamma.app-hide-unsupported.js"]
+ }
+ }
+ ]
+ },
"1987351": {
"label": "mirage.decart.ai",
"bugs": {
diff --git a/browser/extensions/webcompat/injections/js/1986438-gamma.app-hide-unsupported.js b/browser/extensions/webcompat/injections/js/1986438-gamma.app-hide-unsupported.js
@@ -0,0 +1,34 @@
+/* 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/. */
+
+"use strict";
+
+/**
+ * Bug 1986438 - hide browser warning on gamma.app
+ */
+
+const callback = (mutations, observer) => {
+ const search = document.evaluate(
+ "//*[text()[contains(., 'works best on Chrome')]]",
+ document,
+ null,
+ 4
+ );
+ const found = search.iterateNext();
+ if (found) {
+ const alerts = found.closest(".chakra-alert");
+ if (alerts.querySelectorAll(".chakra-stack").length === 1) {
+ alerts.remove();
+ } else {
+ found.closest(".chakra-stack").remove();
+ }
+ observer?.disconnect();
+ }
+};
+
+const observer = new MutationObserver(callback);
+observer.observe(document.documentElement, {
+ childList: true,
+ subtree: true,
+});
diff --git a/browser/extensions/webcompat/injections/js/bug1902399-recochoku.jp-hide-unsupported-browser-warning.js b/browser/extensions/webcompat/injections/js/bug1902399-recochoku.jp-hide-unsupported-browser-warning.js
@@ -9,7 +9,6 @@
*/
const callback = (mutations, observer) => {
- console.error(mutations, observer);
const search = document.evaluate(
"//*[text()[contains(., 'Chromeブラウザの最新版をご利用ください')]]",
document,
diff --git a/browser/extensions/webcompat/manifest.json b/browser/extensions/webcompat/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.",
- "version": "146.1.0",
+ "version": "146.2.0",
"browser_specific_settings": {
"gecko": {
"id": "webcompat@mozilla.org",
diff --git a/testing/webcompat/interventions/tests/test_1986438_gamma_app.py b/testing/webcompat/interventions/tests/test_1986438_gamma_app.py
@@ -0,0 +1,35 @@
+import pytest
+from webdriver import NoSuchElementException
+
+URL = "https://gamma.app/signup"
+UNSUPPORTED_TEXT = "works best on Chrome"
+
+
+async def does_warning_show(client):
+ await client.navigate(URL)
+ try:
+ client.await_text(UNSUPPORTED_TEXT, is_displayed=True, timeout=3)
+ return True
+ except NoSuchElementException:
+ return False
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.with_interventions
+async def test_enabled(client):
+ assert not await does_warning_show(client)
+
+
+@pytest.mark.skip_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.without_interventions
+async def test_disabled(client):
+ assert await does_warning_show(client)
+
+
+@pytest.mark.only_platforms("android")
+@pytest.mark.asyncio
+@pytest.mark.without_interventions
+async def test_not_shown_on_android(client):
+ assert not await does_warning_show(client)