tor-browser

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

commit 1bc20331e8ec1211ddf9d37c141e571bf3e7b06c
parent 2482353783a339bd977e7a41d734594d6e35a9c4
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Wed, 22 Oct 2025 14:47:06 +0000

Bug 1994704 - add a desktop-only JS webcompat intervention for avlguest.justice.nsw.gov.au; r=webcompat-reviewers,ksenia

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

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 18++++++++++++++++++
Abrowser/extensions/webcompat/injections/js/1994704-avlguest.justice.nsw.gov.au-shim-mozRTC-APIs.js | 27+++++++++++++++++++++++++++
Atesting/webcompat/interventions/tests/test_1994704_avlguest_justice_nsw_gov_au.py | 31+++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -5756,6 +5756,24 @@ } ] }, + "1994704": { + "label": "avlguest.justice.nsw.gov.au", + "bugs": { + "1994704": { + "issue": "page-fails-to-load", + "matches": ["*://avlguest.justice.nsw.gov.au/*"] + } + }, + "interventions": [ + { + "platforms": ["desktop"], + "content_scripts": { + "all_frames": true, + "js": ["1994704-avlguest.justice.nsw.gov.au-shim-mozRTC-APIs.js"] + } + } + ] + }, "1995452": { "label": "polymarket.com", "bugs": { diff --git a/browser/extensions/webcompat/injections/js/1994704-avlguest.justice.nsw.gov.au-shim-mozRTC-APIs.js b/browser/extensions/webcompat/injections/js/1994704-avlguest.justice.nsw.gov.au-shim-mozRTC-APIs.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 1994704 - avlguest.justice.nsw.gov.au test page does not load + * + * The page relies on non-standard mozRTCPeerConnection, which is no longer + * needed. We can just set it to RTCPeerConnection. + */ + +/* globals exportFunction */ + +console.info( + "moz-prefixed JS APIs are being shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1994704 for details." +); + +window.wrappedJSObject.mozRTCPeerConnection = + window.wrappedJSObject.RTCPeerConnection; + +window.wrappedJSObject.mozRTCSessionDescription = + window.wrappedJSObject.RTCSessionDescription; + +window.wrappedJSObject.mozRTCIceCandidate = + window.wrappedJSObject.RTCIceCandidate; diff --git a/testing/webcompat/interventions/tests/test_1994704_avlguest_justice_nsw_gov_au.py b/testing/webcompat/interventions/tests/test_1994704_avlguest_justice_nsw_gov_au.py @@ -0,0 +1,31 @@ +import pytest + +URL = "https://avlguest.justice.nsw.gov.au/call/test.link" +IFRAME_CSS = "#widget-frame" +ERROR_MSG = "ReferenceError: mozRTCPeerConnection is not defined" +SUCCESS_CSS = "a.install.btn-success" +INSTALL_APP_CSS = "#installApp" + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL, wait="none") + client.switch_to_frame(client.await_css(IFRAME_CSS)) + assert client.await_css(SUCCESS_CSS, is_displayed=True) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=ERROR_MSG) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_app_installation_requested_on_android(client): + await client.navigate(URL, wait="none") + assert client.await_css(INSTALL_APP_CSS, is_displayed=True)