Bug 1270983 - Wait for media to being playing before pause check to avoid timeout. r=jaws

MozReview-Commit-ID: 7F18fUU8asl

--HG--
extra : rebase_source : b0495ac5c936009f86f919e14efe71257eb8bf59
This commit is contained in:
Ray Lin 2017-04-18 10:48:48 +08:00
Родитель 837a8390aa
Коммит eec2adc8fb
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -59,6 +59,7 @@ add_task(function* test_setup_html() {
let videoIframe = doc.querySelector("#test-video-in-iframe");
let video = videoIframe.contentDocument.querySelector("video");
let awaitPause = ContentTaskUtils.waitForEvent(video, "pause");
yield ContentTaskUtils.waitForCondition(() => !video.paused, "Making sure video is playing before calling pause");
video.pause();
yield awaitPause;
@ -66,6 +67,7 @@ add_task(function* test_setup_html() {
// media documents always use a <video> tag.
let audio = audioIframe.contentDocument.querySelector("video");
awaitPause = ContentTaskUtils.waitForEvent(audio, "pause");
yield ContentTaskUtils.waitForCondition(() => !audio.paused, "Making sure audio is playing before calling pause");
audio.pause();
yield awaitPause;
});