<!DOCTYPE html>
<title>Tests that "sourceopen" event fires even if garbage collection happens between setting "video.src" and the "sourceopen" event.</title>
<script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
var video = document.querySelector('video');
video.onstalled = t.unreached_func();
var url = createMediaSourceURL();
// Running garbage collector.
gc();
// Setting video.src to object URL.
video.src = url;
function createMediaSourceURL() {
var mediaSource = new MediaSource();
// Setting sourceopen event listener.
mediaSource.onsourceopen = t.step_func_done();
return URL.createObjectURL(mediaSource);
}
});
</script>