Bug 1300016 - only suspend web-speech when mUtterance exists. r=eeejay, a=gchang
authorAlastor Wu <alwu@mozilla.com>
Mon, 07 Nov 2016 17:49:13 +0800
changeset 439968 263190e20543fc7f39c6d41c8fd31cedccdbffd8
parent 439967 6c8d0b43d402c9b60deda50340518184032b8aba
child 439969 2ab68e90f1effbd8517bb785509aa2d0567db9ab
push id36143
push userjkingston@mozilla.com
push dateWed, 16 Nov 2016 22:20:38 +0000
reviewerseeejay, gchang
bugs1300016
milestone51.0a2
Bug 1300016 - only suspend web-speech when mUtterance exists. r=eeejay, a=gchang MozReview-Commit-ID: E29qJ1sgZ5c
dom/media/webspeech/synth/nsSpeechTask.cpp
--- a/dom/media/webspeech/synth/nsSpeechTask.cpp
+++ b/dom/media/webspeech/synth/nsSpeechTask.cpp
@@ -742,16 +742,20 @@ nsSpeechTask::WindowVolumeChanged(float 
 {
   SetAudioOutputVolume(aMuted ? 0.0 : mVolume * aVolume);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSpeechTask::WindowSuspendChanged(nsSuspendedTypes aSuspend)
 {
+  if (!mUtterance) {
+    return NS_OK;
+  }
+
   if (aSuspend == nsISuspendedTypes::NONE_SUSPENDED &&
       mUtterance->mPaused) {
     Resume();
   } else if (aSuspend != nsISuspendedTypes::NONE_SUSPENDED &&
              !mUtterance->mPaused) {
     Pause();
   }
   return NS_OK;