gecko/content/media/test/test_error_on_404.html

81 lines
1.8 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=476731
-->
<head>
<title>Test for Bug 476731</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</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 **/
var gLoadedData = new Object();
var gLoadStart = new Object();
var gLoadError = new Object();
gLoadedData['v'] = false;
gLoadedData['a'] = false;
gLoadStart['v'] = false;
gLoadStart['a'] = false;
gLoadError['v'] = false;
gLoadError['a'] = false;
function loadError(evt, id) {
// Prevent mochitest's onerror handler catching the 'error' event on bubble.
evt.stopPropagation();
is(gLoadError[id], false, "Shouldn't have more than one error for each media element");
gLoadError[id] = true;
is(gLoadStart[id], true, "Should have started load");
is(gLoadedData[id], false, "Shouldn't have finished load.");
if (gLoadError['a'] && gLoadError['v'])
SimpleTest.finish();
}
function loadedData(evt, id) {
gLoadedData[id] = true;
}
function loadStart(evt, id) {
gLoadStart[id] = true;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id="v"
onerror="loadError(event, 'v');"
onloadstart="loadStart(event, 'v');"
onloadeddata="loadedData(event, 'v');"
src="404.ogg">
</video>
<audio id="a"
onerror="loadError(event, 'a');"
onloadstart="loadStart(event, 'a');"
onloadeddata="loadedData(event, 'a');"
src="404.wav">
</audio>
</body>
</html>