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"/>
|
2010-05-30 15:02:06 -07:00
|
|
|
<script type="text/javascript" src="manifest.js"></script>
|
2009-03-08 14:01:03 -07:00
|
|
|
<script>
|
|
|
|
|
2009-04-09 18:12:19 -07:00
|
|
|
var gRegisteredElements = [];
|
2009-03-29 18:22:02 -07:00
|
|
|
var gLog = false;
|
2010-05-30 15:02:06 -07:00
|
|
|
var testWindows = [];
|
2009-03-29 18:22:02 -07:00
|
|
|
|
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];
|
2010-05-30 15:02:06 -07:00
|
|
|
ok(v.readyState >= v.HAVE_CURRENT_DATA,
|
|
|
|
v._name + ":" + v.id + " is not ready before onload fired (" + v.readyState + ")");
|
2009-04-09 18:12:19 -07:00
|
|
|
}
|
2009-03-29 18:22:02 -07:00
|
|
|
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
2010-05-30 15:02:06 -07:00
|
|
|
for (i=0; i<testWindows.length; ++i) {
|
|
|
|
testWindows[i].close();
|
|
|
|
}
|
2009-03-29 18:22:02 -07:00
|
|
|
|
2010-08-26 19:11:46 -07:00
|
|
|
mediaTestCleanup();
|
|
|
|
|
2009-03-08 14:01:03 -07:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
addLoadEvent(loaded);
|
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
|
2009-03-08 14:01:03 -07:00
|
|
|
</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>
|
|
|
|
|
|
|
|
|
|
|
|
<div id="log" style="font-size: small;"></div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 479711 **/
|
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
function createVideo(name, type, id) {
|
2009-03-08 14:01:03 -07:00
|
|
|
var v = document.createElement("video");
|
2010-05-30 15:02:06 -07:00
|
|
|
v.src = name;
|
|
|
|
v._name = name;
|
|
|
|
v.id = id;
|
2009-04-09 18:12:19 -07:00
|
|
|
register(v);
|
2009-03-08 14:01:03 -07:00
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
2010-08-26 19:11:46 -07:00
|
|
|
var test = getPlayableVideo(gSmallTests);
|
|
|
|
|
|
|
|
// Straightforward add, causing a load.
|
|
|
|
var v = createVideo(test.name, test.type, "1");
|
|
|
|
document.body.appendChild(v);
|
|
|
|
|
|
|
|
// Load, add, then remove.
|
|
|
|
v = createVideo(test.name, test.type, "1");
|
|
|
|
v.load();
|
|
|
|
document.body.appendChild(v);
|
|
|
|
v.parentNode.removeChild(v);
|
|
|
|
|
|
|
|
// Load and add.
|
|
|
|
v = createVideo(test.name, test.type, "2");
|
|
|
|
v.load();
|
|
|
|
document.body.appendChild(v);
|
|
|
|
|
|
|
|
// Load outside of doc.
|
|
|
|
v = createVideo(test.name, test.type, "3");
|
|
|
|
v.load();
|
|
|
|
|
|
|
|
// Load and move to another document.
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
v = createVideo(test.name, test.type, "4");
|
|
|
|
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"+i, "width=400,height=400");
|
|
|
|
w.document.body.appendChild(v);
|
|
|
|
testWindows.push(w);
|
2010-05-30 15:02:06 -07:00
|
|
|
|
|
|
|
if (gRegisteredElements.length > 0) {
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
} else {
|
|
|
|
todo(false, "No types supported");
|
|
|
|
}
|
2009-04-09 18:12:19 -07:00
|
|
|
|
2009-03-08 14:01:03 -07:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|