Bug 680275 - Ensure that the video load begins before adding the video to a new document. r=roc

This commit is contained in:
Josh Matthews 2011-08-18 18:38:26 -04:00
Родитель eef8ec2034
Коммит 0d1ce63191
1 изменённых файлов: 9 добавлений и 7 удалений

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

@ -96,14 +96,16 @@ v.load();
// Load and move to another document.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
v = createVideo(test.name, test.type, "4");
v.onloadstart = function(e) {
// Opening a new window to do this is a bit annoying, but if we use an iframe here,
// delaying of the iframe's load event might interfere with the firing of our load event
// in some confusing way. So it's simpler just to open another window.
var w = window.open("", "testWindow", "width=400,height=400");
w.document.body.appendChild(v);
testWindows.push(w);
};
v.load(); // load started while in this document, this doc's load will block until
// the video's finished loading (in the other document).
// Opening a new window to do this is a bit annoying, but if we use an iframe here,
// delaying of the iframe's load event might interfere with the firing of our load event
// in some confusing way. So it's simpler just to open another window.
var w = window.open("", "testWindow", "width=400,height=400");
w.document.body.appendChild(v);
testWindows.push(w);
// the video's finished loading (in the other document).
if (gRegisteredElements.length > 0) {
SimpleTest.waitForExplicitFinish();