Closed Bug 1236060 Opened 8 years ago Closed 8 years ago

Utterance errors don't advance queue

Categories

(Core :: Web Speech, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: eeejay, Assigned: eeejay)

Details

Attachments

(1 file)

If an utterance ends with an error, the window and global queue don't advance.
Attachment #8703170 - Flags: review?(bugs)
Comment on attachment 8703170 [details] [diff] [review]
Dispatch error should advance queue.

> nsSpeechTask::DispatchError(float aElapsedTime, uint32_t aCharIndex)
> {
>+  LOG(LogLevel::Debug, ("nsSpeechTask::DispatchError"));
>+
>   if (!mIndirectAudio) {
>     NS_WARNING("Can't call DispatchError() from a direct audio speech service");
>     return NS_ERROR_FAILURE;
>   }
> 
>+  if (!mPreCanceled) {
>+    nsSynthVoiceRegistry::GetInstance()->SpeakNext();
>+  }
>+
>   return DispatchErrorImpl(aElapsedTime, aCharIndex);
> }
> 
> nsresult
> nsSpeechTask::DispatchErrorImpl(float aElapsedTime, uint32_t aCharIndex)
> {
>   MOZ_ASSERT(mUtterance);
>   if(NS_WARN_IF(mUtterance->mState == SpeechSynthesisUtterance::STATE_ENDED)) {
>     return NS_ERROR_NOT_AVAILABLE;
>   }
> 
>+  if (mSpeechSynthesis) {
>+    mSpeechSynthesis->OnEnd(this);
>+  }
>+
>   mUtterance->mState = SpeechSynthesisUtterance::STATE_ENDED;
>   mUtterance->DispatchSpeechSynthesisEvent(NS_LITERAL_STRING("error"),
>                                            aCharIndex, aElapsedTime,
>                                            EmptyString());

This looks a bit odd. We call SpeakNext before dispatching error event. I'd expect error event handler to be able to cancel proceeding altogether.
Also calling SpeakNext() before calling OnEnd(), is that really what happens in non-error cases?
Could you explain or fix, and ask review again.
Attachment #8703170 - Flags: review?(bugs)
Comment on attachment 8703170 [details] [diff] [review]
Dispatch error should advance queue.

oh, actually, perhaps we want this behavior so that error listener can cancel the already scheduled thing.
Attachment #8703170 - Flags: review+
Assignee: nobody → eitan
https://hg.mozilla.org/mozilla-central/rev/67ea3d1ffcdb
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: