Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=465458 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 465458</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | <script type="text/javascript" src="manifest.js"></script> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=465458">Mozilla Bug 465458</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="content" style="display: none"> |
michael@0 | 16 | |
michael@0 | 17 | </div> |
michael@0 | 18 | <pre id="test"> |
michael@0 | 19 | <script type="application/javascript"> |
michael@0 | 20 | |
michael@0 | 21 | /** Test for Bug 465458 **/ |
michael@0 | 22 | |
michael@0 | 23 | var manager = new MediaTestManager; |
michael@0 | 24 | |
michael@0 | 25 | function finish(evt) { |
michael@0 | 26 | var v = evt.target; |
michael@0 | 27 | is(v._error, 2, "Should have received 2 error events before loaded"); |
michael@0 | 28 | v._finished = true; |
michael@0 | 29 | // remove error event handler, because this would otherwise |
michael@0 | 30 | // cause a failure on Windows 7, see bug 1024535 |
michael@0 | 31 | v.onerror = null; |
michael@0 | 32 | v.parentNode.removeChild(v); |
michael@0 | 33 | manager.finished(v.token); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function errorHandler(evt) { |
michael@0 | 37 | evt.target.parentNode._error++; |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | var extension = { |
michael@0 | 41 | "audio/wav" : "wav", |
michael@0 | 42 | "audio/x-wav": "wav", |
michael@0 | 43 | "video/ogg" : "ogv", |
michael@0 | 44 | "audio/ogg" : "oga", |
michael@0 | 45 | "video/webm" : "webm" |
michael@0 | 46 | }; |
michael@0 | 47 | |
michael@0 | 48 | function startTest(test, token) { |
michael@0 | 49 | var v = document.createElement('video'); |
michael@0 | 50 | v.preload = "auto"; |
michael@0 | 51 | v.onerror = function(){ok(false,"Error events on source children should not bubble");} |
michael@0 | 52 | v.token = token; |
michael@0 | 53 | manager.started(token); |
michael@0 | 54 | v._error = 0; |
michael@0 | 55 | v._finished = false; |
michael@0 | 56 | v._name = test.name; |
michael@0 | 57 | |
michael@0 | 58 | var s1 = document.createElement("source"); |
michael@0 | 59 | s1.type = test.type; |
michael@0 | 60 | s1.src = "404." + extension[test.type]; |
michael@0 | 61 | s1.addEventListener("error", errorHandler, false); |
michael@0 | 62 | v.appendChild(s1); |
michael@0 | 63 | |
michael@0 | 64 | var s2 = document.createElement("source"); |
michael@0 | 65 | s2.type = test.type; |
michael@0 | 66 | s2.src = "test_load_candidates.html"; // definitely an invalid media file, regardless of its actual mime type... |
michael@0 | 67 | s2.addEventListener("error", errorHandler, false); |
michael@0 | 68 | v.appendChild(s2); |
michael@0 | 69 | |
michael@0 | 70 | var s3 = document.createElement("source"); |
michael@0 | 71 | s3.type = test.type; |
michael@0 | 72 | s3.src = test.name; |
michael@0 | 73 | v.appendChild(s3); |
michael@0 | 74 | |
michael@0 | 75 | v.addEventListener("loadeddata", finish, false); |
michael@0 | 76 | document.body.appendChild(v); |
michael@0 | 77 | } |
michael@0 | 78 | |
michael@0 | 79 | manager.runTests(gSmallTests, startTest); |
michael@0 | 80 | |
michael@0 | 81 | </script> |
michael@0 | 82 | </pre> |
michael@0 | 83 | </body> |
michael@0 | 84 | </html> |