Bug 1345713 - the seek promise might be rejected because the 'ended' event handler shut down the decoder. r?kaku draft
authorJW Wang <jwwang@mozilla.com>
Thu, 09 Mar 2017 11:20:05 +0800
changeset 496373 29439b997b888ff1e9c3b5971f676becba289d6b
parent 496365 86227f063a128b01c1b0342befc37a652bcc8f2b
child 548596 8d23e94a7fa92e683bf49b63d74c96b46d92f579
push id48580
push userjwwang@mozilla.com
push dateFri, 10 Mar 2017 03:05:12 +0000
reviewerskaku
bugs1345713
milestone55.0a1
Bug 1345713 - the seek promise might be rejected because the 'ended' event handler shut down the decoder. r?kaku MozReview-Commit-ID: JuIXXDOATmu
dom/media/test/test_seekToNextFrame.html
--- a/dom/media/test/test_seekToNextFrame.html
+++ b/dom/media/test/test_seekToNextFrame.html
@@ -33,17 +33,22 @@ function startTest(test, token) {
     v.seekToNextFrame().then(
       () => {
         ok(v.seenSeeking, "Should have already received seeking event.")
         v.seenSeeking = false;
         if (!v.seenEnded)
           callSeekToNextFrame();
       },
       () => {
-        ok(false, "seekToNextFrame() failed.");
+        // When seek reaches the end, the promise is resolved before 'ended'
+        // is fired. The resolver calls callSeekToNextFrame() to schedule
+        // another seek and then the 'ended' handler calls finish() to shut
+        // down the MediaDecoder which will reject the seek promise. So we don't
+        // raise an error in this case.
+        ok(v.finished, "seekToNextFrame() failed.");
       }
     );
   }
 
   var onLoadedmetadata = function(test, v) { return function() {
     callSeekToNextFrame();
   }}(test, v);