mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 902145 - Ignore all speech events while aborting. r=smaug
This commit is contained in:
parent
b7c52c11e1
commit
dfb2add017
@ -138,6 +138,11 @@ SpeechRecognition::ProcessEvent(SpeechEvent* aEvent)
|
||||
GetName(aEvent),
|
||||
GetName(mCurrentState));
|
||||
|
||||
if (mAborted && aEvent->mType != EVENT_ABORT) {
|
||||
// ignore all events while aborting
|
||||
return;
|
||||
}
|
||||
|
||||
Transition(aEvent);
|
||||
}
|
||||
|
||||
@ -297,9 +302,6 @@ SpeechRecognition::Transition(SpeechEvent* aEvent)
|
||||
MOZ_CRASH("Invalid event EVENT_COUNT");
|
||||
}
|
||||
break;
|
||||
case STATE_ABORTING:
|
||||
DoNothing(aEvent);
|
||||
break;
|
||||
case STATE_COUNT:
|
||||
MOZ_CRASH("Invalid state STATE_COUNT");
|
||||
}
|
||||
@ -377,6 +379,7 @@ SpeechRecognition::Reset()
|
||||
mEstimationSamples = 0;
|
||||
mBufferedSamples = 0;
|
||||
mSpeechDetectionTimer->Cancel();
|
||||
mAborted = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -490,9 +493,6 @@ SpeechRecognition::AbortSilently(SpeechEvent* aEvent)
|
||||
{
|
||||
bool stopRecording = StateBetween(STATE_ESTIMATING, STATE_RECOGNIZING);
|
||||
|
||||
// prevent reentrancy from DOM events
|
||||
SetState(STATE_ABORTING);
|
||||
|
||||
if (mRecognitionService) {
|
||||
mRecognitionService->Abort();
|
||||
}
|
||||
@ -734,6 +734,11 @@ SpeechRecognition::Stop()
|
||||
void
|
||||
SpeechRecognition::Abort()
|
||||
{
|
||||
if (mAborted) {
|
||||
return;
|
||||
}
|
||||
|
||||
mAborted = true;
|
||||
nsRefPtr<SpeechEvent> event = new SpeechEvent(this, EVENT_ABORT);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
@ -891,7 +896,6 @@ SpeechRecognition::GetName(FSMState aId)
|
||||
"STATE_WAITING_FOR_SPEECH",
|
||||
"STATE_RECOGNIZING",
|
||||
"STATE_WAITING_FOR_RESULT",
|
||||
"STATE_ABORTING"
|
||||
};
|
||||
|
||||
MOZ_ASSERT(aId < STATE_COUNT);
|
||||
|
@ -170,7 +170,6 @@ private:
|
||||
STATE_WAITING_FOR_SPEECH,
|
||||
STATE_RECOGNIZING,
|
||||
STATE_WAITING_FOR_RESULT,
|
||||
STATE_ABORTING,
|
||||
STATE_COUNT
|
||||
};
|
||||
|
||||
@ -260,6 +259,7 @@ private:
|
||||
uint32_t mBufferedSamples;
|
||||
|
||||
nsCOMPtr<nsITimer> mSpeechDetectionTimer;
|
||||
bool mAborted;
|
||||
|
||||
void ProcessTestEventRequest(nsISupports* aSubject, const nsAString& aEventName);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user