test_empty_resource.html (1480B)
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> 14 15 <p id="display"></p> 16 <div id="content" style="display: none"> 17 18 </div> 19 <pre id="test"> 20 <script type="application/javascript"> 21 22 // Shorter timeout for this test should finish soon. 23 SimpleTest.requestLongerTimeout(0.3); 24 25 function finish(v) { 26 isnot(v.error, null, "should've got an error event"); 27 SimpleTest.finish(); 28 } 29 30 function onload() { 31 info("iframe loaded"); 32 var v = SpecialPowers.wrap(document.body.getElementsByTagName("iframe")[0]) 33 .contentDocument.body.getElementsByTagName("video")[0]; 34 35 // Got 'error' as expected, finish the test. 36 if (v.error) { 37 finish(v); 38 return; 39 } 40 41 // Otherwise, wait for it. 42 v.onerror = function() { 43 finish(v); 44 } 45 } 46 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); 54 55 </script> 56 </pre> 57 </body> 58 </html>