Bug 1550442 - check track's ready state in the beginning of the test. r=baku

If the track has already finished loading, we can directly run `trackLoaded()`.

Differential Revision: https://phabricator.services.mozilla.com/D37953

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alastor Wu 2019-07-16 10:09:52 +00:00
Родитель 0ba66c379f
Коммит 053cbe10fb
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -9,7 +9,13 @@
async_test(function(t) {
var video = document.querySelector("video");
var track = document.querySelector("track");
track.onload = t.step_func(trackLoaded);
if (track.readyState != HTMLTrackElement.LOADED) {
assert_not_equals(track.readyState, HTMLTrackElement.ERROR,
"track failed to load resource.");
track.onload = t.step_func(trackLoaded);
} else {
trackLoaded();
}
var cueCount = 0;
var textTrack;