tor-browser

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

commit df7b12438b27497d8c05523ce4f550870a0074e1
parent f3fe5c71de921e9693b0fb3ae1426e0e7ed6ef29
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Wed, 22 Oct 2025 14:47:04 +0000

Bug 1898951 - add a CSS webcompat intervention for hexagame.io; r=webcompat-reviewers,ksenia

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

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 17+++++++++++++++++
Abrowser/extensions/webcompat/injections/js/bug1898951-hexagame.io-prevent-unsupported-alert.js | 24++++++++++++++++++++++++
Atesting/webcompat/interventions/tests/test_1898951_hexagame_io.py | 20++++++++++++++++++++
3 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -2352,6 +2352,23 @@ } ] }, + "1898951": { + "label": "hexagame.io", + "bugs": { + "1898951": { + "issue": "unsupported-warning", + "matches": ["*://hexagame.io/*"] + } + }, + "interventions": [ + { + "platforms": ["desktop"], + "content_scripts": { + "js": ["bug1898951-hexagame.io-prevent-unsupported-alert.js"] + } + } + ] + }, "1898952": { "label": "digits.t-mobile.com", "bugs": { diff --git a/browser/extensions/webcompat/injections/js/bug1898951-hexagame.io-prevent-unsupported-alert.js b/browser/extensions/webcompat/injections/js/bug1898951-hexagame.io-prevent-unsupported-alert.js @@ -0,0 +1,24 @@ +/* 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/. */ + +/* globals exportFunction */ + +"use strict"; + +/** + * hexagame.io - Shows an alert recommending other browsers. + * Bug #1898951 - https://bugzilla.mozilla.org/show_bug.cgi?id=1898951 + * WebCompat issue #120035 - https://webcompat.com/issues/120035 + */ + +console.info( + "window.alert is being overriden for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1898951 for details." +); + +const originalAlert = window.wrappedJSObject.alert; +window.wrappedJSObject.alert = exportFunction(function (msg) { + if (!msg?.toLowerCase?.().includes("chrome")) { + originalAlert(msg); + } +}, window); diff --git a/testing/webcompat/interventions/tests/test_1898951_hexagame_io.py b/testing/webcompat/interventions/tests/test_1898951_hexagame_io.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://hexagame.io/" +UNSUPPORTED_ALERT = "This game works better in Chrome!" + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert not await client.find_alert(delay=3) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, wait="none") + assert await client.await_alert(UNSUPPORTED_ALERT)