tor-browser

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

commit 2a6d274745e5e8af998fb49c357638bb3a363c71
parent 4b662a30b0046d4ab7b06fc8d9c89ad05805f11f
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Tue, 25 Nov 2025 16:52:45 +0000

Bug 1898983 - add a webcompat intervention for elibrary.ferc.gov; r=denschub,webcompat-reviewers

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

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 17+++++++++++++++++
Abrowser/extensions/webcompat/injections/js/bug1898983-elibrary.ferc.gov-window-chrome-shim.js | 19+++++++++++++++++++
Atesting/webcompat/interventions/tests/test_1898983_elibrary_ferc_gov.py | 20++++++++++++++++++++
3 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -5381,6 +5381,23 @@ } ] }, + "1898983": { + "label": "elibrary.ferc.gov", + "bugs": { + "1898983": { + "issue": "unsupported-warning", + "matches": ["*://elibrary.ferc.gov/*"] + } + }, + "interventions": [ + { + "platforms": ["all"], + "content_scripts": { + "js": ["bug1898983-elibrary.ferc.gov-window-chrome-shim.js"] + } + } + ] + }, "1902496": { "label": "be.bim.mx", "bugs": { diff --git a/browser/extensions/webcompat/injections/js/bug1898983-elibrary.ferc.gov-window-chrome-shim.js b/browser/extensions/webcompat/injections/js/bug1898983-elibrary.ferc.gov-window-chrome-shim.js @@ -0,0 +1,19 @@ +/* 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 1898983 - UA spoof for elibrary.ferc.gov + * + * The site is checking for window.chrome, so let's spoof that. + */ + +/* globals exportFunction */ + +console.info( + "window.chrome has been shimmed for compatibility reasons. https://bugzilla.mozilla.org/show_bug.cgi?id=1898983 for details." +); + +window.wrappedJSObject.chrome = new window.wrappedJSObject.Object(); diff --git a/testing/webcompat/interventions/tests/test_1898983_elibrary_ferc_gov.py b/testing/webcompat/interventions/tests/test_1898983_elibrary_ferc_gov.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://elibrary.ferc.gov/eLibrary/filelist" + +UNSUPPORTED_TEXT = "Chrome and Edge" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + await client.stall(3) + 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)