Bug 1315723 - Resolve the timeout problem of the browser_cache.js. r=baku

--HG--
extra : rebase_source : 8d0e362e38167e38de07d921eb16d6952f766a4f
This commit is contained in:
Tim Huang 2016-11-22 14:57:19 +08:00
parent 52155b4a89
commit 58a0093852

View File

@ -157,12 +157,6 @@ function* doTest(aBrowser) {
let audioSource = content.document.createElement('source');
let audioTrack = content.document.createElement('track');
// Assign attributes for the audio element.
audioSource.setAttribute("src", audioURL + URLSuffix);
audioSource.setAttribute("type", "audio/ogg");
audioTrack.setAttribute("src", trackURL);
audioTrack.setAttribute("kind", "subtitles");
// Append the audio and track element into the body, and wait until they're finished.
yield new Promise(resolve => {
let audioLoaded = false;
@ -186,12 +180,20 @@ function* doTest(aBrowser) {
}
};
// Add the event listeners before everything in case we lose events.
audioTrack.addEventListener("load", trackListener, false);
audio.addEventListener("canplaythrough", audioListener, false);
// Assign attributes for the audio element.
audioSource.setAttribute("src", audioURL + URLSuffix);
audioSource.setAttribute("type", "audio/ogg");
audioTrack.setAttribute("src", trackURL);
audioTrack.setAttribute("kind", "subtitles");
audio.appendChild(audioSource);
audio.appendChild(audioTrack);
audio.autoplay = true;
audioTrack.addEventListener("load", trackListener, false);
audio.addEventListener("canplaythrough", audioListener, false);
content.document.body.appendChild(audio);
});
@ -202,11 +204,13 @@ function* doTest(aBrowser) {
resolve();
};
// Add the event listener before everything in case we lose the event.
video.addEventListener("canplaythrough", listener, false);
// Assign attributes for the video element.
video.setAttribute("src", videoURL + URLSuffix);
video.setAttribute("type", "video/ogg");
video.addEventListener("canplaythrough", listener, false);
content.document.body.appendChild(video);
});
});