|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=448600 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 448600</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
10 </head> |
|
11 <body> |
|
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=448600">Mozilla Bug 448600</a> |
|
13 <p id="display"></p> |
|
14 |
|
15 |
|
16 <pre id="test"> |
|
17 <script type="application/javascript"> |
|
18 |
|
19 function filename(uri) { |
|
20 return uri.substr(uri.lastIndexOf("/")+1); |
|
21 } |
|
22 |
|
23 function e(id) { |
|
24 return document.getElementById(id); |
|
25 } |
|
26 |
|
27 var gLoadError = new Object(); |
|
28 |
|
29 gLoadError['video1'] = 0; |
|
30 gLoadError['video2'] = 0; |
|
31 gLoadError['video3'] = 0; |
|
32 |
|
33 var gErrorCount = 0; |
|
34 |
|
35 SimpleTest.waitForExplicitFinish(); |
|
36 |
|
37 function finishTest() { |
|
38 is(e('video1').currentSrc, |
|
39 "", |
|
40 'video1 currentSrc should be empty when there\'s no playable typed source children'); |
|
41 is(filename(e('video2').currentSrc), |
|
42 filename(e('video2').src), |
|
43 'video2 currentSrc should match src'); |
|
44 is(filename(e('video3').currentSrc), |
|
45 filename(e('video3').src), |
|
46 'video3 currentSrc should match src'); |
|
47 |
|
48 is(gLoadError['video1'], 2, "Expect one error per invalid source child on video1"); |
|
49 is(gLoadError['video2'], 1, "Expect one error on video2"); |
|
50 is(gLoadError['video3'], 1, "Expect one error on video3"); |
|
51 |
|
52 SimpleTest.finish(); |
|
53 } |
|
54 |
|
55 function videoError(event, id) { |
|
56 gLoadError[id]++; |
|
57 gErrorCount++; |
|
58 if (gErrorCount >= 4) { |
|
59 finishTest(); |
|
60 } |
|
61 } |
|
62 |
|
63 </script> |
|
64 <!-- We make the resource URIs unique to ensure that they are (re)loaded with the new disable-decoder prefs. --> |
|
65 <div id="content"> |
|
66 </div> |
|
67 <script> |
|
68 function makeVideos() { |
|
69 document.getElementById('content').innerHTML = '<video id="video1" preload="metadata"><source type="video/ogg" src="320x240.ogv?decoder_disabled=1" onerror="videoError(event, \'video1\');"/><source type="audio/wave" src="r11025_u8_c1.wav?decoder_disabled=1" id=\'s2\' onerror="videoError(event, \'video1\');"/></video><video id="video2" preload="metadata" src="320x240.ogv?decoder_disabled=2" onerror="videoError(event, \'video2\');"></video><video id="video3" preload="metadata" src="r11025_u8_c1.wav?decoder_disabled=2" onerror="videoError(event, \'video3\');"></video>'; |
|
70 } |
|
71 |
|
72 SpecialPowers.pushPrefEnv({"set": [["media.ogg.enabled", false], ["media.wave.enabled", false]]}, makeVideos); |
|
73 </script> |
|
74 |
|
75 </pre> |
|
76 |
|
77 </body> |
|
78 </html> |