2009-02-15 09:14:49 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=476731
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 476731</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
2009-02-15 09:14:49 -08: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-02-15 09:14:49 -08:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=476731">Mozilla Bug </a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug **/
|
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
var videos = [];
|
|
|
|
|
|
|
|
function FinishedLoads() {
|
|
|
|
if (videos.length == 0)
|
|
|
|
return false;
|
|
|
|
for (var i=0; i<videos.length; ++i) {
|
|
|
|
if (videos[i]._loadedData) {
|
|
|
|
// A video loadeddata, it should have 404'd. Signal the end of the test
|
|
|
|
// so the error will be reported.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!videos[i]._loadError) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2009-02-15 09:14:49 -08:00
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
function loadError(evt) {
|
2009-02-15 09:14:49 -08:00
|
|
|
// Prevent mochitest's onerror handler catching the 'error' event on bubble.
|
2010-05-30 15:02:06 -07:00
|
|
|
var v = evt.target;
|
|
|
|
is(v._loadError, false, "Shouldn't receive multiple error events for " + v.src);
|
|
|
|
v._loadError = true;
|
|
|
|
is(v._loadStart, true, "Receive loadstart for " + v.src);
|
|
|
|
is(v._loadedData, false, "Shouldn't receive loadeddata for " + v.src);
|
|
|
|
if (FinishedLoads(videos))
|
2009-02-15 09:14:49 -08:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
function loadedData(evt) {
|
|
|
|
evt.target._loadedData = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadStart(evt) {
|
|
|
|
evt.target._loadStart = true;
|
2009-02-15 09:14:49 -08:00
|
|
|
}
|
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
// Create all video objects.
|
|
|
|
for (var i=0; i<g404Tests.length; ++i) {
|
|
|
|
var v = document.createElement("video");
|
|
|
|
var test = g404Tests[i];
|
|
|
|
if (!v.canPlayType(test.type)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
v.src = test.name;
|
|
|
|
v._loadedData = false;
|
|
|
|
v._loadStart = false;
|
|
|
|
v._loadError = false;
|
|
|
|
v.addEventListener("error", loadError, false);
|
|
|
|
v.addEventListener("loadstart", loadStart, false);
|
|
|
|
v.addEventListener("loadedddata", loadedData, false);
|
|
|
|
document.body.appendChild(v); // Will start load.
|
|
|
|
videos.push(v);
|
2009-02-15 09:14:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
if (videos.length == 0) {
|
|
|
|
todo(false, "No types supported");
|
|
|
|
} else {
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
}
|
2009-02-15 09:14:49 -08:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|