OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Verify that we don't crash on close if the MediaSource.sourceBuffers hold
s the last reference to its SourceBuffer objects.</title> |
3 <head> | 3 <script src="/w3c/resources/testharness.js"></script> |
4 <script src="/js-test-resources/js-test.js"></script> | 4 <script src="/w3c/resources/testharnessreport.js"></script> |
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 5 <video></video> |
6 (Please avoid writing new tests using video-test.js) --> | 6 <script> |
7 <script src="/media-resources/video-test.js"></script> | 7 async_test(function(t) { |
8 <script type="text/javascript"> | 8 var video = document.createElement("video"); |
9 function onSourceOpen(e) | 9 var mediaSource = new MediaSource(); |
10 { | |
11 consoleWrite("Calling addSourceBuffer()"); | |
12 e.target.addSourceBuffer('video/webm;codecs="vp8"'); | |
13 | 10 |
14 consoleWrite("Running garbage collector to cleanup the SourceBuf
fer reference returned by addSourceBuffer()"); | 11 mediaSource.addEventListener('sourceopen', function() { |
15 gc(); | 12 mediaSource.addSourceBuffer('video/webm;codecs="vp8"'); |
16 | 13 |
17 document.querySelector('#v').src = ""; | 14 // Running garbage collector to cleanup the SourceBuffer reference retur
ned by addSourceBuffer(). |
18 } | 15 gc(); |
19 | 16 |
20 function onSourceClose(e) | 17 video.src = ""; |
21 { | 18 }); |
22 consoleWrite("onSourceClose"); | |
23 endTest(); | |
24 } | |
25 | 19 |
26 function main() | 20 mediaSource.onsourceclose = t.step_func_done(); |
27 { | 21 video.src = URL.createObjectURL(mediaSource); |
28 var video = document.querySelector('#v'); | 22 }); |
29 var mediaSource = new MediaSource(); | 23 </script> |
30 | |
31 mediaSource.addEventListener('sourceopen', onSourceOpen); | |
32 mediaSource.addEventListener('sourceclose', onSourceClose); | |
33 | |
34 video.src = URL.createObjectURL(mediaSource); | |
35 } | |
36 </script> | |
37 </head> | |
38 <body onload="main()"> | |
39 <video id="v"></video> | |
40 <p>Verify that we don't crash on close if the MediaSource.sourceBuffers ho
lds the last reference to its SourceBuffer objects.</p> | |
41 </body> | |
42 </html> | |
OLD | NEW |