From b82b4d9d94244ba0469200c173b4dafc53fff9ed Mon Sep 17 00:00:00 2001 From: dadaloop82 Date: Sat, 16 May 2026 16:28:06 +0000 Subject: [PATCH] fix: guard against Brave user-script fake SpeechSynthesisVoice proxy (#63) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Brave on iOS injects a user-script that wraps SpeechSynthesisVoice objects with a fake proxy. Accessing v.lang on the proxy threw 'undefined is not an object (evaluating Object.getPrototypeOf(voice))'. Fix: wrap the v.lang access in _initBrowserTtsVoices filter() inside its own try/catch — bad proxies are silently discarded. --- assets/js/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/js/app.js b/assets/js/app.js index 6c3d4f3..6c4fbc6 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -12663,7 +12663,10 @@ function _initBrowserTtsVoices(selectedVoice) { const populate = () => { let voices = []; try { - voices = (window.speechSynthesis.getVoices() || []).filter(v => v != null && v.lang); + voices = (window.speechSynthesis.getVoices() || []).filter(v => { + try { return v != null && typeof v.lang === 'string' && v.lang.length > 0; } + catch (_) { return false; } + }); } catch (_) { return false; } if (!voices.length) return false; // Italian voices first, then others