tor-browser

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

commit d537926582997600d22c729d83c7485d6865486d
parent 7183da629743a0d10d016b0b50efcec03b525bb3
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Mon,  6 Oct 2025 13:56:50 +0000

Bug 1938533 - add a JS webcompat intervention for ChatGPT to fix voice mode; r=webcompat-reviewers,ksenia

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

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 18++++++++++++++++++
Abrowser/extensions/webcompat/injections/js/bug1938533-chatgpt.com-fix-voice-mode.js | 33+++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -5246,6 +5246,24 @@ } ] }, + "1938533": { + "label": "chatgpt.com", + "bugs": { + "1938533": { + "issue": "broken-interactive-elements", + "matches": ["https://chatgpt.com/*"] + } + }, + "interventions": [ + { + "platforms": ["all"], + "only_channels": ["nightly"], + "content_scripts": { + "js": ["bug1938533-chatgpt.com-fix-voice-mode.js"] + } + } + ] + }, "1976402": { "label": "dieseldispatch.com", "bugs": { diff --git a/browser/extensions/webcompat/injections/js/bug1938533-chatgpt.com-fix-voice-mode.js b/browser/extensions/webcompat/injections/js/bug1938533-chatgpt.com-fix-voice-mode.js @@ -0,0 +1,33 @@ +/* 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"; + +/** + * Bugs 1938533 - ChatGPT voice mode does not always work. + * + * ChatGPT voice seems to be relying on peer reflexive candidates. It + * isn't giving Firefox any STUN/TURN servers in the RTCPeerConnection + * config which is a bit unusual. The following works around the issue. + */ + +/* globals exportFunction */ + +console.info( + "RTCPeerConnection is being shimmed for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1938533 for details." +); + +const win = window.wrappedJSObject; +const origRTCPeerConnection = win.RTCPeerConnection; +win.RTCPeerConnection = exportFunction(function (cfg = {}) { + const extra = [{ urls: "stun:stun.l.google.com:19302" }]; + const merged = { ...cfg, iceServers: [...(cfg.iceServers || []), ...extra] }; + const pc = new origRTCPeerConnection(merged); + pc.addEventListener("icecandidateerror", e => console.warn("ICE error", e)); + pc.addEventListener("iceconnectionstatechange", () => + console.log("iceConnectionState", pc.iceConnectionState) + ); + return pc; +}, window); +win.RTCPeerConnection.prototype = origRTCPeerConnection.prototype;