2009-03-08 14:01:03 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=479711
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 479711</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
2009-03-08 14:01:03 -07:00
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
<script>
|
|
|
|
|
2009-04-09 18:12:19 -07:00
|
|
|
var gRegisteredElements = [];
|
2009-03-29 18:22:02 -07:00
|
|
|
var gLog = false;
|
|
|
|
var gTestWindow;
|
|
|
|
|
2009-03-08 14:01:03 -07:00
|
|
|
function log(msg) {
|
2009-03-29 18:22:02 -07:00
|
|
|
if (gLog) {
|
|
|
|
document.getElementById('log').innerHTML += "<p>"+msg+"</p>";
|
|
|
|
dump(msg + "\n");
|
|
|
|
}
|
2009-03-08 14:01:03 -07:00
|
|
|
}
|
|
|
|
|
2009-04-09 18:12:19 -07:00
|
|
|
function register(v) {
|
|
|
|
gRegisteredElements.push(v);
|
2009-03-08 14:01:03 -07:00
|
|
|
}
|
2009-04-09 18:12:19 -07:00
|
|
|
|
2009-03-08 14:01:03 -07:00
|
|
|
function loaded() {
|
2009-04-09 18:12:19 -07:00
|
|
|
log("onload fired!");
|
|
|
|
|
|
|
|
for (var i = 0; i < gRegisteredElements.length; ++i) {
|
|
|
|
var v = gRegisteredElements[i];
|
|
|
|
ok(v.readyState >= v.HAVE_CURRENT_DATA, "Video " + v.id + " is not ready before onload fired");
|
|
|
|
}
|
2009-03-29 18:22:02 -07:00
|
|
|
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
gTestWindow.close();
|
|
|
|
|
2009-03-08 14:01:03 -07:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
addLoadEvent(loaded);
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=479711">Mozilla Bug 479711</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2009-04-09 18:12:19 -07:00
|
|
|
<video src="320x240.ogv" id="v0"></video>
|
2009-03-08 14:01:03 -07:00
|
|
|
|
|
|
|
|
|
|
|
<div id="log" style="font-size: small;"></div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 479711 **/
|
|
|
|
|
2009-04-09 18:12:19 -07:00
|
|
|
register(document.getElementById('v0'));
|
2009-03-08 14:01:03 -07:00
|
|
|
|
|
|
|
function createVideo(id) {
|
|
|
|
var v = document.createElement("video");
|
|
|
|
v.id = id;
|
2009-04-09 18:12:19 -07:00
|
|
|
if (gLog) {
|
2009-10-09 04:48:33 -07:00
|
|
|
var gEventTypes = [ 'loadstart', 'progress', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'play', 'pause', 'loadedmetadata', 'loadeddata', 'waiting', 'playing', 'canplay', 'canplaythrough', 'seeking', 'seeked', 'timeupdate', 'ended', 'ratechange', 'durationchange', 'volumechange' ];
|
2009-04-09 18:12:19 -07:00
|
|
|
function listener(evt) {
|
|
|
|
log('event ' + evt.target.id + " " + evt.type);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var i=0; i<gEventTypes.length; i++) {
|
|
|
|
var t = gEventTypes[i];
|
|
|
|
v.addEventListener(t, listener, false);
|
|
|
|
}
|
2009-03-08 14:01:03 -07:00
|
|
|
}
|
2010-03-08 22:14:21 -08:00
|
|
|
v.src = "http://localhost:8888/tests/content/media/test/320x240.ogv";
|
2009-04-09 18:12:19 -07:00
|
|
|
register(v);
|
2009-03-08 14:01:03 -07:00
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Load, add, then remove.
|
|
|
|
var v1 = createVideo("v1");
|
|
|
|
v1.load();
|
|
|
|
document.body.appendChild(v1);
|
|
|
|
v1.parentNode.removeChild(v1);
|
|
|
|
|
|
|
|
// Load and add.
|
|
|
|
var v2 = createVideo("v2");
|
|
|
|
v2.load();
|
|
|
|
document.body.appendChild(v2);
|
|
|
|
|
|
|
|
// Load outside of doc.
|
|
|
|
var v3 = createVideo("v3");
|
|
|
|
v3.load();
|
|
|
|
|
|
|
|
// Load and move to another document.
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
var v4 = createVideo("v4");
|
|
|
|
v4.load(); // load started while in this document, this doc's load will block until
|
|
|
|
// the video's finished loading (in the other document).
|
2009-03-29 18:22:02 -07:00
|
|
|
// 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.
|
|
|
|
gTestWindow = window.open("", "testWindow", "width=400,height=400");
|
2009-03-08 14:01:03 -07:00
|
|
|
gTestWindow.document.body.appendChild(v4);
|
2009-04-09 18:12:19 -07:00
|
|
|
|
2009-03-08 14:01:03 -07:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|