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
--- 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);