Skip to main content

A phone's voice list stopped Strudel from loading

On Brave for iPhone the editor opened blank with undefined is not an object (evaluating 'Object.getPrototypeOf(voice)'), and a game using the editor's helpers fell back to its own song.

Neither the message nor voice is in this repository or its dependencies. Strudel reads the speech voices while @strudel/core is being imported (speak.mjs). Brave's iOS privacy script patches getVoices to add a copy of a real voice, and copies undefined while the phone's list is still empty. The throw lands inside the import, so Strudel never loads.

flowchart LR
I[Import @strudel/core] --> V[getVoices]
V --> B{Brave: list empty?}
B -- yes --> T[Throws, import fails]
B -- no --> L[Strudel loads]

guardSpeechVoices wraps getVoices so that it answers with an empty list instead. It runs when strudelPlayback.ts is evaluated, which comes before any Strudel import because all of them are lazy. A new static import of a Strudel package would run before it.

The failure was reproduced by patching getVoices to throw in headless Chromium, not in Brave itself.