4 https://bugzilla.mozilla.org/show_bug.cgi?id=479711
7 <title>Test for Bug
479711</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
10 <script type=
"text/javascript" src=
"manifest.js"></script>
13 var gRegisteredElements
= [];
16 function register(v
) {
17 gRegisteredElements
.push(v
);
21 info("onload fired!");
23 for (var i
= 0; i
< gRegisteredElements
.length
; ++i
) {
24 var v
= gRegisteredElements
[i
];
25 ok(v
.readyState
>= v
.HAVE_CURRENT_DATA
,
26 v
._name
+ ":" + v
.id
+ " is not ready before onload fired (" + v
.readyState
+ ")");
29 for (i
=0; i
<testWindows
.length
; ++i
) {
30 testWindows
[i
].close();
43 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=479711">Mozilla Bug
479711</a>
45 <div id=
"content" style=
"display: none"></div>
47 <script type=
"application/javascript">
49 /** Test for Bug
479711 **/
51 function createVideo(name, type, id) {
52 var v = document.createElement(
"video");
53 v.preload =
"metadata";
54 // Make sure each video is a unique resource
55 v.src = name +
"?" + id;
62 var test = getPlayableVideo(gSmallTests);
64 // Straightforward add, causing a load.
65 var v = createVideo(test.name, test.type,
"1");
66 document.body.appendChild(v);
68 // Load, add, then remove.
69 v = createVideo(test.name, test.type,
"1");
71 document.body.appendChild(v);
75 v = createVideo(test.name, test.type,
"2");
77 document.body.appendChild(v);
79 // Load outside of doc.
80 v = createVideo(test.name, test.type,
"3");
83 // Open a new window for the following test. We open it here instead of in
84 // the event handler to ensure that our document load event doesn't fire while
85 // window.open is spinning the event loop.
86 var w = window.open(
"",
"testWindow",
"width=400,height=400");
89 v = createVideo(test.name, test.type,
"4");
90 v.onloadstart = function(e) {
91 // Using a new window to do this is a bit annoying, but if we use an iframe here,
92 // delaying of the iframe's load event might interfere with the firing of our load event
93 // in some confusing way. So it's simpler just to use another window.
94 w.document.body.appendChild(v);
96 v.load(); // load started while in this document, this doc's load will block until
97 // the video's finished loading (in the other document).
99 if (gRegisteredElements.length) {
100 SimpleTest.waitForExplicitFinish();
102 todo(false,
"No types supported");