Backed out changeset 3a4afeb8a046 (bug 1295352)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 31 Aug 2016 22:55:52 +0200
changeset 353414 63d043a689cac950bcebd9eec0a7e583d2612f03
parent 353413 ac2c86f6827e65a2699a35aef820dd7b193de500
child 353415 c014d7dc47943d9c1e38c1d90406be4a0602ec7f
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1295352
milestone51.0a1
backs out3a4afeb8a04640371911635a9ec883e37b0e22db
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
Backed out changeset 3a4afeb8a046 (bug 1295352)
dom/media/tests/mochitest/test_getUserMedia_addtrack_removetrack_events.html
dom/media/tests/mochitest/test_getUserMedia_basicVideo_playAfterLoadedmetadata.html
dom/media/tests/mochitest/test_getUserMedia_bug1223696.html
dom/media/tests/mochitest/test_getUserMedia_constraints.html
dom/media/tests/mochitest/test_getUserMedia_getTrackById.html
dom/media/tests/mochitest/test_getUserMedia_loadedmetadata.html
dom/media/tests/mochitest/test_getUserMedia_mediaStreamClone.html
dom/media/tests/mochitest/test_getUserMedia_mediaStreamTrackClone.html
dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html
dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html
dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html
dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html
dom/media/tests/mochitest/test_getUserMedia_spinEventLoop.html
--- a/dom/media/tests/mochitest/test_getUserMedia_addtrack_removetrack_events.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_addtrack_removetrack_events.html
@@ -13,17 +13,16 @@ createHTML({
   bug: "1208328"
 });
 
 var spinEventLoop = () => new Promise(r => setTimeout(r, 0));
 
 var stream;
 var clone;
 var newStream;
-var tracks = [];
 
 var addTrack = track => {
   info("Adding track " + track.id);
   stream.addTrack(track);
 };
 var removeTrack = track => {
   info("Removing track " + track.id);
   stream.removeTrack(track);
@@ -45,25 +44,25 @@ runTest(() => getUserMedia({audio: true,
     stream.addEventListener("removetrack", function onRemovetrack(event) {
       ok(false, "removetrack fired unexpectedly for track " + event.track.id);
     });
 
     return getUserMedia({audio: true, video: true});
   })
   .then(s => {
     newStream = s;
-// TODO: Uncomment once bug 1294605 is fixed
-//    info("Stopping an original track");
-//    stopTrack(stream.getTracks()[0]);
+
+    info("Stopping an original track");
+    stopTrack(stream.getTracks()[0]);
 
     return spinEventLoop();
   })
   .then(() => {
     info("Removing original tracks");
-    stream.getTracks().forEach(t => (stream.removeTrack(t), tracks.push(t)));
+    stream.getTracks().forEach(t => stream.removeTrack(t));
 
     return spinEventLoop();
   })
   .then(() => {
     info("Adding other gUM tracks");
     newStream.getTracks().forEach(t => addTrack(t))
 
     return spinEventLoop();
@@ -85,17 +84,16 @@ runTest(() => getUserMedia({audio: true,
     info("Stopping clones");
     clone.getTracks().forEach(t => stopTrack(t));
 
     return spinEventLoop();
   })
   .then(() => {
     info("Stopping originals");
     stream.getTracks().forEach(t => stopTrack(t));
-    tracks.forEach(t => stopTrack(t));
 
     return spinEventLoop();
   })
   .then(() => {
     info("Removing remaining tracks");
     stream.getTracks().forEach(t => removeTrack(t));
 
     return spinEventLoop();
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideo_playAfterLoadedmetadata.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideo_playAfterLoadedmetadata.html
@@ -26,17 +26,16 @@
       return new Promise(resolve => {
         ok(playback.mediaElement.paused,
            "Media element should be paused before play()ing");
         video.addEventListener('loadedmetadata', function() {
           ok(video.videoWidth > 0, "Expected nonzero video width");
           ok(video.videoHeight > 0, "Expected nonzero video width");
           resolve();
         });
-      })
-      .then(() => stream.getTracks().forEach(t => t.stop()));
+      });
     });
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_bug1223696.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_bug1223696.html
@@ -11,42 +11,38 @@
 
   createHTML({
     title: "Testing that removeTrack+addTrack of video tracks still render the correct track in a media element",
     bug: "1223696",
     visible: true
   });
 
   runTest(() => Promise.resolve()
-    .then(() => getUserMedia({audio:true, video: true})).then(stream => {
+      .then(() => getUserMedia({audio:true, video: true})).then(stream => {
       info("Test addTrack()ing a video track to an audio-only gUM stream");
 
       var video = createMediaElement("video", "test_video_track");
       video.srcObject = stream;
       video.play();
 
       var h = new CaptureStreamTestHelper2D();
-      var removedTrack = stream.getVideoTracks()[0];
-      stream.removeTrack(removedTrack);
+      stream.removeTrack(stream.getVideoTracks()[0]);
       video.onloadeddata = () => {
         info("loadeddata");
         var canvas = document.createElement("canvas");
         canvas.getContext("2d");
         var canvasStream = canvas.captureStream();
         setInterval(() => h.drawColor(canvas, h.grey), 1000);
 
         stream.addTrack(canvasStream.getVideoTracks()[0]);
 
         checkMediaStreamContains(stream, [stream.getAudioTracks()[0],
                                           canvasStream.getVideoTracks()[0]]);
       };
 
       return listenUntil(video, "loadeddata", () => true)
         .then(() => h.waitForPixelColor(video, h.grey, 5,
-            "The canvas track should be rendered by the media element"))
-        .then(() => {
-          [removedTrack, ...stream.getAudioTracks()].forEach(t => t.stop());
-        });
+                                        "The canvas track should be rendered by the media element"));
     }));
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_constraints.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_constraints.html
@@ -97,57 +97,60 @@ var mustFailWith = (msg, reason, constra
     }
   });
 
 /**
  * Starts the test run by running through each constraint
  * test by verifying that the right resolution and rejection is fired.
  */
 
-runTest(() => Promise.resolve()
-  .then(() => {
-    // Check supported constraints first.
-    var dict = navigator.mediaDevices.getSupportedConstraints();
-    var supported = Object.keys(dict);
+runTest(function() {
 
-    mustSupport.forEach(key => ok(supported.indexOf(key) != -1 && dict[key],
-                                  "Supports " + key));
+  // Check supported constraints first.
+  var dict = navigator.mediaDevices.getSupportedConstraints();
+  var supported = Object.keys(dict);
+
+  mustSupport.forEach(key => ok(supported.indexOf(key) != -1 && dict[key],
+                                "Supports " + key));
 
-    var unexpected = supported.filter(key => mustSupport.indexOf(key) == -1);
-    is(unexpected.length, 0,
-       "Unanticipated support (please update test): " + unexpected);
-  })
-  .then(() => pushPrefs(["media.getusermedia.browser.enabled", false],
-                        ["media.getusermedia.screensharing.enabled", false]))
-  .then(() => tests.reduce((p, test) => p.then(() => getUserMedia(test.constraints))
-    .then(stream => {
-      is(null, test.error, test.message);
-      stream.getTracks().forEach(t => t.stop());
-    }, e => {
+  var unexpected = supported.filter(key => mustSupport.indexOf(key) == -1);
+  is(unexpected.length, 0,
+     "Unanticipated support (please update test): " + unexpected);
+
+  // Run constraint tests
+
+  var p = new Promise(resolve => SpecialPowers.pushPrefEnv({
+      set : [ ['media.getusermedia.browser.enabled', false],
+              ['media.getusermedia.screensharing.enabled', false] ]
+    }, resolve));
+
+  return tests.reduce((p, test) =>
+    p.then(() => navigator.mediaDevices.getUserMedia(test.constraints))
+    .then(() => is(null, test.error, test.message), e => {
       is(e.name, test.error, test.message + ": " + e.message);
       if (test.constraint) {
         is(e.constraint, test.constraint,
            test.message + " w/correct constraint.");
       }
-    }), Promise.resolve()))
-  .then(() => getUserMedia({video: true, audio: true}))
-  .then(stream => stream.getVideoTracks()[0].applyConstraints({ width: 320 })
-    .then(() => stream.getAudioTracks()[0].applyConstraints({ }))
-    .then(() => {
-      stream.getTracks().forEach(track => track.stop());
-      ok(true, "applyConstraints code exercised");
-    }))
-  // TODO: Test outcome once fake devices support constraints (Bug 1088621)
-  .then(() => mustFailWith("applyConstraints fails on non-Gum tracks",
-                           "OverconstrainedError", "",
-                           () => (new AudioContext())
-                               .createMediaStreamDestination().stream
-                               .getAudioTracks()[0].applyConstraints()))
-  .then(() => mustFailWith(
-      "getUserMedia with unsatisfied required constraint",
-      "OverconstrainedError", "deviceId",
-      () => getUserMedia({ audio: true,
-                           video: { deviceId: { exact: "unheardof" } } }))));
+    }), p)
+    .then(() => navigator.mediaDevices.getUserMedia({video: true, audio: true}))
+    .then(stream => stream.getVideoTracks()[0].applyConstraints({ width: 320 })
+      .then(() => stream.getAudioTracks()[0].applyConstraints({ })))
+    .then(() => ok(true, "applyConstraints code exercised"))
+    // TODO: Test outcome once fake devices support constraints (Bug 1088621)
+    .then(() => mustFailWith("applyConstraints fails on non-Gum tracks",
+                             "OverconstrainedError", "",
+                             () => (new AudioContext())
+                                 .createMediaStreamDestination().stream
+                                 .getAudioTracks()[0].applyConstraints()))
+    .then(() => mustFailWith(
+        "getUserMedia with unsatisfied required constraint",
+        "OverconstrainedError", "deviceId",
+        () => navigator.mediaDevices.getUserMedia({
+          audio: true,
+          video: { deviceId: { exact: "unheardof" } },
+        })));
+});
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_getTrackById.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_getTrackById.html
@@ -35,16 +35,15 @@
 
       newStream.addTrack(audioTrack);
       is(newStream.getTrackById(audioTrack.id), audioTrack,
          "getTrackByid with matching id should return the track");
 
       newStream.addTrack(videoTrack);
       is(newStream.getTrackById(videoTrack.id), videoTrack,
          "getTrackByid with matching id should return the track");
-      [audioTrack, videoTrack].forEach(t => t.stop());
     });
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_loadedmetadata.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_loadedmetadata.html
@@ -18,21 +18,19 @@
    */
   runTest(function () {
     var v = document.createElement("video");
     v.preload = "metadata";
 
     var constraints = {video: true, audio: true};
     return getUserMedia(constraints).then(stream => new Promise(resolve => {
       v.srcObject = stream;
-      v.onloadedmetadata = () => {
-        isnot(v.videoWidth, 0, "videoWidth shall be set on 'loadedmetadata'");
-        isnot(v.videoHeight, 0, "videoHeight shall be set on 'loadedmetadata'");
-        resolve();
-      };
-    })
-    .then(() => stream.getTracks().forEach(t => t.stop())));
+      v.onloadedmetadata = resolve;
+    })).then(() => {
+      isnot(v.videoWidth, 0, "videoWidth shall be set on 'loadedmetadata'");
+      isnot(v.videoHeight, 0, "videoHeight shall be set on 'loadedmetadata'");
+    });
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_mediaStreamClone.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_mediaStreamClone.html
@@ -68,31 +68,29 @@
         var test = createMediaElement('video', 'testClonePlayback');
         var playback = new MediaStreamPlayback(test, streamClone);
         return playback.playMedia(false)
           .then(() => stream.getTracks().forEach(t => t.stop()))
           .then(() => stream.stop());
     }))
     .then(() => getUserMedia({audio: true, video: true})).then(stream => {
       info("Test cloning a stream into inception");
-      var clone = stream;
-      var clones = Array(10).fill().map(() => clone = clone.clone());
-      var inceptionClone = clones.pop();
+      var inceptionClone = stream.clone().clone().clone().clone().clone()
+                                 .clone().clone().clone().clone().clone();
       checkMediaStreamCloneAgainstOriginal(inceptionClone, stream);
       stream.getTracks().forEach(t => (stream.removeTrack(t),
                                        inceptionClone.addTrack(t)));
       is(inceptionClone.getAudioTracks().length, 2,
          "The inception clone should contain the original audio track and a track clone");
       is(inceptionClone.getVideoTracks().length, 2,
          "The inception clone should contain the original video track and a track clone");
 
       var test = createMediaElement('video', 'testClonePlayback');
       var playback = new MediaStreamPlayback(test, inceptionClone);
-      return playback.playMedia(false)
-        .then(() => clones.forEach(c => c.getTracks().forEach(t => t.stop())));
+      return playback.playMedia(false);
     })
     .then(() => getUserMedia({audio: true, video: true})).then(stream => {
       info("Test adding tracks from many stream clones to the original stream");
 
       const LOOPS = 3;
       for (var i = 0; i < LOOPS; i++) {
         stream.clone().getTracks().forEach(t => stream.addTrack(t));
       }
--- a/dom/media/tests/mochitest/test_getUserMedia_mediaStreamTrackClone.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_mediaStreamTrackClone.html
@@ -35,39 +35,32 @@
   });
 
   runTest(() => Promise.resolve()
     .then(() => testSingleTrackClonePlayback({audio: true}))
     .then(() => testSingleTrackClonePlayback({video: true}))
     .then(() => getUserMedia({video: true})).then(stream => {
       info("Test cloning a track into inception");
       var track = stream.getTracks()[0];
-      var clone = track;
-      var clones = Array(10).fill().map(() => clone = clone.clone());
-      var inceptionClone = clones.pop();
+      var inceptionClone = track.clone().clone().clone().clone().clone()
+                                .clone().clone().clone().clone().clone();
       checkMediaStreamTrackCloneAgainstOriginal(inceptionClone, track);
 
       var cloneStream = new MediaStream();
       cloneStream.addTrack(inceptionClone);
 
       // cloneStream is now essentially the same as stream.clone();
       checkMediaStreamCloneAgainstOriginal(cloneStream, stream);
 
       var test = createMediaElement('video', 'testClonePlayback');
       var playback = new MediaStreamPlayback(test, cloneStream);
-      return playback.playMedia(false).then(() => {
-// TODO: Uncomment once bug 1294605 is fixed
-//          info("Testing that clones of ended tracks are ended");
-//          cloneStream.clone().getTracks().forEach(t =>
-//            is(t.readyState, "ended", "Track " + t.id + " should be ended"));
-        })
-        .then(() => {
-          clones.forEach(t => t.stop());
-          track.stop();
-        });
+      return playback.playMedia(false)
+        .then(() => info("Testing that clones of ended tracks are ended"))
+        .then(() => cloneStream.clone().getTracks().forEach(t =>
+          is(t.readyState, "ended", "Track " + t.id + " should be ended")));
     })
     .then(() => getUserMedia({audio: true, video: true})).then(stream => {
       info("Test adding many track clones to the original stream");
 
       const LOOPS = 3;
       for (var i = 0; i < LOOPS; i++) {
         stream.getTracks().forEach(t => stream.addTrack(t.clone()));
       }
--- a/dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_peerIdentity.html
@@ -17,17 +17,17 @@ function theTest() {
     if (withConstraint) {
       config.peerIdentity = 'user@example.com';
     }
     info('getting media with constraints: ' + JSON.stringify(config));
     return getUserMedia(config)
       .then(stream => Promise.all([
         audioIsSilence(withConstraint, stream),
         videoIsBlack(withConstraint, stream)
-      ]).then(() => stream.getTracks().forEach(t => t.stop())));
+      ]));
   };
 
   // both without and with the constraint
   return testPeerIdentityConstraint(false)
     .then(() => testPeerIdentityConstraint(true));
 }
 
 runTest(theTest);
--- a/dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html
@@ -10,16 +10,17 @@
   /**
    * Run a test that we can complete an audio playback cycle twice in a row.
    */
   runTest(function () {
     return getUserMedia({audio: true}).then(audioStream => {
       var testAudio = createMediaElement('audio', 'testAudio');
       var playback = new LocalMediaStreamPlayback(testAudio, audioStream);
 
-      return playback.playMediaWithoutStoppingTracks(false)
-        .then(() => playback.playMedia(true));
+      return playback.playMedia(false)
+        .then(() => playback.playMedia(true))
+        .then(() => audioStream.stop());
     });
   });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html
@@ -10,17 +10,18 @@
   /**
    * Run a test that we can complete a video playback cycle twice in a row.
    */
   runTest(function () {
     return getUserMedia({video: true, audio: true}).then(stream => {
       var testVideo = createMediaElement('video', 'testVideo');
       var playback = new LocalMediaStreamPlayback(testVideo, stream);
 
-      return playback.playMediaWithoutStoppingTracks(false)
-        .then(() => playback.playMedia(true));
+      return playback.playMedia(false)
+        .then(() => playback.playMedia(true))
+        .then(() => stream.stop());
     });
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html
@@ -10,17 +10,18 @@
   /**
    * Run a test that we can complete a video playback cycle twice in a row.
    */
   runTest(function () {
     return getUserMedia({video: true}).then(stream => {
       var testVideo = createMediaElement('video', 'testVideo');
       var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
 
-      return streamPlayback.playMediaWithoutStoppingTracks(false)
-        .then(() => streamPlayback.playMedia(true));
+      return streamPlayback.playMedia(false)
+        .then(() => streamPlayback.playMedia(true))
+        .then(() => stream.stop());
     });
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_spinEventLoop.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_spinEventLoop.html
@@ -8,21 +8,20 @@
 <script type="application/javascript">
   createHTML({ title: "getUserMedia Basic Audio Test", bug: "1208656" });
   /**
    * Run a test to verify that we can spin the event loop from within a mozGUM callback.
    */
   runTest(() => {
     var testAudio = createMediaElement('audio', 'testAudio');
     return new Promise((resolve, reject) => {
-      navigator.mozGetUserMedia({ audio: true }, stream => {
+      navigator.mozGetUserMedia({ audio: true }, () => {
         SpecialPowers.spinEventLoop(window);
-        ok(true, "Didn't crash");
-        stream.getTracks().forEach(t => t.stop());
-        resolve();
+               ok(true, "Didn't crash");
+               resolve();
       }, () => {});
     });
   });
 
 </script>
 </pre>
 </body>
 </html>