Open Bug 2050310 Opened 2 days ago Updated 1 day ago

speechSynthesis 'error' should use SpeechSynthesisErrorEvent and support the 'not-allowed' error code

Categories

(Core :: Web Speech, defect)

defect

Tracking

()

People

(Reporter: alwu, Unassigned)

References

(Depends on 1 open bug)

Details

Per the Web Speech API spec, SpeechSynthesis.speak() always queues the utterance, and when synthesis is not allowed to start the user agent fires an 'error' event using the SpeechSynthesisErrorEvent interface with error code "not-allowed" ("Synthesis was not allowed to start by the user agent or system in the current context.").

Firefox currently:

  1. does not include "not-allowed" in the SpeechSynthesisErrorCode enum (dom/webidl/SpeechSynthesisErrorEvent.webidl), and
  2. dispatches speech 'error' events as a plain SpeechSynthesisEvent (SpeechSynthesisUtterance::DispatchSpeechSynthesisEvent), so the error attribute is never set.

As a result, when an utterance is blocked from starting (for example by a platform audio-focus interruption, see bug 2047321), a page receives no spec-conformant error code describing why. Add "not-allowed" to the enum and dispatch a proper SpeechSynthesisErrorEvent carrying the error code.

Depends on: 2047321
You need to log in before you can comment on or make changes to this bug.