| OLD | NEW |
| 1 <body> | 1 <body> |
| 2 <audio></audio> | 2 <audio></audio> |
| 3 <video></video> | 3 <video></video> |
| 4 <script> | 4 <script> |
| 5 window.addEventListener('load', function () { | 5 window.addEventListener('load', function () { |
| 6 var windowOpener = window.opener; | 6 var windowOpener = window.opener; |
| 7 var isAudioLoaded = false; | 7 var isAudioLoaded = false; |
| 8 var isVideoLoaded = false; | 8 var isVideoLoaded = false; |
| 9 function checkTestCompletion() { | 9 function checkTestCompletion() { |
| 10 if (isAudioLoaded && isVideoLoaded && windowOpener) { | 10 if (isAudioLoaded && isVideoLoaded && windowOpener) { |
| 11 windowOpener.postMessage('done', '*'); | 11 windowOpener.postMessage('done', '*'); |
| 12 } | 12 } |
| 13 } | 13 } |
| 14 | 14 |
| 15 // Assigning via JavaScript after 'load' rather than direclty in the | 15 // Assigning via JavaScript after 'load' rather than direclty in the |
| 16 // markup in order to avoid the console's flaky "what line am I on?" | 16 // markup in order to avoid the console's flaky "what line am I on?" |
| 17 // autodetection. | 17 // autodetection. |
| 18 var audioElement = document.querySelector('audio'); | 18 var audioElement = document.querySelector('audio'); |
| 19 audioElement.src = "http://127.0.0.1:8080/resources/test.mp4"; | 19 audioElement.src = "http://example.test:8080/resources/test.mp4"; |
| 20 audioElement.addEventListener("loadstart", function(event) { | 20 audioElement.addEventListener("loadstart", function(event) { |
| 21 isAudioLoaded = true; | 21 isAudioLoaded = true; |
| 22 checkTestCompletion(); | 22 checkTestCompletion(); |
| 23 }); | 23 }); |
| 24 | 24 |
| 25 var videoElement = document.querySelector('video'); | 25 var videoElement = document.querySelector('video'); |
| 26 videoElement.src = "http://127.0.0.1:8080/resources/test.mp4"; | 26 videoElement.src = "http://example.test:8080/resources/test.mp4"; |
| 27 videoElement.addEventListener("loadstart", function(event) { | 27 videoElement.addEventListener("loadstart", function(event) { |
| 28 isVideoLoaded = true; | 28 isVideoLoaded = true; |
| 29 checkTestCompletion(); | 29 checkTestCompletion(); |
| 30 }); | 30 }); |
| 31 }); | 31 }); |
| 32 </script> | 32 </script> |
| 33 </body> | 33 </body> |
| OLD | NEW |