| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="/media-resources/video-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <video autoplay controls="controls" id='vid'></video> | |
| 8 <p>Tests that webkitsourceopen event fires even if garbage collection ha
ppens between setting video.src & the webkitsourceopen event.</p> | |
| 9 <script type="text/javascript"> | |
| 10 function createMediaSourceURL() | |
| 11 { | |
| 12 var mediaSource = new WebKitMediaSource(); | |
| 13 var onSourceOpen = function (e) | |
| 14 { | |
| 15 sourceOpened = true; | |
| 16 consoleWrite("onSourceOpen called."); | |
| 17 endTest(); | |
| 18 }; | |
| 19 consoleWrite("Setting webkitsourceopen event listener."); | |
| 20 mediaSource.addEventListener('webkitsourceopen', onSourceOpen); | |
| 21 return window.URL.createObjectURL(mediaSource); | |
| 22 } | |
| 23 | |
| 24 function start() | |
| 25 { | |
| 26 var video = document.getElementById('vid'); | |
| 27 var sourceOpened = false; | |
| 28 var onStalled = function (e) | |
| 29 { | |
| 30 if (sourceOpened) | |
| 31 return; | |
| 32 | |
| 33 failTest('stalled event fired before webkitsourceopen'); | |
| 34 }; | |
| 35 video.addEventListener('stalled', onStalled); | |
| 36 | |
| 37 var url = createMediaSourceURL(); | |
| 38 consoleWrite("Running garbage collector."); | |
| 39 gc(); | |
| 40 | |
| 41 consoleWrite("Setting video.src to object URL."); | |
| 42 video.src = url; | |
| 43 } | |
| 44 start(); | |
| 45 </script> | |
| 46 </body> | |
| 47 </html> | |
| OLD | NEW |