Ok, finally figured it out.
I had a compatibility code to support html5 speechless browser,
if (SpeechSynthesisUtterance == undefined) { function SpeechSynthesisUtterance(text) { this.text = text; } }
This works in Chrome and Firefox, but in Safari it seems that any function in any script is evaluated when the script is analyzed, so the function is declared even though SpeechSynthesisUtterance already exists.
I think I will need to do it differently ...
James source share