Bug 1185234 - Implement SpeechRecognition::interimResults. r=smaug

This commit is contained in:
Kelly Davis 2015-08-02 22:20:00 -04:00
Родитель 6bbb4e6fcd
Коммит 27ccbe00c4
3 изменённых файлов: 18 добавлений и 8 удалений

Просмотреть файл

@ -116,6 +116,7 @@ SpeechRecognition::SpeechRecognition(nsPIDOMWindow* aOwnerWindow)
, mAudioSamplesPerChunk(mEndpointer.FrameSize())
, mSpeechDetectionTimer(do_CreateInstance(NS_TIMER_CONTRACTID))
, mSpeechGrammarList(new SpeechGrammarList(GetParentObject()))
, mInterimResults(false)
{
SR_LOG("created SpeechRecognition");
@ -669,16 +670,15 @@ SpeechRecognition::SetContinuous(bool aArg, ErrorResult& aRv)
}
bool
SpeechRecognition::GetInterimResults(ErrorResult& aRv) const
SpeechRecognition::InterimResults() const
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
return false;
return mInterimResults;
}
void
SpeechRecognition::SetInterimResults(bool aArg, ErrorResult& aRv)
SpeechRecognition::SetInterimResults(bool aArg)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
mInterimResults = aArg;
return;
}

Просмотреть файл

@ -83,9 +83,9 @@ public:
void SetContinuous(bool aArg, ErrorResult& aRv);
bool GetInterimResults(ErrorResult& aRv) const;
bool InterimResults() const;
void SetInterimResults(bool aArg, ErrorResult& aRv);
void SetInterimResults(bool aArg);
uint32_t GetMaxAlternatives(ErrorResult& aRv) const;
@ -255,6 +255,17 @@ private:
nsRefPtr<SpeechGrammarList> mSpeechGrammarList;
// WebSpeechAPI (http://bit.ly/1gIl7DC) states:
//
// 1. Default value MUST be false
// 2. If true, interim results SHOULD be returned
// 3. If false, interim results MUST NOT be returned
//
// Pocketsphinx does not return interm results; so, defaulting
// mInterimResults to false, then ignoring its subsequent value
// is a conforming implementation.
bool mInterimResults;
void ProcessTestEventRequest(nsISupports* aSubject, const nsAString& aEventName);
const char* GetName(FSMState aId);

Просмотреть файл

@ -19,7 +19,6 @@ interface SpeechRecognition : EventTarget {
attribute DOMString lang;
[Throws]
attribute boolean continuous;
[Throws]
attribute boolean interimResults;
[Throws]
attribute unsigned long maxAlternatives;