Bug 1269741 - Allow resuming a suspended AudioContext in the same event loop run. r=karlt
authorPaul Adenot <paul@paul.cx>
Mon, 27 Jun 2016 14:17:38 +0200
changeset 381514 7b0517746549ee534f6e8021c2d87b6672a2acfa
parent 381513 cc90d9d43123ac4bf6a50b2945aebaf9df7a206d
child 381515 88213a36d165b095738bfff456433f74760f33fa
push id21504
push userbmo:npang@mozilla.com
push dateMon, 27 Jun 2016 18:10:09 +0000
reviewerskarlt
bugs1269741
milestone50.0a1
Bug 1269741 - Allow resuming a suspended AudioContext in the same event loop run. r=karlt MozReview-Commit-ID: L7WlO96d2vh
dom/media/webaudio/AudioContext.cpp
--- a/dom/media/webaudio/AudioContext.cpp
+++ b/dom/media/webaudio/AudioContext.cpp
@@ -904,21 +904,16 @@ AudioContext::Suspend(ErrorResult& aRv)
   }
 
   if (mAudioContextState == AudioContextState::Closed ||
       mCloseCalled) {
     promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
     return promise.forget();
   }
 
-  if (mAudioContextState == AudioContextState::Suspended) {
-    promise->MaybeResolve(JS::UndefinedHandleValue);
-    return promise.forget();
-  }
-
   Destination()->Suspend();
 
   mPromiseGripArray.AppendElement(promise);
 
   nsTArray<MediaStream*> streams;
   // If mSuspendCalled is true then we already suspended all our streams,
   // so don't suspend them again (since suspend(); suspend(); resume(); should
   // cancel both suspends). But we still need to do ApplyAudioContextOperation
@@ -951,21 +946,16 @@ AudioContext::Resume(ErrorResult& aRv)
   }
 
   if (mAudioContextState == AudioContextState::Closed ||
       mCloseCalled) {
     promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
     return promise.forget();
   }
 
-  if (mAudioContextState == AudioContextState::Running) {
-    promise->MaybeResolve(JS::UndefinedHandleValue);
-    return promise.forget();
-  }
-
   Destination()->Resume();
 
   nsTArray<MediaStream*> streams;
   // If mSuspendCalled is false then we already resumed all our streams,
   // so don't resume them again (since suspend(); resume(); resume(); should
   // be OK). But we still need to do ApplyAudioContextOperation
   // to ensure our new promise is resolved.
   if (mSuspendCalled) {