commit 18d46804696ca7686f6b66ad40773b109a40ebc6
parent c15c4a58076cd5e54e529a91dd463024306a69b1
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date: Thu, 2 Oct 2025 15:11:00 +0000
Bug 1987351 - add a webcompat intervention for mirage.decart.ai; r=webcompat-reviewers,ksenia
Differential Revision: https://phabricator.services.mozilla.com/D267008
Diffstat:
3 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json
@@ -5393,6 +5393,24 @@
}
]
},
+ "1987351": {
+ "label": "mirage.decart.ai",
+ "bugs": {
+ "1987351": {
+ "issue": "firefox-blocked-completely",
+ "matches": ["*://mirage.decart.ai/*"]
+ }
+ },
+ "interventions": [
+ {
+ "platforms": ["all"],
+ "content_scripts": {
+ "js": ["bug1928941-oasis.decart.ai-window-chrome-shim.js"]
+ },
+ "ua_string": ["Chrome", "add_Firefox_as_Gecko"]
+ }
+ ]
+ },
"1989241": {
"label": "useinsider.com",
"bugs": {
diff --git a/browser/extensions/webcompat/injections/js/bug1928941-oasis.decart.ai-window-chrome-shim.js b/browser/extensions/webcompat/injections/js/bug1928941-oasis.decart.ai-window-chrome-shim.js
@@ -6,14 +6,16 @@
/**
* Bug 1928941 - UA spoof for oasis.decart.ai
+ * Bug 1987351 - UA spoof for mirage.decart.ai
*
- * This site is checking for window.chrome, so let's spoof that.
+ * These sites are checking for window.chrome, so let's spoof that.
*/
/* globals exportFunction */
+const bug = location.origin.includes("mirage.decart.ai") ? 1987351 : 1928941;
console.info(
- "window.chrome has been shimmed for compatibility reasons. https://bugzilla.mozilla.org/show_bug.cgi?id=1928941 for details."
+ `window.chrome has been shimmed for compatibility reasons. https://bugzilla.mozilla.org/show_bug.cgi?id=${bug} for details.`
);
window.wrappedJSObject.chrome = new window.wrappedJSObject.Object();
diff --git a/testing/webcompat/interventions/tests/test_1987351_mirage_decart_ai.py b/testing/webcompat/interventions/tests/test_1987351_mirage_decart_ai.py
@@ -0,0 +1,21 @@
+import pytest
+
+URL = "https://mirage.decart.ai/terms-of-service"
+
+SUPPORTED_TEXT = "Terms of Service"
+UNSUPPORTED_TEXT = "work properly in Firefox"
+
+
+@pytest.mark.asyncio
+@pytest.mark.with_interventions
+async def test_enabled(client):
+ await client.navigate(URL)
+ assert client.await_text(SUPPORTED_TEXT, is_displayed=True)
+ assert not client.find_text(UNSUPPORTED_TEXT, is_displayed=True)
+
+
+@pytest.mark.asyncio
+@pytest.mark.without_interventions
+async def test_disabled(client):
+ await client.navigate(URL)
+ assert client.await_text(UNSUPPORTED_TEXT, is_displayed=True)