Bug 1496383 - Fix state error cases of MediaRecorder to match the W3C spec r=jya

Fix a bug that the current MediaRecorder's state error cases does not match the W3C spec.
pause() and resume() should throw an INVAILD_STATE_ERR only when it is inactive state, making them
independant.
Simply changing if statements is enough because the underlying encoder object (TrackEncoder) will
ignore Suspend/Resume calls when it is already suspended/recording so there won't be side-effects by
multiple pause()/resume() calls.

Differential Revision: https://phabricator.services.mozilla.com/D7910

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bumsik Kim 2018-10-08 09:06:07 +00:00
Родитель 06267cb849
Коммит 90d3be0a4c
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -1385,7 +1385,7 @@ void
MediaRecorder::Pause(ErrorResult& aResult)
{
LOG(LogLevel::Debug, ("MediaRecorder.Pause"));
if (mState != RecordingState::Recording) {
if (mState == RecordingState::Inactive) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
@ -1403,7 +1403,7 @@ void
MediaRecorder::Resume(ErrorResult& aResult)
{
LOG(LogLevel::Debug, ("MediaRecorder.Resume"));
if (mState != RecordingState::Paused) {
if (mState == RecordingState::Inactive) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}