Bug 1423241 - Remove drawImage exception handling from captureStream_common.js. r=jib
authorAndreas Pehrson <apehrson@mozilla.com>
Fri, 23 Nov 2018 15:01:07 +0000
changeset 504265 82afe83c9c4f59c73bdbbb62c4ab85f8ffb9906d
parent 504264 7964b0b2f8363fbf1e5d3cdcc50b1d279987f1e9
child 504266 430c57c4fb18674399b10c2d40d18f2bdca91ce3
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1423241
milestone65.0a1
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
Bug 1423241 - Remove drawImage exception handling from captureStream_common.js. r=jib This can conceal real bugs. Tests should be fixed so they don't risk calling getPixel in invalid states instead. Differential Revision: https://phabricator.services.mozilla.com/D9100
dom/canvas/test/captureStream_common.js
dom/media/tests/mochitest/test_getUserMedia_bug1223696.html
--- a/dom/canvas/test/captureStream_common.js
+++ b/dom/canvas/test/captureStream_common.js
@@ -123,22 +123,18 @@ CaptureStreamTestHelper.prototype = {
     while (true) {
       await Promise.race([
         new Promise(resolve => video.addEventListener("timeupdate", resolve, { once: true })),
         cancel,
       ]);
       if (aborted) {
         throw await cancel;
       }
-      try {
-        if (test(this.getPixel(video, offsetX, offsetY, width, height))) {
-          return;
-        }
-      } catch (e) {
-        info("Waiting for pixel but no video available: " + e + "\n" + e.stack);
+      if (test(this.getPixel(video, offsetX, offsetY, width, height))) {
+        return;
       }
     }
   },
 
   /*
    * Returns a promise that resolves when the top left pixel of |video| matches
    * on all channels. Use |threshold| for fuzzy matching the color on each
    * channel, in the range [0,255]. 0 means exact match, 255 accepts anything.
--- a/dom/media/tests/mochitest/test_getUserMedia_bug1223696.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_bug1223696.html
@@ -19,20 +19,23 @@
     .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);
+      var removedTrack;
       video.onloadeddata = () => {
         info("loadeddata");
+
+        removedTrack = stream.getVideoTracks()[0];
+        stream.removeTrack(removedTrack);
+
         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],