test_error_in_video_document.html (1752B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=604067 5 --> 6 <head> 7 <title>Test for Bug 604067</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=604067">Mozilla Bug 604067</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 /** Test for Bug 604067 */ 23 24 function documentVideo() { 25 return document.body.getElementsByTagName("iframe")[0] 26 .contentDocument.body.getElementsByTagName("video")[0]; 27 } 28 29 function check() { 30 var v = documentVideo(); 31 32 // Debug info for Bug 608634 33 ok(true, "iframe src=" + document.body.getElementsByTagName("iframe")[0].src); 34 is(v.readyState, v.HAVE_NOTHING, "Ready state for " + document.body.getElementsByTagName("iframe")[0].src); 35 36 isnot(v.error, null, "Error object"); 37 is(v.networkState, v.NETWORK_NO_SOURCE, "Network state"); 38 is(v.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED, "Expected media not supported error"); 39 SimpleTest.finish(); 40 } 41 42 // Find an error test that we'd think we should be able to play (if it 43 // wasn't already known to fail). This needs to fail early: for example, 44 // incorrect metadata, not correct metadata but incorrect encoded packets. 45 var t = "bug1535980.webm"; 46 if (!t) { 47 todo(false, "No types supported"); 48 } else { 49 SimpleTest.waitForExplicitFinish(); 50 51 var f = document.createElement("iframe"); 52 f.src = t; 53 f.addEventListener("load", check); 54 document.body.appendChild(f); 55 } 56 57 </script> 58 </pre> 59 </body> 60 </html>