Bug 1239946 - Dispatch error event when nsISpeechService.Speak returns error. r=eeejay
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 25 Jan 2016 13:54:04 +0900
changeset 281456 a86aa13dc19c9ce2626377ff3c112134e49cb30e
parent 281455 1c4b0a89fd5b192ddfcb9a554ee8409eb0f32a67
child 281457 9807e39dc5bc53e34d0885a3af68f42f04a0fdf3
push id70803
push userm_kato@ga2.so-net.ne.jp
push dateMon, 25 Jan 2016 04:56:34 +0000
treeherdermozilla-inbound@9807e39dc5bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs1239946
milestone46.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 1239946 - Dispatch error event when nsISpeechService.Speak returns error. r=eeejay
dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
--- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
+++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
@@ -784,13 +784,19 @@ nsSynthVoiceRegistry::SpeakImpl(VoiceDat
   NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to get speech service type");
 
   if (serviceType == nsISpeechService::SERVICETYPE_INDIRECT_AUDIO) {
     aTask->InitIndirectAudio();
   } else {
     aTask->InitDirectAudio();
   }
 
-  aVoice->mService->Speak(aText, aVoice->mUri, aVolume, aRate, aPitch, aTask);
+  if (NS_FAILED(aVoice->mService->Speak(aText, aVoice->mUri, aVolume, aRate,
+                                        aPitch, aTask))) {
+    if (serviceType == nsISpeechService::SERVICETYPE_INDIRECT_AUDIO) {
+      aTask->DispatchError(0, 0);
+    }
+    // XXX When using direct audio, no way to dispatch error
+  }
 }
 
 } // namespace dom
 } // namespace mozilla