Bug 1514016 - Make MediaRecorder::Stop idempotent. r=jib, a=RyanVM
authorAndreas Pehrson <apehrson@mozilla.com>
Mon, 14 Jan 2019 18:32:55 +0000
changeset 506735 e74775e3a7417ae8c796cdb049d87d49805163b8
parent 506734 9e2fe8635c950031d12b391ebbc093a7921f22bc
child 506736 f8fa8bc2b93f37a5543c54771ca941ff8d5f953d
push id10530
push userryanvm@gmail.com
push dateWed, 16 Jan 2019 14:53:15 +0000
treeherdermozilla-beta@944e9c24989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib, RyanVM
bugs1514016
milestone65.0
Bug 1514016 - Make MediaRecorder::Stop idempotent. r=jib, a=RyanVM Depends on D14571 Differential Revision: https://phabricator.services.mozilla.com/D15909
dom/media/MediaRecorder.cpp
dom/media/test/test_mediarecorder_state_transition.html
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -1326,17 +1326,16 @@ void MediaRecorder::Start(const Optional
   mStartTime = TimeStamp::Now();
   Telemetry::ScalarAdd(Telemetry::ScalarID::MEDIARECORDER_RECORDING_COUNT, 1);
 }
 
 void MediaRecorder::Stop(ErrorResult& aResult) {
   LOG(LogLevel::Debug, ("MediaRecorder.Stop %p", this));
   MediaRecorderReporter::RemoveMediaRecorder(this);
   if (mState == RecordingState::Inactive) {
-    aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
   mState = RecordingState::Inactive;
   MOZ_ASSERT(mSessions.Length() > 0);
   mSessions.LastElement()->Stop();
 }
 
 void MediaRecorder::Pause(ErrorResult& aResult) {
--- a/dom/media/test/test_mediarecorder_state_transition.html
+++ b/dom/media/test/test_mediarecorder_state_transition.html
@@ -11,17 +11,17 @@
 <script class="testbody" type="text/javascript">
 var manager = new MediaTestManager;
 
 // List of operation tests for media recorder objects to verify if running
 // these operations should result in an exception or not
 var operationTests = [
   {
     operations: ['stop'],
-    isValid: false
+    isValid: true
   },
   {
     operations: ['requestData'],
     isValid: false
   },
   {
     operations: ['pause'],
     isValid: false
@@ -65,17 +65,17 @@ var operationTests = [
     isValid: false
   },
   {
     operations: ['requestData', 'start'],
     isValid: false
   },
   {
     operations: ['stop', 'start'],
-    isValid: false
+    isValid: true
   },
   {
     operations: ['start', 'stop'],
     isValid: true
   },
   {
     operations: ['start', 'stop'],
     isValid: true,
@@ -151,17 +151,17 @@ var operationTests = [
     isValid: false
   },
   {
     operations: ['start', 'stop', 'requestData'],
     isValid: false
   },
   {
     operations: ['start', 'stop', 'stop'],
-    isValid: false
+    isValid: true
   },
   {
     operations: ['start', 'pause', 'resume', 'resume'],
     isValid: true
   },
   {
     operations: ['start', 'pause', 'resume', 'resume'],
     isValid: true,