Bug 1367955 - Remove onended handler during ended handling to avoid video.ended race issues. r=pehrsons

Bug 1386489 means that ended is not reliably set in relation to the test
seeking machinery. This results in the following behaviour being possible:
- seekToNextFrame seeks to last frame
- the seek promise resolves and invokes check to see if video has ended
- ended is not yet set (race), so another seekToNextFrame is setup
- onended handler is invoked at some point (1st time)
- seekToNextFrame seeks again, remains at last frame
- oneended handler is invoked again due to the seek (2nd time)
- finish() has been called twice

This changeset should bandaid the above being possible.

MozReview-Commit-ID: BkskWUnaJQ9

--HG--
extra : rebase_source : 0108cf82a805136a87752d0128c1c0f2e7997ff6
This commit is contained in:
Bryce Van Dyk 2017-10-27 08:32:12 +13:00
parent 5b2f666e8a
commit 822e6a7a58

View File

@ -96,6 +96,12 @@ function startTest() {
video.onended = function() {
is(numResizeRaised, resolution_change.length, "Expected number of resize events");
SimpleTest.finish();
// This shouldn't be needed, however video.ended may not be set after
// seeking to the final frame. This can result in seekToNextFrame being
// called again by seekThroughFrames and onended being invoked again,
// resulting in multiple finish() calls.
// FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=1386489
video.onended = null;
};
document.getElementById("content").appendChild(video);