Bug 1427934. P3 - check v.ended before calling callSeekToNextFrame(). draft
authorJW Wang <jwwang@mozilla.com>
Thu, 04 Jan 2018 11:25:51 +0800
changeset 715553 08db8ed94708ca17a92c52b437523d9283be5cd6
parent 715552 9af104eccad04291f4abfaa22fc611fced48e8e3
child 744814 a7ea48409e3e6b96c4ca31cce99f3f3e4d175c30
push id94182
push userjwwang@mozilla.com
push dateThu, 04 Jan 2018 03:51:57 +0000
bugs1427934
milestone59.0a1
Bug 1427934. P3 - check v.ended before calling callSeekToNextFrame(). v.ended is set to true before the 'ended' event is fired. Then we can simplify the code by asserting seekToNextFrame() should never be rejected. MozReview-Commit-ID: 5fB2QuboU0I
dom/media/test/test_seekToNextFrame.html
--- a/dom/media/test/test_seekToNextFrame.html
+++ b/dom/media/test/test_seekToNextFrame.html
@@ -31,26 +31,22 @@ function startTest(test, token) {
 
   function callSeekToNextFrame() {
     v.seekToNextFrame().then(
       () => {
         if (!v.seenSeeking) {
           ok(false, v.token + ": Should have already received seeking event.");
         }
         v.seenSeeking = false;
-        if (!v.seenEnded)
+        if (!v.ended) {
           callSeekToNextFrame();
+        }
       },
       () => {
-        // 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.");
+        ok(false, v.token + ": seekToNextFrame() failed.");
       }
     );
   }
 
   var onLoadedmetadata = function(test, v) { return function() {
     callSeekToNextFrame();
   }}(test, v);