tor-browser

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

commit 5a267ee2c572c9328925659f8a054be35d074b6a
parent c847d129124461a75db1b659e883c5f2c9101ea7
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Tue, 21 Oct 2025 14:47:21 +0000

Bug 1970810 - add a Linux-only JS webcompat intervention for www.camper-van-week-end.fr; r=webcompat-reviewers,ksenia

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

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 19+++++++++++++++++++
Abrowser/extensions/webcompat/injections/js/bug1970810-www.camper-van-week-end.fr-appVersion-linux-fix.js | 27+++++++++++++++++++++++++++
Atesting/webcompat/interventions/tests/test_1970810_camper-van-week-end_fr.py | 22++++++++++++++++++++++
3 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -5018,6 +5018,25 @@ } ] }, + "1970810": { + "label": "camper-van-week-end.fr", + "bugs": { + "1970810": { + "issue": "page-fails-to-load", + "matches": ["*://www.camper-van-week-end.fr/*"] + } + }, + "interventions": [ + { + "platforms": ["linux"], + "content_scripts": { + "js": [ + "bug1970810-www.camper-van-week-end.fr-appVersion-linux-fix.js" + ] + } + } + ] + }, "1972511": { "label": "cmyportal.tkc.co.jp", "bugs": { diff --git a/browser/extensions/webcompat/injections/js/bug1970810-www.camper-van-week-end.fr-appVersion-linux-fix.js b/browser/extensions/webcompat/injections/js/bug1970810-www.camper-van-week-end.fr-appVersion-linux-fix.js @@ -0,0 +1,27 @@ +/* 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 1970810 - camper-van-week-end.fr/chantilly does not load on Linux + * WebCompat issue #155547 - https://webcompat.com/issues/155547 + * + * The page expects navigator.appVersion to contain the literal string + * "linux" on Linux, and their JS otherwise breaks. + * + * As such this site patch sets appVersion to "5.0 (Linux)", and is + * only meant to be applied on Linux. + */ + +/* globals exportFunction */ + +console.info( + "navigator.appVersion has been shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1970810 for details." +); + +const nav = Object.getPrototypeOf(navigator.wrappedJSObject); +const appVersion = Object.getOwnPropertyDescriptor(nav, "appVersion"); +appVersion.get = exportFunction(() => "5.0 (Linux)", window); +Object.defineProperty(nav, "appVersion", appVersion); diff --git a/testing/webcompat/interventions/tests/test_1970810_camper-van-week-end_fr.py b/testing/webcompat/interventions/tests/test_1970810_camper-van-week-end_fr.py @@ -0,0 +1,22 @@ +import pytest + +URL = "https://www.camper-van-week-end.fr/chantilly/" +LOADING_CSS = "#pageloader" +ERROR_MSG = "TypeError: can't access property 0, match is null" + + +@pytest.mark.only_platforms("linux") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL, wait="none") + client.await_css(LOADING_CSS, is_displayed=True) + client.await_css(LOADING_CSS, is_displayed=False) + + +@pytest.mark.only_platforms("linux") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=ERROR_MSG) + client.await_css(LOADING_CSS, is_displayed=True)