Backed out changeset ddccd40117a0 (bug 1853271) for causing bug 1854769. CLOSED TREE
[gecko.git] / dom / media / test / test_empty_resource.html
blob8f65bb503dfaf1027055c780d6ab124ea54bc206
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1094549
5 -->
6 <head>
7 <title>Test for Bug 1094549</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>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1094549">Mozilla Bug 1094549</a>
15 <p id="display"></p>
16 <div id="content" style="display: none">
18 </div>
19 <pre id="test">
20 <script type="application/javascript">
22 // Shorter timeout for this test should finish soon.
23 SimpleTest.requestLongerTimeout(0.3);
25 function finish(v) {
26 isnot(v.error, null, "should've got an error event");
27 SimpleTest.finish();
30 function onload() {
31 info("iframe loaded");
32 var v = SpecialPowers.wrap(document.body.getElementsByTagName("iframe")[0])
33 .contentDocument.body.getElementsByTagName("video")[0];
35 // Got 'error' as expected, finish the test.
36 if (v.error) {
37 finish(v);
38 return;
41 // Otherwise, wait for it.
42 v.onerror = function() {
43 finish(v);
47 SimpleTest.waitForExplicitFinish();
48 var f = document.createElement("iframe");
49 // Assign a resource file with zero length and expect the error event from
50 // the video element since decoding metadata will fail.
51 f.src = "data:video/webm,";
52 f.addEventListener("load", onload);
53 document.body.appendChild(f);
55 </script>
56 </pre>
57 </body>
58 </html>