Bug 1197455 - Call ps_set_search() only after successful grammar compilation. r=anatal
authorKelly Davis <kdavis@mozilla.com>
Sat, 22 Aug 2015 10:08:00 -0400
changeset 258978 42869ce0e1295e7bb92d7d9e05d80fb6b128a002
parent 258977 1cffe0166adb73f384a6883c46cbec60c64059b3
child 258979 1eb1c6f76ffc18bd10796bb660c703fd3693e50f
push id29268
push userryanvm@gmail.com
push dateTue, 25 Aug 2015 00:37:23 +0000
treeherdermozilla-central@08015770c9d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanatal
bugs1197455
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1197455 - Call ps_set_search() only after successful grammar compilation. r=anatal
dom/media/webspeech/recognition/PocketSphinxSpeechRecognitionService.cpp
--- a/dom/media/webspeech/recognition/PocketSphinxSpeechRecognitionService.cpp
+++ b/dom/media/webspeech/recognition/PocketSphinxSpeechRecognitionService.cpp
@@ -272,21 +272,21 @@ PocketSphinxSpeechRecognitionService::Va
   } else if (aSpeechGrammar) {
     nsAutoString grammar;
     ErrorResult rv;
     aSpeechGrammar->GetSrc(grammar, rv);
 
     int result = ps_set_jsgf_string(mPSHandle, "name",
                                     NS_ConvertUTF16toUTF8(grammar).get());
 
-    ps_set_search(mPSHandle, "name");
-
     if (result != 0) {
       ISGrammarCompiled = false;
     } else {
+      ps_set_search(mPSHandle, "name");
+
       ISGrammarCompiled = true;
     }
   } else {
     ISGrammarCompiled = false;
   }
 
   return ISGrammarCompiled ? NS_OK : NS_ERROR_NOT_INITIALIZED;
 }